@@ -80,63 +80,63 @@ public void closeReader() {
8080 @ ParameterizedTest (name = "BlockSize={0}" )
8181 @ MethodSource ("blockSizes" )
8282 public void testIsoFileDefaults (final int testParamBlockSize ) throws URISyntaxException , IOException {
83- final File testFileIso = new File ( this . getClass (). getResource ( "/test-file-iso8859-1.bin" ). toURI () );
83+ final File testFileIso = TestResources . getFile ( "/test-file-iso8859-1.bin" );
8484 reversedLinesFileReader = new ReversedLinesFileReader (testFileIso , testParamBlockSize , ISO_8859_1 );
8585 assertFileWithShrinkingTestLines (reversedLinesFileReader );
8686 }
8787
8888 @ ParameterizedTest (name = "BlockSize={0}" )
8989 @ MethodSource ("blockSizes" )
9090 public void testUTF8FileWindowsBreaks (final int testParamBlockSize ) throws URISyntaxException , IOException {
91- final File testFileIso = new File ( this . getClass (). getResource ( "/test-file-utf8-win-linebr.bin" ). toURI () );
91+ final File testFileIso = TestResources . getFile ( "/test-file-utf8-win-linebr.bin" );
9292 reversedLinesFileReader = new ReversedLinesFileReader (testFileIso , testParamBlockSize , UTF_8 );
9393 assertFileWithShrinkingTestLines (reversedLinesFileReader );
9494 }
9595
9696 @ ParameterizedTest (name = "BlockSize={0}" )
9797 @ MethodSource ("blockSizes" )
9898 public void testUTF8FileCRBreaks (final int testParamBlockSize ) throws URISyntaxException , IOException {
99- final File testFileIso = new File ( this . getClass (). getResource ( "/test-file-utf8-cr-only.bin" ). toURI () );
99+ final File testFileIso = TestResources . getFile ( "/test-file-utf8-cr-only.bin" );
100100 reversedLinesFileReader = new ReversedLinesFileReader (testFileIso , testParamBlockSize , UTF_8 );
101101 assertFileWithShrinkingTestLines (reversedLinesFileReader );
102102 }
103103
104104 @ ParameterizedTest (name = "BlockSize={0}" )
105105 @ MethodSource ("blockSizes" )
106106 public void testUTF8File (final int testParamBlockSize ) throws URISyntaxException , IOException {
107- final File testFileIso = new File ( this . getClass (). getResource ( "/test-file-utf8.bin" ). toURI () );
107+ final File testFileIso = TestResources . getFile ( "/test-file-utf8.bin" );
108108 reversedLinesFileReader = new ReversedLinesFileReader (testFileIso , testParamBlockSize , UTF_8 );
109109 assertFileWithShrinkingTestLines (reversedLinesFileReader );
110110 }
111111
112112 @ ParameterizedTest (name = "BlockSize={0}" )
113113 @ MethodSource ("blockSizes" )
114114 public void testEmptyFile (final int testParamBlockSize ) throws URISyntaxException , IOException {
115- final File testFileEmpty = new File ( this . getClass (). getResource ( "/test-file-empty.bin" ). toURI () );
115+ final File testFileEmpty = TestResources . getFile ( "/test-file-empty.bin" );
116116 reversedLinesFileReader = new ReversedLinesFileReader (testFileEmpty , testParamBlockSize , UTF_8 );
117117 assertNull (reversedLinesFileReader .readLine ());
118118 }
119119
120120 @ ParameterizedTest (name = "BlockSize={0}" )
121121 @ MethodSource ("blockSizes" )
122122 public void testUTF16BEFile (final int testParamBlockSize ) throws URISyntaxException , IOException {
123- final File testFileUTF16BE = new File ( this . getClass (). getResource ( "/test-file-utf16be.bin" ). toURI () );
123+ final File testFileUTF16BE = TestResources . getFile ( "/test-file-utf16be.bin" );
124124 reversedLinesFileReader = new ReversedLinesFileReader (testFileUTF16BE , testParamBlockSize , "UTF-16BE" );
125125 assertFileWithShrinkingTestLines (reversedLinesFileReader );
126126 }
127127
128128 @ ParameterizedTest (name = "BlockSize={0}" )
129129 @ MethodSource ("blockSizes" )
130130 public void testUTF16LEFile (final int testParamBlockSize ) throws URISyntaxException , IOException {
131- final File testFileUTF16LE = new File ( this . getClass (). getResource ( "/test-file-utf16le.bin" ). toURI () );
131+ final File testFileUTF16LE = TestResources . getFile ( "/test-file-utf16le.bin" );
132132 reversedLinesFileReader = new ReversedLinesFileReader (testFileUTF16LE , testParamBlockSize , "UTF-16LE" );
133133 assertFileWithShrinkingTestLines (reversedLinesFileReader );
134134 }
135135
136136 @ ParameterizedTest (name = "BlockSize={0}" )
137137 @ MethodSource ("blockSizes" )
138138 public void testShiftJISFile (final int testParamBlockSize ) throws URISyntaxException , IOException {
139- final File testFileShiftJIS = new File ( this . getClass (). getResource ( "/test-file-shiftjis.bin" ). toURI () );
139+ final File testFileShiftJIS = TestResources . getFile ( "/test-file-shiftjis.bin" );
140140 reversedLinesFileReader = new ReversedLinesFileReader (testFileShiftJIS , testParamBlockSize , "Shift_JIS" );
141141 assertEqualsAndNoLineBreaks (TEST_LINE_SHIFT_JIS2 , reversedLinesFileReader .readLine ());
142142 assertEqualsAndNoLineBreaks (TEST_LINE_SHIFT_JIS1 , reversedLinesFileReader .readLine ());
@@ -145,7 +145,7 @@ public void testShiftJISFile(final int testParamBlockSize) throws URISyntaxExcep
145145 @ ParameterizedTest (name = "BlockSize={0}" )
146146 @ MethodSource ("blockSizes" )
147147 public void testWindows31jFile (final int testParamBlockSize ) throws URISyntaxException , IOException {
148- final File testFileWindows31J = new File ( this . getClass (). getResource ( "/test-file-windows-31j.bin" ). toURI () );
148+ final File testFileWindows31J = TestResources . getFile ( "/test-file-windows-31j.bin" );
149149 reversedLinesFileReader = new ReversedLinesFileReader (testFileWindows31J , testParamBlockSize , "windows-31j" );
150150 assertEqualsAndNoLineBreaks (TEST_LINE_WINDOWS_31J_2 , reversedLinesFileReader .readLine ());
151151 assertEqualsAndNoLineBreaks (TEST_LINE_WINDOWS_31J_1 , reversedLinesFileReader .readLine ());
@@ -154,7 +154,7 @@ public void testWindows31jFile(final int testParamBlockSize) throws URISyntaxExc
154154 @ ParameterizedTest (name = "BlockSize={0}" )
155155 @ MethodSource ("blockSizes" )
156156 public void testGBK (final int testParamBlockSize ) throws URISyntaxException , IOException {
157- final File testFileGBK = new File ( this . getClass (). getResource ( "/test-file-gbk.bin" ). toURI () );
157+ final File testFileGBK = TestResources . getFile ( "/test-file-gbk.bin" );
158158 reversedLinesFileReader = new ReversedLinesFileReader (testFileGBK , testParamBlockSize , "GBK" );
159159 assertEqualsAndNoLineBreaks (TEST_LINE_GBK_2 , reversedLinesFileReader .readLine ());
160160 assertEqualsAndNoLineBreaks (TEST_LINE_GBK_1 , reversedLinesFileReader .readLine ());
@@ -163,7 +163,7 @@ public void testGBK(final int testParamBlockSize) throws URISyntaxException, IOE
163163 @ ParameterizedTest (name = "BlockSize={0}" )
164164 @ MethodSource ("blockSizes" )
165165 public void testxWindows949File (final int testParamBlockSize ) throws URISyntaxException , IOException {
166- final File testFilexWindows949 = new File ( this . getClass (). getResource ( "/test-file-x-windows-949.bin" ). toURI () );
166+ final File testFilexWindows949 = TestResources . getFile ( "/test-file-x-windows-949.bin" );
167167 reversedLinesFileReader = new ReversedLinesFileReader (testFilexWindows949 , testParamBlockSize , "x-windows-949" );
168168 assertEqualsAndNoLineBreaks (TEST_LINE_X_WINDOWS_949_2 , reversedLinesFileReader .readLine ());
169169 assertEqualsAndNoLineBreaks (TEST_LINE_X_WINDOWS_949_1 , reversedLinesFileReader .readLine ());
@@ -172,7 +172,7 @@ public void testxWindows949File(final int testParamBlockSize) throws URISyntaxEx
172172 @ ParameterizedTest (name = "BlockSize={0}" )
173173 @ MethodSource ("blockSizes" )
174174 public void testxWindows950File (final int testParamBlockSize ) throws URISyntaxException , IOException {
175- final File testFilexWindows950 = new File ( this . getClass (). getResource ( "/test-file-x-windows-950.bin" ). toURI () );
175+ final File testFilexWindows950 = TestResources . getFile ( "/test-file-x-windows-950.bin" );
176176 reversedLinesFileReader = new ReversedLinesFileReader (testFilexWindows950 , testParamBlockSize , "x-windows-950" );
177177 assertEqualsAndNoLineBreaks (TEST_LINE_X_WINDOWS_950_2 , reversedLinesFileReader .readLine ());
178178 assertEqualsAndNoLineBreaks (TEST_LINE_X_WINDOWS_950_1 , reversedLinesFileReader .readLine ());
@@ -181,7 +181,7 @@ public void testxWindows950File(final int testParamBlockSize) throws URISyntaxEx
181181 @ Test
182182 public void testFileSizeIsExactMultipleOfBlockSize () throws URISyntaxException , IOException {
183183 final int blockSize = 10 ;
184- final File testFile20Bytes = new File ( this . getClass (). getResource ( "/test-file-20byteslength.bin" ). toURI () );
184+ final File testFile20Bytes = TestResources . getFile ( "/test-file-20byteslength.bin" );
185185 reversedLinesFileReader = new ReversedLinesFileReader (testFile20Bytes , blockSize , ISO_8859_1 );
186186 assertEqualsAndNoLineBreaks ("987654321" , reversedLinesFileReader .readLine ());
187187 assertEqualsAndNoLineBreaks ("123456789" , reversedLinesFileReader .readLine ());
@@ -190,15 +190,15 @@ public void testFileSizeIsExactMultipleOfBlockSize() throws URISyntaxException,
190190 @ ParameterizedTest (name = "BlockSize={0}" )
191191 @ MethodSource ("blockSizes" )
192192 public void testUTF8FileWindowsBreaksSmallBlockSize2VerifyBlockSpanningNewLines (final int testParamBlockSize ) throws URISyntaxException , IOException {
193- final File testFileUtf8 = new File ( this . getClass (). getResource ( "/test-file-utf8-win-linebr.bin" ). toURI () );
193+ final File testFileUtf8 = TestResources . getFile ( "/test-file-utf8-win-linebr.bin" );
194194 reversedLinesFileReader = new ReversedLinesFileReader (testFileUtf8 , testParamBlockSize , UTF_8 );
195195 assertFileWithShrinkingTestLines (reversedLinesFileReader );
196196 }
197197
198198 @ ParameterizedTest (name = "BlockSize={0}" )
199199 @ MethodSource ("blockSizes" )
200200 public void testIsoFileManyWindowsBreaksSmallBlockSize2VerifyBlockSpanningNewLines (final int testParamBlockSize ) throws URISyntaxException , IOException {
201- final File testFileIso = new File ( this . getClass (). getResource ( "/test-file-iso8859-1-shortlines-win-linebr.bin" ). toURI () );
201+ final File testFileIso = TestResources . getFile ( "/test-file-iso8859-1-shortlines-win-linebr.bin" );
202202 reversedLinesFileReader = new ReversedLinesFileReader (testFileIso , testParamBlockSize , ISO_8859_1 );
203203
204204 for (int i = 3 ; i > 0 ; i --) {
@@ -212,15 +212,15 @@ public void testIsoFileManyWindowsBreaksSmallBlockSize2VerifyBlockSpanningNewLin
212212 @ ParameterizedTest (name = "BlockSize={0}" )
213213 @ MethodSource ("blockSizes" )
214214 public void testUnsupportedEncodingUTF16 (final int testParamBlockSize ) throws URISyntaxException {
215- final File testFileEmpty = new File ( this . getClass (). getResource ( "/test-file-empty.bin" ). toURI () );
215+ final File testFileEmpty = TestResources . getFile ( "/test-file-empty.bin" );
216216 assertThrows (UnsupportedEncodingException .class ,
217217 () -> new ReversedLinesFileReader (testFileEmpty , testParamBlockSize , "UTF-16" ).close ());
218218 }
219219
220220 @ ParameterizedTest (name = "BlockSize={0}" )
221221 @ MethodSource ("blockSizes" )
222222 public void testUnsupportedEncodingBig5 (final int testParamBlockSize ) throws URISyntaxException {
223- final File testFileEncodingBig5 = new File ( this . getClass (). getResource ( "/test-file-empty.bin" ). toURI () );
223+ final File testFileEncodingBig5 = TestResources . getFile ( "/test-file-empty.bin" );
224224 assertThrows (UnsupportedEncodingException .class ,
225225 () -> new ReversedLinesFileReader (testFileEncodingBig5 , testParamBlockSize , "Big5" ).close ());
226226 }
0 commit comments