1717import static com .google .common .truth .Truth .assertThat ;
1818import static com .google .common .truth .Truth .assertWithMessage ;
1919import static com .palantir .javaformat .java .JavaFormatterOptions .Style ;
20+ import static java .nio .charset .StandardCharsets .UTF_8 ;
2021import static org .assertj .core .api .Assertions .assertThatCode ;
2122import static org .assertj .core .api .Assertions .assertThatThrownBy ;
2223import static org .junit .jupiter .api .Assertions .assertTimeoutPreemptively ;
3031import java .io .InputStreamReader ;
3132import java .io .PrintWriter ;
3233import java .io .StringWriter ;
33- import java .nio .charset .StandardCharsets ;
3434import java .nio .file .Files ;
3535import java .nio .file .Path ;
3636import java .time .Duration ;
@@ -73,7 +73,7 @@ void formatStdinStdoutWithDashFlag() throws Exception {
7373 String input = "class Foo{\n " + "void f\n " + "() {\n " + "}\n " + "}\n " ;
7474 String expectedOutput = "class Foo {\n " + " void f() {}\n " + "}\n " ;
7575
76- InputStream in = new ByteArrayInputStream (input .getBytes (StandardCharsets . UTF_8 ));
76+ InputStream in = new ByteArrayInputStream (input .getBytes (UTF_8 ));
7777 StringWriter out = new StringWriter ();
7878 StringWriter err = new StringWriter ();
7979
@@ -93,7 +93,7 @@ void formatLengthUpToEOF() throws Exception {
9393 String expectedOutput = "class Foo {\n " + " void f() {}\n " + "}\n " ;
9494
9595 Path path = testFolder .resolve ("Foo.java" );
96- Files .write (path , input .getBytes (StandardCharsets . UTF_8 ));
96+ Files .write (path , input .getBytes (UTF_8 ));
9797
9898 StringWriter out = new StringWriter ();
9999 StringWriter err = new StringWriter ();
@@ -109,7 +109,7 @@ void formatLengthOutOfRange() throws Exception {
109109 String input = "class Foo{}\n " ;
110110
111111 Path path = testFolder .resolve ("Foo.java" );
112- Files .write (path , input .getBytes (StandardCharsets . UTF_8 ));
112+ Files .write (path , input .getBytes (UTF_8 ));
113113
114114 StringWriter out = new StringWriter ();
115115 StringWriter err = new StringWriter ();
@@ -181,7 +181,7 @@ private void importOrdering(@Nullable String sortArg, String outputResourceName)
181181 String inputResourceName = "com/palantir/javaformat/java/testimports/A.input" ;
182182 String input = getResource (inputResourceName );
183183 String expectedOutput = getResource (outputResourceName );
184- Files .write (path , input .getBytes (StandardCharsets . UTF_8 ));
184+ Files .write (path , input .getBytes (UTF_8 ));
185185
186186 StringWriter out = new StringWriter ();
187187 StringWriter err = new StringWriter ();
@@ -192,14 +192,14 @@ private void importOrdering(@Nullable String sortArg, String outputResourceName)
192192
193193 assertThat (err .toString ()).isEmpty ();
194194 assertThat (out .toString ()).isEmpty ();
195- String output = new String (Files .readAllBytes (path ), StandardCharsets . UTF_8 );
195+ String output = new String (Files .readAllBytes (path ), UTF_8 );
196196 assertThat (output ).isEqualTo (expectedOutput );
197197 }
198198
199199 private String getResource (String resourceName ) throws IOException {
200200 try (InputStream stream = getClass ().getClassLoader ().getResourceAsStream (resourceName )) {
201201 assertWithMessage ("Missing resource: " + resourceName ).that (stream ).isNotNull ();
202- return CharStreams .toString (new InputStreamReader (stream , StandardCharsets . UTF_8 ));
202+ return CharStreams .toString (new InputStreamReader (stream , UTF_8 ));
203203 }
204204 }
205205
0 commit comments