@@ -16,8 +16,9 @@ public class DetectScalaLibraryTest extends ScoverageFunctionalTest {
16
16
private static final String SCALA_VERSION = "2.12" ;
17
17
private static final String SCALA_LIBRARY_PARAMETER = "-PdetectedScalaLibraryVersion=" ;
18
18
19
- private static final String EXPECTED_OUTPUT_A = "Detected scala library in compilation classpath" ;
20
- private static final String EXPECTED_OUTPUT_B = "Using scoverage scalac plugin version '" + SCALA_VERSION ;
19
+ private static final String EXPECTED_OUTPUT_CONFIGURED_VERSION = "Using configured Scala version" ;
20
+ private static final String EXPECTED_OUTPUT_DETECTED_VERSION = "Detected scala library in compilation classpath" ;
21
+ private static final String EXPECTED_OUTPUT_USING = "Using scoverage scalac plugin version '" + SCALA_VERSION ;
21
22
22
23
@ Parameterized .Parameter (0 )
23
24
public String projectDir ;
@@ -26,16 +27,19 @@ public class DetectScalaLibraryTest extends ScoverageFunctionalTest {
26
27
public String [] subVersions ;
27
28
28
29
@ Parameterized .Parameter (2 )
30
+ public boolean detect ;
31
+
32
+ @ Parameterized .Parameter (3 )
29
33
public String [] additionalParameters ;
30
34
31
35
@ Parameterized .Parameters (name = "{index}: Project {0} " )
32
36
public static Collection <Object []> data () {
33
37
Object [][] data = new Object [][]{
34
- {"/compile" , new String [] {".0" , ".+" }, new String [0 ]},
35
- {"/compileOnly" , new String [] {".0" , ".+" }, new String [0 ]},
36
- {"/implementation" , new String [] {".0" , ".+" }, new String [0 ]},
37
- {"/dependency-management" , new String [] {".0" , ".+" }, new String [0 ]},
38
- {"/gradle-consistent-versions" , new String [] {"ignored" }, new String [] {"--write-locks" }},
38
+ {"/compile" , new String [] {".0" , ".+" }, true , new String [0 ]},
39
+ {"/compileOnly" , new String [] {".0" , ".+" }, true , new String [0 ]},
40
+ {"/implementation" , new String [] {".0" , ".+" }, true , new String [0 ]},
41
+ {"/dependency-management" , new String [] {".0" , ".+" }, true , new String [0 ]},
42
+ {"/gradle-consistent-versions" , new String [] {"ignored" }, false , new String [] {"--write-locks" }},
39
43
};
40
44
return Arrays .asList (data );
41
45
}
@@ -48,20 +52,24 @@ public DetectScalaLibraryTest() {
48
52
public void test () {
49
53
setProjectName ("detect-scala-library" + projectDir );
50
54
for (String subVersion : subVersions ) {
51
- testWithParameter (SCALA_LIBRARY_PARAMETER + SCALA_VERSION + subVersion );
55
+ testWithParameter (SCALA_LIBRARY_PARAMETER + SCALA_VERSION + subVersion , detect );
52
56
}
53
57
}
54
58
55
- private void testWithParameter (String parameter ) {
59
+ private void testWithParameter (String parameter , Boolean detect ) {
56
60
57
61
String [] basicParameters = {"clean" , parameter , "--info" };
58
62
String [] parameters = Stream .concat (Arrays .stream (basicParameters ), Arrays .stream (additionalParameters ))
59
63
.toArray (String []::new );
60
64
AssertableBuildResult result = dryRun (parameters );
61
65
62
66
String output = result .getResult ().getOutput ();
63
- Assert .assertTrue (output .contains (EXPECTED_OUTPUT_A ));
64
- Assert .assertTrue (output .contains (EXPECTED_OUTPUT_B ));
67
+ if (detect ) {
68
+ Assert .assertTrue (output .contains (EXPECTED_OUTPUT_DETECTED_VERSION ));
69
+ } else {
70
+ Assert .assertTrue (output .contains (EXPECTED_OUTPUT_CONFIGURED_VERSION ));
71
+ }
72
+ Assert .assertTrue (output .contains (EXPECTED_OUTPUT_USING ));
65
73
}
66
74
67
75
}
0 commit comments