testmycode / tmc-intellij

*BETA* TestMyCode plugin for IntelliJ IDEA
MIT License
24 stars 13 forks source link

ObjenesisException: java.lang.reflect.InvocationTargetException #124

Open DirkDeVisser opened 7 years ago

DirkDeVisser commented 7 years ago

Got this error on tests 38 -42 from week 2 of the java part 1 course. When I send the code to the server all tests have passed.

Error body:

java.lang.reflect.InvocationTargetException
org.objenesis.instantiator.sun.SunReflectionFactoryHelper.newConstructorForSerialization(SunReflectionFactoryHelper.java:55)
org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.<init>(SunReflectionFactoryInstantiator.java:38)
org.objenesis.strategy.StdInstantiatorStrategy.newInstantiatorOf(StdInstantiatorStrategy.java:58)
org.objenesis.ObjenesisBase.getInstantiatorOf(ObjenesisBase.java:91)
org.powermock.reflect.internal.WhiteboxImpl.newInstance(WhiteboxImpl.java:228)
org.powermock.reflect.Whitebox.newInstance(Whitebox.java:139)
org.powermock.modules.junit4.rule.PowerMockClassloaderExecutor.registerProxyframework(PowerMockClassloaderExecutor.java:72)
org.powermock.modules.junit4.rule.PowerMockClassloaderExecutor.forClass(PowerMockClassloaderExecutor.java:50)
org.powermock.modules.junit4.rule.PowerMockRule.apply(PowerMockRule.java:31)
org.junit.runners.BlockJUnit4ClassRunner.withMethodRules(BlockJUnit4ClassRunner.java:349)
org.junit.runners.BlockJUnit4ClassRunner.withRules(BlockJUnit4ClassRunner.java:339)
org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:256)
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
org.junit.runners.ParentRunner.run(ParentRunner.java:309)
fi.helsinki.cs.tmc.testrunner.TestRunner$TestingRunnable.runTestCase(TestRunner.java:134)
fi.helsinki.cs.tmc.testrunner.TestRunner$TestingRunnable.doRun(TestRunner.java:89)
fi.helsinki.cs.tmc.testrunner.TestRunner$TestingRunnable.run(TestRunner.java:70)
java.lang.Thread.run(Unknown Source)

IntelliJ IDEA Ultimate 2017.2 Public preview

martin-hawk commented 6 years ago

Hi. Maybe it will help to anyone else. Locally the test will not pass because of this error, but it successfully uploads to the TMC server and passes all checks :) Don't panic, you're in the right path and the Power is within you! ;)

Redande commented 6 years ago

Are you by chance using Java 9?

martin-hawk commented 6 years ago

No, I'm using Java 8.

rlmhermans commented 5 years ago

This also happens to me and a lot of my students. I figured it was de JDK version we are using (12), but the error does not happen for everyone. I have not been able to figure out why it happens, but my guess it it has something to do with the PowerMock version.