What causes a junit warning org.junit.platform.launcher.core.EngineDiscoveryOrchestrator lambda$logTestDescriptorExclusionReasons$7

Viewed 6463

I have a gradle-based java testing framework.

After updating junit to 5.7.2 this warning started appearing for every test:

Jul 21, 2021 10:23:45 AM org.junit.platform.launcher.core.EngineDiscoveryOrchestrator lambda$logTestDescriptorExclusionReasons$7
INFO: 0 containers and 3 tests were Method or class mismatch

The junit dependencies in use are: junit-jupiter-api, junit-jupiter-engine, junit-jupiter-params.

What may be causing it and what are the potential solutions?

3 Answers

When you have multiple test methods in 1 class and execute only one of them, that warning appears. if you run all the test methods in that class, it doesn't appear. Judging from the warning message, you have made 4 @Test methods in a class and executed only one of it. The warning message is complaining that 3 other test methods were excluded from execution. If you execute all 4 test methods (Done by running the whole class), that message would disappear. In other words, it is a pointless warning and you can just ignore it.

If your are using Intellij, this might help you.

Preferences > Build, Execution, Deployment > Build Tools > Gradle Set "Build and run using:" and "Run tests using" to "Intellij IDEA"

I think the potential solution is adding static import:

import static org.mockito.Mockito.when;

It resolves the problem in my code.

Related