I am having an issue running my Integration Test.
As part of my Test, I use exec-maven-plugin to pull down other projects from source control and then run them locally so my Test can use that to perform against.
My Maven dependencies for JUnit are:
<plugins> <plugin> <artifactId>maven-failsafe-plugin</artifactId> <version>3.0.0-M5</version> <configuration> <useModulePath>false</useModulePath> <useSystemClassLoader>false</useSystemClassLoader> <skipTests>false</skipTests> <includes> <include>**/*IntegrationTest.java</include> </includes> </configuration> <executions> <execution> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> </execution> </executions> </plugin> </plugins> ... <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <version>2.4.2</version> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> I have created a profile called integration-test so that I can choose when to enable integration testing and also added an argument to maven-surefire-plugin called skipUTs so I can skip Unit Tests.
The output of running: mvn clean verify -Pintegration-test -DskipUTs=true
org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-jupiter' failed to discover tests at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:111) at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:85) at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:92) at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:67) at org.apache.maven.surefire.junitplatform.TestPlanScannerFilter.accept(TestPlanScannerFilter.java:56) at org.apache.maven.surefire.api.util.DefaultScanResult.applyFilter(DefaultScanResult.java:102) at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.scanClasspath(JUnitPlatformProvider.java:147) at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:128) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:428) at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162) at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:562) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:548) Caused by: org.junit.platform.commons.JUnitException: ClassSelector [className = 'com.farmlandbee.app.integration.IntegrationTest'] resolution failed at org.junit.platform.launcher.listeners.discovery.AbortOnFailureLauncherDiscoveryListener.selectorProcessed(AbortOnFailureLauncherDiscoveryListener.java:39) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:102) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.run(EngineDiscoveryRequestResolution.java:82) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolver.resolve(EngineDiscoveryRequestResolver.java:113) at org.junit.jupiter.engine.discovery.DiscoverySelectorResolver.resolveSelectors(DiscoverySelectorResolver.java:45) at org.junit.jupiter.engine.JupiterTestEngine.discover(JupiterTestEngine.java:69) at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:103) ... 11 more Caused by: java.lang.ArrayStoreException at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724) at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531) at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355) at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286) at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120) at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72) at java.lang.Class.getAnnotationCache(Class.java:2535) at java.lang.Class.getDeclaredAnnotation(Class.java:2221) at org.junit.platform.commons.util.AnnotationUtils.findAnnotation(AnnotationUtils.java:128) at org.junit.platform.commons.util.AnnotationUtils.findAnnotation(AnnotationUtils.java:115) at org.junit.jupiter.engine.descriptor.DisplayNameUtils.determineDisplayName(DisplayNameUtils.java:68) at org.junit.jupiter.engine.descriptor.JupiterTestDescriptor.<init>(JupiterTestDescriptor.java:69) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.<init>(ClassBasedTestDescriptor.java:94) at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.<init>(ClassTestDescriptor.java:51) at org.junit.jupiter.engine.discovery.ClassSelectorResolver.newClassTestDescriptor(ClassSelectorResolver.java:119) at org.junit.jupiter.engine.discovery.ClassSelectorResolver.lambda$resolve$0(ClassSelectorResolver.java:71) at org.junit.jupiter.engine.discovery.ClassSelectorResolver$$Lambda$61/0000000000000000.apply(Unknown Source) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution$DefaultContext.createAndAdd(EngineDiscoveryRequestResolution.java:246) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution$DefaultContext.addToParent(EngineDiscoveryRequestResolution.java:209) at org.junit.jupiter.engine.discovery.ClassSelectorResolver.resolve(ClassSelectorResolver.java:71) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.lambda$resolve$2(EngineDiscoveryRequestResolution.java:134) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution$$Lambda$47/0000000000000000.apply(Unknown Source) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1359) at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126) at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:514) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:501) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:487) at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:241) at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:531) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:185) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:125) at org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:91) ... 16 more Test Class is roughly:
@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT) @Import({SSLRestTemplateConfig.class}) @ExtendWith(SpringExtension.class) @ActiveProfiles(profiles = {"integration"}) public class IntegrationTest { @LocalServerPort private int port; private final RestTemplate restTemplate; @Spy private final Service Service; private final IQueue<String> queue; @Captor ArgumentCaptor<String> captor; @Autowired public IntegrationTest(RestTemplate restTemplate, Service service, HazelcastInstance hazelcastInstance) { this.restTemplate = restTemplate; this.service = accountingQueueService; this.queue = hazelcastInstance.getQueue("queue"); } @BeforeEach public void setup() { queue.clear(); } @Test public void IntegrationTest() throws InterruptedException { ... } } Any help would be greatly appreciated.
@Testannotation?junit-vintagemvn failsafe:integration-test