Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print output when the name checker IT fails #31660

Merged
merged 1 commit into from
Jun 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public void testPluginCanBeApplied() {
.build();

assertEquals(TaskOutcome.SUCCESS, result.task(":hello").getOutcome());
assertTrue(result.getOutput().contains("build plugin can be applied"));
String output = result.getOutput();
assertTrue(output, output.contains("build plugin can be applied"));
}

public void testNameCheckFailsAsItShould() {
Expand All @@ -29,6 +30,7 @@ public void testNameCheckFailsAsItShould() {

assertNotNull("task did not run", result.task(":namingConventions"));
assertEquals(TaskOutcome.FAILED, result.task(":namingConventions").getOutcome());
String output = result.getOutput();
for (String line : Arrays.asList(
"Found inner classes that are tests, which are excluded from the test runner:",
"* org.elasticsearch.test.NamingConventionsCheckInMainIT$InternalInvalidTests",
Expand All @@ -38,8 +40,8 @@ public void testNameCheckFailsAsItShould() {
"Not all subclasses of UnitTestCase match the naming convention. Concrete classes must end with [Tests]:",
"* org.elasticsearch.test.WrongName")) {
assertTrue(
"expected: '" + line + "' but it was not found in the output",
result.getOutput().contains(line)
"expected: '" + line + "' but it was not found in the output:\n" + output,
output.contains(line)
);
}
}
Expand All @@ -54,6 +56,7 @@ public void testNameCheckFailsAsItShouldWithMain() {
assertNotNull("task did not run", result.task(":namingConventions"));
assertEquals(TaskOutcome.FAILED, result.task(":namingConventions").getOutcome());

String output = result.getOutput();
for (String line : Arrays.asList(
"Classes ending with [Tests] or [IT] or extending [UnitTestCase] must be in src/test/java:",
"* org.elasticsearch.test.NamingConventionsCheckBadClasses$DummyInterfaceTests",
Expand All @@ -63,8 +66,8 @@ public void testNameCheckFailsAsItShouldWithMain() {
"* org.elasticsearch.test.NamingConventionsCheckBadClasses$WrongNameTheSecond",
"* org.elasticsearch.test.NamingConventionsCheckBadClasses$WrongName")) {
assertTrue(
"expected: '" + line + "' but it was not found in the output",
result.getOutput().contains(line)
"expected: '" + line + "' but it was not found in the output:\n"+output,
output.contains(line)
);
}
}
Expand Down