测试运行成功,但Log显示java.lang.NullPointerException

时间:2018-03-04 09:51:06

标签: android unit-testing mockito

我不确定它的IDE错误,或者我的测试方法中有什么问题? 任何帮助将不胜感激。

  

记录: -

if (show) {
    studentMarker = googleMap.addMarker(new MarkerOptions()
    .position(latLng)
    .title(item.getValue(TestUserStudent.class).getName() + "")
    .snippet(item.getValue(TestUserStudent.class).getSection() + "")
    .icon(BitmapDescriptorFactory.fromBitmap( getMarkerBitmapFromView(item.getValue(TestUserStudent.class) .getImg(), R.drawable.redMarker))));
}
  

块引用

 java.lang.NullPointerException
    at presenter.WeatherAppPresenter.getWeatherInfo(WeatherAppPresenter.java:36)
    at presenter.WeatherAppPresenterTest.getWeatherInfo(WeatherAppPresenterTest.java:67)
    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.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at util.RxSchedulersOverrideRule$3.evaluate(RxSchedulersOverrideRule.java:67)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    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.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.mockito.internal.runners.DefaultInternalRunner$1.run(DefaultInternalRunner.java:79)
    at org.mockito.internal.runners.DefaultInternalRunner.run(DefaultInternalRunner.java:85)
    at org.mockito.internal.runners.StrictRunner.run(StrictRunner.java:39)
    at org.mockito.junit.MockitoJUnitRunner.run(MockitoJUnitRunner.java:163)

0 个答案:

没有答案