执行Bach()操作报空指针异常
@Test public void Batch(){ Displacementinfor displacementinfor = new Displacementinfor(); displacementinfor.setEquipname("趋势GNSS高精定位仪"); displacementinfor.setLongitude(102.123456f); Displacementinfor displacementinfor1 = new Displacementinfor(); displacementinfor.setEquipname("大趋势"); displacementinfor.setLongitude(34.123456f); List<Displacementinfor> displacementinfors = Arrays.asList(displacementinfor, displacementinfor1); boolean saveBatch = displacementinforService.saveBatch(displacementinfors); System.out.println(displacementinforService); }
java.lang.NullPointerException
at com.laoyi.pandmonitor05.DisplacementinforInsertTest.Batch(DisplacementinforInsertTest.java:46)
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:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)