New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BeforeAll throws AbstractMethodError when working with Junit Jupiter M5 #440

Closed
glaed opened this Issue Aug 8, 2017 · 4 comments

Comments

3 participants
@glaed

glaed commented Aug 8, 2017

  • Version of JMockit: 1.33

  • Description:

I am using IntelliJ 2017.2.1 which requires me to work with JUnit 5 Milestone 5.
When I try to run any test, I get the following error:

java.lang.AbstractMethodError: mockit.integration.junit5.JMockitExtension.beforeAll(Lorg/junit/jupiter/api/extension/ExtensionContext;)V

This looks like a compatibilty problem of jMockit with Juptiter M5 to me.
Although I have to add that I get a different error when running the tests on the console via Maven:

WARNING: TestEngine with ID 'junit-jupiter' failed to discover tests
java.lang.AbstractMethodError: org.junit.platform.launcher.core.DefaultDiscoveryRequest.getDiscoveryFiltersByType(Ljava/lang/Class;)Ljava/util/List;  
at org.junit.platform.engine.support.filter.ClasspathScanningSupport.buildClassNamePredicate(ClasspathScanningSupport.java:42)

I apologize if this counts as non-reproducible or is not actually related to jmockit.

Here are the relevant parts of my pom.xml:


                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.19.1</version>
                    <configuration>
                        <testSourceDirectory>src/test</testSourceDirectory>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.junit.platform</groupId>
                            <artifactId>junit-platform-surefire-provider</artifactId>
                            <version>1.0.0-RC2</version>
                        </dependency>
                        <dependency>
                            <groupId>org.junit.jupiter</groupId>
                            <artifactId>junit-jupiter-engine</artifactId>
                            <version>5.0.0-M5</version>
                        </dependency>
                        <dependency>
                            <groupId>org.junit.vintage</groupId>
                            <artifactId>junit-vintage-engine</artifactId>
                            <version>4.12.0-M5</version>
                        </dependency>
                    </dependencies>
                </plugin>
         <!--JUNIT5 & JUPITER-->

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.0.0-M5</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>5.0.0-M5</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <version>4.12.0-M5</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>

This is the full stacktrace of the error:

java.lang.AbstractMethodError: mockit.integration.junit5.JMockitExtension.beforeAll(Lorg/junit/jupiter/api/extension/ExtensionContext;)V

	at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$invokeBeforeAllCallbacks$4(ClassTestDescriptor.java:216)
	at org.junit.jupiter.engine.execution.ThrowableCollector.execute(ThrowableCollector.java:40)
	at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.invokeBeforeAllCallbacks(ClassTestDescriptor.java:216)
	at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.before(ClassTestDescriptor.java:151)
	at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.before(ClassTestDescriptor.java:62)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.lambda$execute$3(HierarchicalTestExecutor.java:80)
	at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:77)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.lambda$null$2(HierarchicalTestExecutor.java:92)
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
	at java.util.Iterator.forEachRemaining(Iterator.java:116)
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.lambda$execute$3(HierarchicalTestExecutor.java:92)
	at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:77)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:51)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:43)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:170)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:154)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:62)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
	Suppressed: java.lang.AbstractMethodError: mockit.integration.junit5.JMockitExtension.afterAll(Lorg/junit/jupiter/api/extension/ExtensionContext;)V
		at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$null$8(ClassTestDescriptor.java:254)
		at org.junit.jupiter.engine.execution.ThrowableCollector.execute(ThrowableCollector.java:40)
		at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$invokeAfterAllCallbacks$9(ClassTestDescriptor.java:254)
		at java.util.ArrayList.forEach(ArrayList.java:1249)
		at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.invokeAfterAllCallbacks(ClassTestDescriptor.java:254)
		at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.after(ClassTestDescriptor.java:167)
		at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.after(ClassTestDescriptor.java:62)
		at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.lambda$execute$3(HierarchicalTestExecutor.java:96)
		... 25 more

@rliesenfeld rliesenfeld self-assigned this Aug 8, 2017

@rliesenfeld

This comment has been minimized.

Show comment
Hide comment
@rliesenfeld

rliesenfeld Aug 8, 2017

Member

No problem, as in M4, M5 introduced new breaking API changes, which JMockit needs to adjust to.

Member

rliesenfeld commented Aug 8, 2017

No problem, as in M4, M5 introduced new breaking API changes, which JMockit needs to adjust to.

@matthieusb

This comment has been minimized.

Show comment
Hide comment
@matthieusb

matthieusb Sep 14, 2017

Just as an additional information, I encounter the same error with JMockit 1.34.

matthieusb commented Sep 14, 2017

Just as an additional information, I encounter the same error with JMockit 1.34.

@glaed

This comment has been minimized.

Show comment
Hide comment
@glaed

glaed Sep 14, 2017

@matthieusb That's strange. For me, the update fixed the issue and worked well with JUnit 5 Milestone 5 as well as the version 5.0.0.

That's probably not the reason but have you checked which JUnit version is bundled with IntelliJ?
http://junit.org/junit5/docs/current/user-guide/#running-tests-ide-intellij-idea

glaed commented Sep 14, 2017

@matthieusb That's strange. For me, the update fixed the issue and worked well with JUnit 5 Milestone 5 as well as the version 5.0.0.

That's probably not the reason but have you checked which JUnit version is bundled with IntelliJ?
http://junit.org/junit5/docs/current/user-guide/#running-tests-ide-intellij-idea

@matthieusb

This comment has been minimized.

Show comment
Hide comment
@matthieusb

matthieusb Sep 15, 2017

I am using Eclipse. So that's probably a configuration/plugin problem on my side. I have rollbacked my modifications since junit5 is not vital to my current project. But this info will be useful if I try again. Thanks !

matthieusb commented Sep 15, 2017

I am using Eclipse. So that's probably a configuration/plugin problem on my side. I have rollbacked my modifications since junit5 is not vital to my current project. But this info will be useful if I try again. Thanks !

@jmockit jmockit locked and limited conversation to collaborators Sep 17, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.