geniusmart / LoveUT

samples for Robolectric 3.1.4
http://www.jianshu.com/p/9d988a2f8ff7
175 stars 42 forks source link

运行ormlite测试用例出错 #3

Open androidhuoniao opened 7 years ago

androidhuoniao commented 7 years ago

java.lang.NullPointerException at com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper.openFileId(OrmLiteSqliteOpenHelper.java:310) at com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper.(OrmLiteSqliteOpenHelper.java:76) at com.geniusmart.loveut.ormlite.DatabaseHelper.(DatabaseHelper.java:28) at com.geniusmart.loveut.ormlite.DatabaseHelper.getHelper(DatabaseHelper.java:69) at com.geniusmart.loveut.ormlite.OrmLiteTest.setUp(OrmLiteTest.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.robolectric.internal.SandboxTestRunner$2.evaluate(SandboxTestRunner.java:209) at org.robolectric.internal.SandboxTestRunner.runChild(SandboxTestRunner.java:109) at org.robolectric.internal.SandboxTestRunner.runChild(SandboxTestRunner.java:36) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.robolectric.internal.SandboxTestRunner$1.evaluate(SandboxTestRunner.java:63) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

创建数据库的时候,如果使用RuntimeEnvironment.application作为Context的就没有错了