@@ -17,7 +17,8 @@ public void testPluginCanBeApplied() {
17
17
.build ();
18
18
19
19
assertEquals (TaskOutcome .SUCCESS , result .task (":hello" ).getOutcome ());
20
- assertTrue (result .getOutput ().contains ("build plugin can be applied" ));
20
+ String output = result .getOutput ();
21
+ assertTrue (output , output .contains ("build plugin can be applied" ));
21
22
}
22
23
23
24
public void testNameCheckFailsAsItShould () {
@@ -29,6 +30,7 @@ public void testNameCheckFailsAsItShould() {
29
30
30
31
assertNotNull ("task did not run" , result .task (":namingConventions" ));
31
32
assertEquals (TaskOutcome .FAILED , result .task (":namingConventions" ).getOutcome ());
33
+ String output = result .getOutput ();
32
34
for (String line : Arrays .asList (
33
35
"Found inner classes that are tests, which are excluded from the test runner:" ,
34
36
"* org.elasticsearch.test.NamingConventionsCheckInMainIT$InternalInvalidTests" ,
@@ -38,8 +40,8 @@ public void testNameCheckFailsAsItShould() {
38
40
"Not all subclasses of UnitTestCase match the naming convention. Concrete classes must end with [Tests]:" ,
39
41
"* org.elasticsearch.test.WrongName" )) {
40
42
assertTrue (
41
- "expected: '" + line + "' but it was not found in the output" ,
42
- result . getOutput () .contains (line )
43
+ "expected: '" + line + "' but it was not found in the output: \n " + output ,
44
+ output .contains (line )
43
45
);
44
46
}
45
47
}
@@ -54,6 +56,7 @@ public void testNameCheckFailsAsItShouldWithMain() {
54
56
assertNotNull ("task did not run" , result .task (":namingConventions" ));
55
57
assertEquals (TaskOutcome .FAILED , result .task (":namingConventions" ).getOutcome ());
56
58
59
+ String output = result .getOutput ();
57
60
for (String line : Arrays .asList (
58
61
"Classes ending with [Tests] or [IT] or extending [UnitTestCase] must be in src/test/java:" ,
59
62
"* org.elasticsearch.test.NamingConventionsCheckBadClasses$DummyInterfaceTests" ,
@@ -63,8 +66,8 @@ public void testNameCheckFailsAsItShouldWithMain() {
63
66
"* org.elasticsearch.test.NamingConventionsCheckBadClasses$WrongNameTheSecond" ,
64
67
"* org.elasticsearch.test.NamingConventionsCheckBadClasses$WrongName" )) {
65
68
assertTrue (
66
- "expected: '" + line + "' but it was not found in the output" ,
67
- result . getOutput () .contains (line )
69
+ "expected: '" + line + "' but it was not found in the output: \n " + output ,
70
+ output .contains (line )
68
71
);
69
72
}
70
73
}
0 commit comments