@@ -76,37 +76,37 @@ public void givenCharacterCh_whenConvertedtoBinaryWithEncodingUTF32_thenProduceR
7676 @ Test
7777 public void givenUTF8String_decodeByUS_ASCII_ReplaceMalformedInputSequence () throws IOException {
7878 String input = "The façade pattern is a software design pattern." ;
79- Assertions .assertEquals (CharacterEncodingExamples . decodeText ( input , StandardCharsets . US_ASCII , CodingErrorAction . REPLACE ) ,
80- "The fa��ade pattern is a software design pattern." );
79+ Assertions .assertEquals ("The fa��ade pattern is a software design pattern." ,
80+ CharacterEncodingExamples . decodeText ( input , StandardCharsets . US_ASCII , CodingErrorAction . REPLACE ) );
8181 }
8282
8383 @ Test
8484 public void givenUTF8String_decodeByUS_ASCII_IgnoreMalformedInputSequence () throws IOException {
8585 String input = "The façade pattern is a software design pattern." ;
8686 Assertions .assertEquals (
87- CharacterEncodingExamples . decodeText ( input , StandardCharsets . US_ASCII , CodingErrorAction . IGNORE ) ,
88- "The faade pattern is a software design pattern." );
87+ "The faade pattern is a software design pattern." ,
88+ CharacterEncodingExamples . decodeText ( input , StandardCharsets . US_ASCII , CodingErrorAction . IGNORE ) );
8989 }
9090
9191 @ Test
9292 public void givenUTF8String_decodeByUS_ASCII_ReportMalformedInputSequence () {
9393 String input = "The façade pattern is a software design pattern." ;
9494 Assertions .assertThrows (MalformedInputException .class ,
95- () -> CharacterEncodingExamples .decodeText (input , StandardCharsets .US_ASCII , CodingErrorAction .REPORT ));
95+ () -> CharacterEncodingExamples .decodeText (input , StandardCharsets .US_ASCII , CodingErrorAction .REPORT ));
9696 }
9797
9898 @ Test
9999 public void givenTextFile_FindSuitableCandidateEncodings () {
100100 Path path = Paths .get ("src/test/resources/encoding.txt" );
101- List <Charset > allCandidateCharSets = Arrays .asList (StandardCharsets .US_ASCII , StandardCharsets .UTF_8 , StandardCharsets .ISO_8859_1 );
101+ List <Charset > allCandidateCharSets = Arrays .asList (
102+ StandardCharsets .US_ASCII , StandardCharsets .UTF_8 , StandardCharsets .ISO_8859_1 );
102103 List <Charset > suitableCharsets = new ArrayList <>();
103104 allCandidateCharSets .forEach (charset -> {
104105 try {
105106 CharsetDecoder charsetDecoder = charset .newDecoder ().onMalformedInput (CodingErrorAction .REPORT );
106107 Reader reader = new InputStreamReader (Files .newInputStream (path ), charsetDecoder );
107108 BufferedReader bufferedReader = new BufferedReader (reader );
108- while (bufferedReader .readLine () != null ) {
109- }
109+ bufferedReader .readLine ();
110110 suitableCharsets .add (charset );
111111 } catch (MalformedInputException ignored ) {
112112 } catch (IOException ex ) {
0 commit comments