2626import org .apache .commons .io .IOUtils ;
2727import org .junit .jupiter .api .Test ;
2828import org .junit .jupiter .params .ParameterizedTest ;
29- import org .junit .jupiter .params .provider .ValueSource ;
29+ import org .junit .jupiter .params .provider .MethodSource ;
3030
3131/**
3232 * Tests {@link CountingInputStream}.
@@ -35,10 +35,10 @@ public class CountingInputStreamTest {
3535
3636 @ SuppressWarnings ("resource" )
3737 @ ParameterizedTest
38- @ ValueSource ( ints = { 0 , 1 , 2 , 4 , 8 , 16 , 32 , 64 , 128 } )
38+ @ MethodSource ( AbstractInputStreamTest . ARRAY_LENGTHS_NAME )
3939 public void testAvailableAfterClose (final int len ) throws Exception {
4040 final ByteArrayInputStream bais = new ByteArrayInputStream (new byte [len ]);
41- InputStream shadow ;
41+ final InputStream shadow ;
4242 try (InputStream in = CloseShieldInputStream .wrap (bais )) {
4343 assertEquals (len , in .available ());
4444 shadow = in ;
@@ -47,7 +47,7 @@ public void testAvailableAfterClose(final int len) throws Exception {
4747 }
4848
4949 @ ParameterizedTest
50- @ ValueSource ( ints = { 0 , 1 , 2 , 4 , 8 , 16 , 32 , 64 , 128 } )
50+ @ MethodSource ( AbstractInputStreamTest . ARRAY_LENGTHS_NAME )
5151 public void testAvailableAfterOpen (final int len ) throws Exception {
5252 final ByteArrayInputStream bais = new ByteArrayInputStream (new byte [len ]);
5353 try (InputStream in = CloseShieldInputStream .wrap (bais )) {
@@ -144,7 +144,7 @@ public void testLargeFiles_IO84() throws Exception {
144144 assertThrows (ArithmeticException .class , () -> cis .getCount ());
145145 assertThrows (ArithmeticException .class , () -> cis .resetCount ());
146146
147- mock .close ();
147+ mock .init ();
148148
149149 // Test long methods
150150 IOUtils .consume (cis );
@@ -154,10 +154,10 @@ public void testLargeFiles_IO84() throws Exception {
154154
155155 @ SuppressWarnings ("resource" )
156156 @ ParameterizedTest
157- @ ValueSource ( ints = { 0 , 1 , 2 , 4 , 8 , 16 , 32 , 64 , 128 } )
157+ @ MethodSource ( AbstractInputStreamTest . ARRAY_LENGTHS_NAME )
158158 public void testReadAfterClose (final int len ) throws Exception {
159159 final ByteArrayInputStream bais = new ByteArrayInputStream (new byte [len ]);
160- InputStream shadow ;
160+ final InputStream shadow ;
161161 try (InputStream in = CloseShieldInputStream .wrap (bais )) {
162162 assertEquals (len , in .available ());
163163 shadow = in ;
0 commit comments