Closed PrzemekCh closed 9 years ago
Is this class "oracle.wsm.policy.model.impl.SimpleAssertion" available from some artifact in the Maven Central repository? If not (and apparently it isn't), I won't be able to examine the problem.
I've send You the jar over email.
And in previous versions it will not throw an error but the instance created is always null.
Thanks, reproduced it now. As a workaround, consider not calling "getMockInstance()". When mocking-up a class, this method is not meant to be used in the vast majority of cases, as it creates an uninitialized instance for a partially mocked class; so, if you use it there is a good chance of later getting a NPE or some other exception due to executing unmocked methods on an uninitialized instance.
While trying to generate a mockup for oracle.wsm.policy.model.impl.SimpleAssertion
SimpleAssertion simpleAsserter = new MockUp() {
}.getMockInstance();
if fails with jmockup since version 1.10+. In previous versions it works.
java.lang.NullPointerException at java.util.HashMap.(HashMap.java:223)
at oracle.wsm.policy.model.impl.SimpleAssertion.hashCode(SimpleAssertion.java:777)
at java.util.HashMap.getEntry(HashMap.java:344)
at java.util.HashMap.containsKey(HashMap.java:335)
at java.util.HashSet.contains(HashSet.java:184)
at java.util.AbstractCollection.retainAll(AbstractCollection.java:369)
at mockit.internal.state.MockClasses$SavePoint.rollback(MockClasses.java:165)
at mockit.internal.state.SavePoint.rollback(SavePoint.java:42)
at mockit.integration.internal.TestRunnerDecorator.discardTestLevelMockedTypes(TestRunnerDecorator.java:123)
at mockit.integration.internal.TestRunnerDecorator.cleanUpMocks(TestRunnerDecorator.java:85)
at mockit.integration.internal.TestRunnerDecorator.cleanUpMocksFromPreviousTestClass(TestRunnerDecorator.java:80)
at mockit.integration.junit4.internal.RunNotifierDecorator.fireTestRunFinished(RunNotifierDecorator.java:28)
at org.junit.runner.notification.RunNotifier.fireTestRunFinished(RunNotifier.java)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:51)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)