我正在android中的一个类中对我的一个方法执行junit测试。根据{{3}}的信息,我应该将下面的库添加到我的类路径中。
${SDK_ROOT}/lib/impl/appengine-api.jar
${SDK_ROOT}/lib/impl/appengine-api-labs.jar
${SDK_ROOT}/lib/impl/appengine-api-stubs.jar
我的问题是,我应该在哪里获得这个库,我应该如何添加它们?我在ubuntu 15 64bit上运行android studio。
在android和GAE方面相当新!
我尝试了什么 这是我添加到我的modlue的build.gradle
dependencies {
testCompile 'junit:junit:4.12'
testCompile "org.mockito:mockito-core:1.9.5"
testCompile 'com.google.appengine:appengine-testing:1.8.2'
testCompile 'com.google.appengine:appengine-api-labs:1.8.2'
testCompile 'com.google.appengine:appengine-api-stubs:1.8.2'
testCompile 'com.google.appengine:appengine-tools-sdk:1.8.2'
testCompile 'org.json:json:20141113'
}
当我尝试运行我的junit测试类时。这就是我的目标
com.googlecode.objectify.SaveException: Error saving
com.top.ash.backend.entities.Ameggedon@589b3632: No API environment is registered for this thread.
com.googlecode.objectify.impl.EntityMetadata.save(EntityMetadata.java:95)
at com.googlecode.objectify.impl.WriteEngine.save(WriteEngine.java:75)
at com.googlecode.objectify.impl.SaverImpl.entities(SaverImpl.java:60)
at com.googlecode.objectify.impl.SaverImpl.entity(SaverImpl.java:35)
org.mockito.internal.runners.JUnit45AndHigherRunnerImpl.run(JUnit45AndHigherRunnerImpl.java:37)
at org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:62)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: java.lang.NullPointerException: No API environment is registered for this thread.