|
Description:
|
The test {{LoadSelectedColumnsCollectionTest}} fails randomly on JDK 7 with the following exception:
{quote} java.lang.NullPointerException at org.hibernate.ogm.test.mongodb.loading.LoadSelectedColumnsCollectionTest.getService(LoadSelectedColumnsCollectionTest.java:154) at org.hibernate.ogm.test.mongodb.loading.LoadSelectedColumnsCollectionTest.testLoadSelectedColumns(LoadSelectedColumnsCollectionTest.java:71) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at junit.framework.TestCase.runTest(TestCase.java:168) at org.hibernate.ogm.test.simpleentity.OgmTestCase.runTest(OgmTestCase.java:197) at org.hibernate.ogm.test.simpleentity.OgmTestCase.runBare(OgmTestCase.java:243) {quote}
The issue occurs when the second test method in the file is executed before the first one. This can happen as of Java 7 since the order of methods retrieved via reflection is not deterministic any more. In this case the session factory will have been nulled by the {{tearDown()}} call after the
from the
second test method, causing the NPE when running the first test method afterwards.
|