Skip to content

Commit 02a113b

Browse files
authored
mapstruct#1308 Switch to JUnit Jupiter and do not use Toolchains for the integration tests (mapstruct#2013)
The CI should be setup to run on different Java versions, for which the integration tests are going to be run
1 parent 95ceba1 commit 02a113b

38 files changed

Lines changed: 773 additions & 1130 deletions

.travis.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: java
22
install: true
3-
script: mvn clean install -DprocessorIntegrationTest.toolchainsFile=etc/toolchains-travis-jenkins.xml -B -V
3+
script: mvn clean install -B -V
44

55
matrix:
66
include:
@@ -9,20 +9,14 @@ matrix:
99
- mvn jacoco:report && bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
1010
dist: trusty
1111
- jdk: openjdk11
12-
# Only run the processor and its dependencies
13-
# The integration tests are using the maven toolchain and that is not yet ready for Java 11
1412
# There is an issue with the documentation so skip it
15-
script: mvn -B -V clean install -pl processor -am
13+
script: mvn -B -V clean install -DskipDistribution=true
1614
- jdk: openjdk13
17-
# Only run the processor and its dependencies
18-
# The integration tests are using the maven toolchain and that is not yet ready for Java 11
1915
# There is an issue with the documentation so skip it
20-
script: mvn -B -V clean install -pl processor -am
21-
# Only run the processor and its dependencies
22-
# The integration tests are using the maven toolchain and that is not yet ready for Java EA
16+
script: mvn -B -V clean install -DskipDistribution=true
2317
# There is an issue with the documentation so skip it
2418
- jdk: openjdk-ea
25-
script: mvn -B -V clean install -pl processor -am
19+
script: mvn -B -V clean install -DskipDistribution=true
2620
allow_failures:
2721
- jdk: openjdk-ea
2822
deploy:

etc/toolchains-cloudbees-jenkins.xml

Lines changed: 0 additions & 14 deletions
This file was deleted.

etc/toolchains-example.xml

Lines changed: 0 additions & 25 deletions
This file was deleted.

etc/toolchains-travis-jenkins.xml

Lines changed: 0 additions & 16 deletions
This file was deleted.

integrationtest/pom.xml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@
4040

4141
<dependencies>
4242
<!-- Testing -->
43-
<dependency>
44-
<groupId>junit</groupId>
45-
<artifactId>junit</artifactId>
46-
<scope>test</scope>
47-
</dependency>
4843
<dependency>
4944
<groupId>org.assertj</groupId>
5045
<artifactId>assertj-core</artifactId>
@@ -73,6 +68,17 @@
7368
<version>2.6</version>
7469
<scope>test</scope>
7570
</dependency>
71+
<dependency>
72+
<groupId>org.junit.jupiter</groupId>
73+
<artifactId>junit-jupiter</artifactId>
74+
<scope>test</scope>
75+
</dependency>
76+
<dependency>
77+
<groupId>org.junit.jupiter</groupId>
78+
<artifactId>junit-jupiter-engine</artifactId>
79+
<scope>test</scope>
80+
</dependency>
81+
7682
</dependencies>
7783

7884
<build>

integrationtest/src/test/java/org/mapstruct/itest/tests/AutoValueBuilderTest.java

Lines changed: 0 additions & 19 deletions
This file was deleted.

integrationtest/src/test/java/org/mapstruct/itest/tests/CdiTest.java

Lines changed: 0 additions & 20 deletions
This file was deleted.

integrationtest/src/test/java/org/mapstruct/itest/tests/ExternalBeanJarTest.java

Lines changed: 0 additions & 22 deletions
This file was deleted.

integrationtest/src/test/java/org/mapstruct/itest/tests/FreeBuilderBuilderTest.java

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright MapStruct Authors.
3+
*
4+
* Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
5+
*/
6+
package org.mapstruct.itest.tests;
7+
8+
import java.util.ArrayList;
9+
import java.util.Collection;
10+
import java.util.List;
11+
12+
import org.junit.jupiter.api.condition.JRE;
13+
import org.mapstruct.itest.testutil.extension.ProcessorTest;
14+
15+
/**
16+
* Adds explicit exclusions of test mappers that are known or expected to not work with specific compilers.
17+
*
18+
* @author Andreas Gudian
19+
*/
20+
public final class FullFeatureCompilationExclusionCliEnhancer implements ProcessorTest.CommandLineEnhancer {
21+
@Override
22+
public Collection<String> getAdditionalCommandLineArguments(ProcessorTest.ProcessorType processorType,
23+
JRE currentJreVersion) {
24+
List<String> additionalExcludes = new ArrayList<>();
25+
26+
// SPI not working correctly here.. (not picked up)
27+
additionalExcludes.add( "org/mapstruct/ap/test/bugs/_1596/*.java" );
28+
additionalExcludes.add( "org/mapstruct/ap/test/bugs/_1801/*.java" );
29+
30+
switch ( currentJreVersion ) {
31+
case JAVA_9:
32+
// TODO find out why this fails:
33+
additionalExcludes.add( "org/mapstruct/ap/test/collection/wildcard/BeanMapper.java" );
34+
break;
35+
default:
36+
}
37+
38+
Collection<String> result = new ArrayList<String>( additionalExcludes.size() );
39+
for ( int i = 0; i < additionalExcludes.size(); i++ ) {
40+
result.add( "-DadditionalExclude" + i + "=" + additionalExcludes.get( i ) );
41+
}
42+
43+
return result;
44+
}
45+
}

0 commit comments

Comments
 (0)