File tree 12 files changed +86
-33
lines changed
src/org/jacoco/core/test/validation
src-java8/org/jacoco/core/test/validation
12 files changed +86
-33
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ install:
11
11
12
12
build_script :
13
13
# Maven 3.3.9 requires Java >= 7, but generation of Javadocs requires Java <= 6 (https://github.com/jacoco/jacoco/issues/110)
14
- - mvn -V -B -e verify -Pno-java8-validation - Djdk.version=1.6 --toolchains=.travis\appveyor-toolchains.xml
14
+ - mvn -V -B -e verify -Djdk.version=1.6 --toolchains=.travis\appveyor-toolchains.xml
15
15
16
16
artifacts :
17
17
- path : jacoco\target\*.zip
Original file line number Diff line number Diff line change 10
10
<attribute name =" maven.pomderived" value =" true" />
11
11
</attributes >
12
12
</classpathentry >
13
- <classpathentry excluding = " org/jacoco/core/test/validation/java8/*.java " including = " **/*.java " kind =" src" output =" target/classes" path =" src" >
13
+ <classpathentry kind =" src" output =" target/classes" path =" src" >
14
14
<attributes >
15
15
<attribute name =" optional" value =" true" />
16
16
<attribute name =" maven.pomderived" value =" true" />
Original file line number Diff line number Diff line change 40
40
41
41
<profiles >
42
42
<profile >
43
- <id >no- java8-validation</id >
43
+ <id >java8-validation</id >
44
44
<activation >
45
- <jdk >(,1.8)</jdk >
45
+ <property >
46
+ <name >bytecode.version</name >
47
+ <value >1.8</value >
48
+ </property >
46
49
</activation >
47
50
<build >
48
51
<plugins >
49
52
<plugin >
50
- <groupId >org.apache.maven.plugins</groupId >
51
- <artifactId >maven-compiler-plugin</artifactId >
52
- <configuration >
53
- <excludes >
54
- <exclude >org/jacoco/core/test/validation/java8/*.java</exclude >
55
- </excludes >
56
- </configuration >
53
+ <groupId >org.codehaus.mojo</groupId >
54
+ <artifactId >build-helper-maven-plugin</artifactId >
55
+ <executions >
56
+ <execution >
57
+ <id >add-source</id >
58
+ <phase >generate-sources</phase >
59
+ <goals >
60
+ <goal >add-source</goal >
61
+ </goals >
62
+ <configuration >
63
+ <sources >
64
+ <source >src-java8</source >
65
+ </sources >
66
+ </configuration >
67
+ </execution >
68
+ </executions >
69
+ </plugin >
70
+ </plugins >
71
+ </build >
72
+ </profile >
73
+ <profile >
74
+ <id >java9-validation</id >
75
+ <activation >
76
+ <property >
77
+ <name >bytecode.version</name >
78
+ <value >1.9</value >
79
+ </property >
80
+ </activation >
81
+ <build >
82
+ <plugins >
83
+ <plugin >
84
+ <groupId >org.codehaus.mojo</groupId >
85
+ <artifactId >build-helper-maven-plugin</artifactId >
86
+ <executions >
87
+ <execution >
88
+ <id >add-source</id >
89
+ <phase >generate-sources</phase >
90
+ <goals >
91
+ <goal >add-source</goal >
92
+ </goals >
93
+ <configuration >
94
+ <sources >
95
+ <source >src-java8</source >
96
+ </sources >
97
+ </configuration >
98
+ </execution >
99
+ </executions >
57
100
</plugin >
58
101
</plugins >
59
102
</build >
60
103
</profile >
61
104
</profiles >
62
-
105
+
63
106
</project >
Original file line number Diff line number Diff line change 9
9
* Marc R. Hoffmann - initial API and implementation
10
10
*
11
11
*******************************************************************************/
12
- package org .jacoco .core .test .validation . java8 ;
12
+ package org .jacoco .core .test .validation ;
13
13
14
14
import org .jacoco .core .analysis .ICounter ;
15
- import org .jacoco .core .test .validation .ValidationTestBase ;
15
+ import org .jacoco .core .test .validation .targets . InterfaceDefaultMethodsTarget ;
16
16
import org .junit .Test ;
17
17
18
18
/**
21
21
public class InterfaceDefaultMethodsTest extends ValidationTestBase {
22
22
23
23
public InterfaceDefaultMethodsTest () {
24
- super (InterfaceDefaultMethodsTarget .class );
24
+ super ("src-java8" , InterfaceDefaultMethodsTarget .class );
25
25
}
26
26
27
27
@ Override
Original file line number Diff line number Diff line change 9
9
* Marc R. Hoffmann - initial API and implementation
10
10
*
11
11
*******************************************************************************/
12
- package org .jacoco .core .test .validation . java8 ;
12
+ package org .jacoco .core .test .validation ;
13
13
14
14
import org .jacoco .core .analysis .ICounter ;
15
- import org .jacoco .core .test .validation .ValidationTestBase ;
15
+ import org .jacoco .core .test .validation .targets . LambdaExpressionsTarget ;
16
16
import org .junit .Test ;
17
17
18
18
/**
21
21
public class LambdaExpressionsTest extends ValidationTestBase {
22
22
23
23
public LambdaExpressionsTest () {
24
- super (LambdaExpressionsTarget .class );
24
+ super ("src-java8" , LambdaExpressionsTarget .class );
25
25
}
26
26
27
27
@ Override
Original file line number Diff line number Diff line change 9
9
* Marc R. Hoffmann - initial API and implementation
10
10
*
11
11
*******************************************************************************/
12
- package org .jacoco .core .test .validation . java8 ;
12
+ package org .jacoco .core .test .validation ;
13
13
14
14
import org .jacoco .core .analysis .ICounter ;
15
- import org .jacoco .core .test .validation .ValidationTestBase ;
15
+ import org .jacoco .core .test .validation .targets . LambdaInInterfaceTarget ;
16
16
import org .junit .Test ;
17
17
18
18
/**
21
21
public class LambdaInInterfaceTest extends ValidationTestBase {
22
22
23
23
public LambdaInInterfaceTest () {
24
- super (LambdaInInterfaceTarget .class );
24
+ super ("src-java8" , LambdaInInterfaceTarget .class );
25
25
}
26
26
27
27
@ Override
Original file line number Diff line number Diff line change 9
9
* Marc R. Hoffmann - initial API and implementation
10
10
*
11
11
*******************************************************************************/
12
- package org .jacoco .core .test .validation .java8 ;
12
+ package org .jacoco .core .test .validation .targets ;
13
13
14
14
import static org .jacoco .core .test .validation .targets .Stubs .i1 ;
15
15
Original file line number Diff line number Diff line change 9
9
* Marc R. Hoffmann - initial API and implementation
10
10
*
11
11
*******************************************************************************/
12
- package org .jacoco .core .test .validation .java8 ;
12
+ package org .jacoco .core .test .validation .targets ;
13
13
14
14
import static org .jacoco .core .test .validation .targets .Stubs .exec ;
15
15
import static org .jacoco .core .test .validation .targets .Stubs .noexec ;
Original file line number Diff line number Diff line change 9
9
* Marc R. Hoffmann - initial API and implementation
10
10
*
11
11
*******************************************************************************/
12
- package org .jacoco .core .test .validation .java8 ;
12
+ package org .jacoco .core .test .validation .targets ;
13
13
14
14
import static org .jacoco .core .test .validation .targets .Stubs .nop ;
15
15
Original file line number Diff line number Diff line change 12
12
package org .jacoco .core .test .validation ;
13
13
14
14
import java .io .BufferedReader ;
15
+ import java .io .File ;
15
16
import java .io .FileReader ;
16
17
import java .io .IOException ;
17
18
import java .io .Reader ;
31
32
public class Source {
32
33
33
34
/**
34
- * Reads the source for the given type from the <code>./src/</code> folder
35
- * relative to the working directory.
35
+ * Reads the source for the given type from the given source folder relative
36
+ * to the working directory.
36
37
*
38
+ * @param srcFolder
39
+ * source folder
37
40
* @param type
38
41
* type to load the source file for
39
- * @throws IOException
40
- * @throws
41
42
*/
42
- public static Source getSourceFor (final Class <?> type ) throws IOException {
43
- String file = "src/" + type .getName ().replace ('.' , '/' ) + ".java" ;
43
+ public static Source getSourceFor (final String srcFolder ,
44
+ final Class <?> type ) throws IOException {
45
+ File folder = new File (srcFolder );
46
+ File file = new File (folder , type .getName ().replace ('.' , '/' ) + ".java" );
44
47
return new Source (new FileReader (file ));
45
48
}
46
49
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ public void testDuplicateTag() throws IOException {
78
78
79
79
@ Test
80
80
public void testGetSourceFor () throws IOException {
81
- final Source s = Source .getSourceFor (SourceTest .class );
81
+ final Source s = Source .getSourceFor ("src" , SourceTest .class );
82
82
// Here we are. $line-testGetSourceFor$
83
83
final String l = s .getLine (s .getLineNumber ("testGetSourceFor" ));
84
84
assertTrue (l , l .contains ("Here we are." ));
Original file line number Diff line number Diff line change @@ -47,6 +47,8 @@ public abstract class ValidationTestBase {
47
47
STATUS_NAME [ICounter .PARTLY_COVERED ] = "PARTLY_COVERED" ;
48
48
}
49
49
50
+ protected final String srcFolder ;
51
+
50
52
protected final Class <?> target ;
51
53
52
54
protected IClassCoverage classCoverage ;
@@ -57,18 +59,23 @@ public abstract class ValidationTestBase {
57
59
58
60
protected TargetLoader loader ;
59
61
60
- protected ValidationTestBase (final Class <?> target ) {
62
+ protected ValidationTestBase (final String srcFolder , final Class <?> target ) {
63
+ this .srcFolder = srcFolder ;
61
64
this .target = target ;
62
65
}
63
66
67
+ protected ValidationTestBase (final Class <?> target ) {
68
+ this ("src" , target );
69
+ }
70
+
64
71
@ Before
65
72
public void setup () throws Exception {
66
73
loader = new TargetLoader ();
67
74
final ClassReader reader = new ClassReader (
68
75
TargetLoader .getClassData (target ));
69
76
final ExecutionDataStore store = execute (reader );
70
77
analyze (reader , store );
71
- source = Source .getSourceFor (target );
78
+ source = Source .getSourceFor (srcFolder , target );
72
79
}
73
80
74
81
private ExecutionDataStore execute (final ClassReader reader )
You can’t perform that action at this time.
0 commit comments