Skip to content

Commit 7a9738b

Browse files
committed
Enhanced: reformatted code to synchronized it with the article
1 parent 78cb7a3 commit 7a9738b

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

core-java-modules/core-java/src/test/java/com/baeldung/encoding/CharacterEncodingExamplesUnitTest.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,30 +75,35 @@ public void givenCharacterCh_whenConvertedtoBinaryWithEncodingUTF32_thenProduceR
7575

7676
@Test
7777
public void givenUTF8String_whenDecodeByUS_ASCII_thenIgnoreMalformedInputSequence() throws IOException {
78-
Assertions.assertEquals("The faade pattern is a software design pattern.",
79-
CharacterEncodingExamples.decodeText(
80-
"The façade pattern is a software design pattern.", StandardCharsets.US_ASCII, CodingErrorAction.IGNORE));
78+
Assertions.assertEquals("The faade pattern is a software design pattern.", CharacterEncodingExamples.decodeText("The façade pattern is a software design pattern.", StandardCharsets.US_ASCII, CodingErrorAction.IGNORE));
8179
}
8280

8381
@Test
8482
public void givenUTF8String_whenDecodeByUS_ASCII_thenReplaceMalformedInputSequence() throws IOException {
85-
Assertions.assertEquals("The fa��ade pattern is a software design pattern.",
83+
Assertions.assertEquals(
84+
"The fa��ade pattern is a software design pattern.",
8685
CharacterEncodingExamples.decodeText(
87-
"The façade pattern is a software design pattern.", StandardCharsets.US_ASCII, CodingErrorAction.REPLACE));
86+
"The façade pattern is a software design pattern.",
87+
StandardCharsets.US_ASCII,
88+
CodingErrorAction.REPLACE));
8889
}
8990

9091
@Test
9192
public void givenUTF8String_whenDecodeByUS_ASCII_thenReportMalformedInputSequence() {
92-
Assertions.assertThrows(MalformedInputException.class,
93+
Assertions.assertThrows(
94+
MalformedInputException.class,
9395
() -> CharacterEncodingExamples.decodeText(
94-
"The façade pattern is a software design pattern.", StandardCharsets.US_ASCII, CodingErrorAction.REPORT));
96+
"The façade pattern is a software design pattern.",
97+
StandardCharsets.US_ASCII,
98+
CodingErrorAction.REPORT));
9599
}
96100

97101
@Test
98102
public void givenTextFile_whenFindSuitableCandidateEncodings_thenProduceSuitableCandidateEncodings() {
99103
Path path = Paths.get("src/test/resources/encoding.txt");
100104
List<Charset> allCandidateCharSets = Arrays.asList(
101105
StandardCharsets.US_ASCII, StandardCharsets.UTF_8, StandardCharsets.ISO_8859_1);
106+
102107
List<Charset> suitableCharsets = new ArrayList<>();
103108
allCandidateCharSets.forEach(charset -> {
104109
try {

0 commit comments

Comments
 (0)