我已经在网站上阅读了有关此问题的各种内容,但我无法弄清楚这一点.我正在为这个应用程序使用预构建数据库.我正在使用jellybean这个应用程序.
AndroidManifest.xml中
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.quotes"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.quotes.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
Logcat输出
根据logcat它是由SQLiteCantOpenDatabaseException引起的
06-10 23:07:01.831: E/Trace(4419): error opening trace file: No such file or directory (2)
06-10 23:07:03.611: E/SQLiteLog(4419): (14) cannot open file at line 30176 of [00bb9c9ce4]
06-10 23:07:03.621: E/SQLiteLog(4419): (14) os_unix.c:30176: (2) open(/data/data/com.example.quotes/databasesQuotesdb) -
06-10 23:07:03.641: E/SQLiteDatabase(4419): Failed to open database '/data/data/com.example.quotes/databasesQuotesdb'.
06-10 …
Run Code Online (Sandbox Code Playgroud) 我已将现有的Gradle项目导入IntelliJ IDEA.我一直收到通知:
发现了无索引的远程maven存储库.禁用...
您的gradle项目中使用的以下存储库尚未编入索引:http://repo1.maven.org/maven2
如果要对这些存储库工件使用依赖项完成,请 打开存储库列表,选择所需的存储库,然后按"更新"按钮(显示气球)
所以,我已经打开了存储库列表,你可能会想到http://repo1.maven.org/maven2的Type = Remote和Updated = Never.问题是,当我点击" 更新"按钮时,IDEA需要几分钟,然后报告错误.
java.lang.RuntimeException:
org.codehaus.plexus.repository.exception.ComponentLookupException:
java.util.NoSuchElementException
role: org.apache.maven.execution.MavenExecutionRequestPopulator
roleHint:
Run Code Online (Sandbox Code Playgroud)
我现在应该怎么做?我怎么解决这个问题?我不是在寻找一种禁用通知的方法.重新启动IDEA没有帮助,尝试更新存储库索引会在下次尝试后立即失败.
我添加了这个gradle任务
然后我收到这个错误:
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/eladb/WorkspaceQa/java/UsersServer/build.gradle' line: 98
* What went wrong:
A problem occurred evaluating root project 'UsersServer'.
> No signature of method: org.gradle.api.tasks.testing.junit.JUnitOptions.includeGroups() is applicable for argument types: (java.lang.String) values: [NoDbTests]
Run Code Online (Sandbox Code Playgroud)
我的语法出了什么问题?
我看到了这个教程:
test {
useJUnit {
includeCategories 'linqmap.users.interfaces.NoDbTests'
// excludeCategories 'org.gradle.junit.CategoryB'
}
}
Run Code Online (Sandbox Code Playgroud) 我有几个文件夹试图将我的测试分成单元,集成,第三方,数据库.通过这种方式,我可以将我的测试分成多个块,使TDD更容易/更快.这是我正在尝试使用的任务.
task integrationTest(type: Test) {
testClassesDir = sourceSets.integration.output.classesDir
classpath = sourceSets.integration.runtimeClasspath
maxParallelForks 8
maxHeapSize = "4048m"
}
Run Code Online (Sandbox Code Playgroud)
我知道有testReportDir,但它已被弃用.我希望能够使用新方法.
我试过以下关闭:
reports {
html = file("$buildDir/reports/intTests")
}
reports {
setDestination = file("$buildDir/reports/intTests")
}
reports {
destinationDir = file("$buildDir/reports/intTests")
}
destinationDir = file("$buildDir/reports/intTests")
Run Code Online (Sandbox Code Playgroud) 我正在进行一些测试驱动的开发,并在我的测试用例中添加了一个Mockito verify()调用,这样(为了保护无辜的代码,名称已更改):
Api api = mock(Api.class);
Thing thing = mock(Thing.class);
when(thing.getId()).thenReturn(1);
// later...
verify(api).doAThingWithAThingId(thing.getId())
Run Code Online (Sandbox Code Playgroud)
即使我没有将调用添加api.doAThingWithAThingId()
到我的代码中,这个测试用例也会通过!但是,当我这样做的时候......
int id = thing.getId();
verify(api).doAThingWithAThingId(id);
Run Code Online (Sandbox Code Playgroud)
验证按预期失败.是什么导致了这种行为?
(为了记录,这是使用稍微旧版本的Mockito,1.8.4.)