Skip to content

Commit 3c0d92c

Browse files
committed
Test MavenPlugin for empty output log on build fail
1 parent 009b54d commit 3c0d92c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tmc-langs-java/src/test/java/fi/helsinki/cs/tmc/langs/java/maven/MavenPluginTest.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import java.io.File;
1818
import java.io.IOException;
19-
import java.io.UnsupportedEncodingException;
2019
import java.nio.file.Path;
2120
import java.util.List;
2221
import java.util.Locale;
@@ -76,6 +75,19 @@ public void testRunTestsWhenBuildFailing() {
7675
assertEquals(RunResult.Status.COMPILE_FAILED, runResult.status);
7776
}
7877

78+
@Test
79+
public void testRunTestsOutputLogIsNotEmptyWhenBuildFails() throws IOException {
80+
Path project = TestUtils.getPath(getClass(), "failing_maven_exercise");
81+
RunResult result = mavenPlugin.runTests(project);
82+
83+
byte[] stdoutBytes = result.logs.get("stdout");
84+
String stdoutLog = new String(stdoutBytes, "utf-8");
85+
assertTrue( "Expected stdout log of failed maven test build to contain any text",
86+
stdoutLog.length() > 0);
87+
assertTrue("Expected stdout log of failed maven test build to contain \"BUILD_FAILURE\"!",
88+
stdoutLog.contains("BUILD FAILURE"));
89+
}
90+
7991
@Test
8092
public void testMavenProjectWithFailingTestsCompilesAndFailsTests() {
8193
Path path = TestUtils.getPath(getClass(), "maven_exercise");

0 commit comments

Comments
 (0)