Skip to content
Open
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 @@ -49,17 +49,16 @@ public void testFormatAosp() throws Exception {
"class A{void b(){while(true){weCanBeCertainThatThisWillEndUpGettingWrapped("
+ "because, it, is, just, so, very, very, very, very, looong);}}}";
String expectedOutput =
Joiner.on("\n")
.join(
"class A {",
" void b() {",
" while (true) {",
" weCanBeCertainThatThisWillEndUpGettingWrapped(",
" because, it, is, just, so, very, very, very, very, looong);",
" }",
" }",
"}",
"");
"""
class A {
void b() {
while (true) {
weCanBeCertainThatThisWillEndUpGettingWrapped(
because, it, is, just, so, very, very, very, very, looong);
}
}
}
""";

Path tmpdir = testFolder.newFolder().toPath();
Path path = tmpdir.resolve("A.java");
Expand All @@ -82,7 +81,7 @@ public void testFormatNonJavaFiles() throws Exception {

// should succeed because non-Java files are skipped
assertThat(main.format("foo.go")).isEqualTo(0);
assertThat(err.toString()).contains("Skipping non-Java file: " + "foo.go");
assertThat(err.toString()).contains("Skipping non-Java file: foo.go");

// format still fails on missing files
assertThat(main.format("Foo.java")).isEqualTo(1);
Expand All @@ -91,8 +90,8 @@ public void testFormatNonJavaFiles() throws Exception {

@Test
public void testFormatStdinStdoutWithDashFlag() throws Exception {
String input = "class Foo{\n" + "void f\n" + "() {\n" + "}\n" + "}\n";
String expectedOutput = "class Foo {\n" + " void f() {}\n" + "}\n";
String input = "class Foo{\nvoid f\n() {\n}\n}\n";
String expectedOutput = "class Foo {\n void f() {}\n}\n";

InputStream in = new ByteArrayInputStream(input.getBytes(UTF_8));
StringWriter out = new StringWriter();
Expand All @@ -110,8 +109,8 @@ public void testFormatStdinStdoutWithDashFlag() throws Exception {

@Test
public void testFormatLengthUpToEOF() throws Exception {
String input = "class Foo{\n" + "void f\n" + "() {\n" + "}\n" + "}\n\n\n\n\n\n";
String expectedOutput = "class Foo {\n" + " void f() {}\n" + "}\n";
String input = "class Foo{\nvoid f\n() {\n}\n}\n\n\n\n\n\n";
String expectedOutput = "class Foo {\n void f() {}\n}\n";

Path tmpdir = testFolder.newFolder().toPath();
Path path = tmpdir.resolve("Foo.java");
Expand Down
Loading