@@ -59,6 +59,18 @@ public ReversedLinesFileReaderTestParamBlockSize(final Integer testWithBlockSize
5959 private static final String TEST_LINE_SHIFT_JIS1 = "Hiragana letters: \u3041 \u3042 \u3043 \u3044 \u3045 " ;
6060 // Kanji letters: 明輸å�京
6161 private static final String TEST_LINE_SHIFT_JIS2 = "Kanji letters: \u660E \u8F38 \u5B50 \u4EAC " ;
62+ // windows-31j characters
63+ private static final String TEST_LINE_WINDOWS_31J_1 = "\u3041 \u3042 \u3043 \u3044 \u3045 " ;
64+ private static final String TEST_LINE_WINDOWS_31J_2 = "\u660E \u8F38 \u5B50 \u4EAC " ;
65+ // gbk characters (Simplified Chinese)
66+ private static final String TEST_LINE_GBK_1 = "\u660E \u8F38 \u5B50 \u4EAC " ;
67+ private static final String TEST_LINE_GBK_2 = "\u7B80 \u4F53 \u4E2D \u6587 " ;
68+ // x-windows-949 characters (Korean)
69+ private static final String TEST_LINE_X_WINDOWS_949_1 = "\uD55C \uAD6D \uC5B4 " ;
70+ private static final String TEST_LINE_X_WINDOWS_949_2 = "\uB300 \uD55C \uBBFC \uAD6D " ;
71+ // x-windows-950 characters (Traditional Chinese)
72+ private static final String TEST_LINE_X_WINDOWS_950_1 = "\u660E \u8F38 \u5B50 \u4EAC " ;
73+ private static final String TEST_LINE_X_WINDOWS_950_2 = "\u7E41 \u9AD4 \u4E2D \u6587 " ;
6274
6375
6476 @ After
@@ -127,6 +139,38 @@ public void testShiftJISFile() throws URISyntaxException, IOException {
127139 assertEqualsAndNoLineBreaks (TEST_LINE_SHIFT_JIS1 , reversedLinesFileReader .readLine ());
128140 }
129141
142+ @ Test
143+ public void testWindows31jFile () throws URISyntaxException , IOException {
144+ final File testFileWindows31J = new File (this .getClass ().getResource ("/test-file-windows-31j.bin" ).toURI ());
145+ reversedLinesFileReader = new ReversedLinesFileReader (testFileWindows31J , testParamBlockSize , "windows-31j" );
146+ assertEqualsAndNoLineBreaks (TEST_LINE_WINDOWS_31J_2 , reversedLinesFileReader .readLine ());
147+ assertEqualsAndNoLineBreaks (TEST_LINE_WINDOWS_31J_1 , reversedLinesFileReader .readLine ());
148+ }
149+
150+ @ Test
151+ public void testGBK () throws URISyntaxException , IOException {
152+ final File testFileGBK = new File (this .getClass ().getResource ("/test-file-gbk.bin" ).toURI ());
153+ reversedLinesFileReader = new ReversedLinesFileReader (testFileGBK , testParamBlockSize , "GBK" );
154+ assertEqualsAndNoLineBreaks (TEST_LINE_GBK_2 , reversedLinesFileReader .readLine ());
155+ assertEqualsAndNoLineBreaks (TEST_LINE_GBK_1 , reversedLinesFileReader .readLine ());
156+ }
157+
158+ @ Test
159+ public void testxWindows949File () throws URISyntaxException , IOException {
160+ final File testFilexWindows949 = new File (this .getClass ().getResource ("/test-file-x-windows-949.bin" ).toURI ());
161+ reversedLinesFileReader = new ReversedLinesFileReader (testFilexWindows949 , testParamBlockSize , "x-windows-949" );
162+ assertEqualsAndNoLineBreaks (TEST_LINE_X_WINDOWS_949_2 , reversedLinesFileReader .readLine ());
163+ assertEqualsAndNoLineBreaks (TEST_LINE_X_WINDOWS_949_1 , reversedLinesFileReader .readLine ());
164+ }
165+
166+ @ Test
167+ public void testxWindows950File () throws URISyntaxException , IOException {
168+ final File testFilexWindows950 = new File (this .getClass ().getResource ("/test-file-x-windows-950.bin" ).toURI ());
169+ reversedLinesFileReader = new ReversedLinesFileReader (testFilexWindows950 , testParamBlockSize , "x-windows-950" );
170+ assertEqualsAndNoLineBreaks (TEST_LINE_X_WINDOWS_950_2 , reversedLinesFileReader .readLine ());
171+ assertEqualsAndNoLineBreaks (TEST_LINE_X_WINDOWS_950_1 , reversedLinesFileReader .readLine ());
172+ }
173+
130174 @ Test // this test is run 3x for same block size as we want to test with 10
131175 public void testFileSizeIsExactMultipleOfBlockSize () throws URISyntaxException , IOException {
132176 final int blockSize = 10 ;
0 commit comments