Make error messages more readable in CommandLineRunnerTest
@@ -44,6 +44,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@@ -2060,12 +2061,12 @@ public final class CommandLineRunnerTest extends TestCase {
Compiler compiler = compile(original);
if (warning == null) {
- assertEquals("Expected no warnings or errors\n" +
- "Errors: \n" + Joiner.on("\n").join(compiler.getErrors()) +
- "Warnings: \n" + Joiner.on("\n").join(compiler.getWarnings()),
+ assertEquals("Expected no warnings or errors"
+ + "\nErrors: \n" + Joiner.on("\n").join(compiler.getErrors())
+ + "\nWarnings: \n" + Joiner.on("\n").join(compiler.getWarnings()),
0, compiler.getErrors().length + compiler.getWarnings().length);
} else {
- assertThat(compiler.getWarnings()).hasLength(1);
+ assertThat(Arrays.asList(compiler.getWarnings())).hasSize(1);
assertThat(compiler.getWarnings()[0].getType()).isEqualTo(warning);
}
@@ -2108,11 +2109,11 @@ public final class CommandLineRunnerTest extends TestCase {
int lastExitCode = Iterables.getLast(exitCodes);
if (compiler.getErrors().length > 0) {
- assertThat(compiler.getErrors()).hasLength(1);
+ assertThat(Arrays.asList(compiler.getErrors())).hasSize(1);
assertThat(compiler.getErrors()[0].getType()).isEqualTo(warning);
assertThat(lastExitCode).isEqualTo(1);
} else {
- assertThat(compiler.getWarnings()).hasLength(1);
+ assertThat(Arrays.asList(compiler.getWarnings())).hasSize(1);
assertThat(compiler.getWarnings()[0].getType()).isEqualTo(warning);
assertThat(lastExitCode).isEqualTo(0);
}
