@@ -21,29 +21,29 @@ class BulkTransferTest extends TestDeviceBase {
2121
2222 @ Test
2323 void smallTransfer_succeeds () {
24- byte [] sampleData = generateRandomBytes (12 , 293872394 );
24+ var sampleData = generateRandomBytes (12 , 293872394 );
2525 writeBytes (sampleData );
26- byte [] data = readBytes (sampleData .length );
26+ var data = readBytes (sampleData .length );
2727 assertArrayEquals (sampleData , data );
2828 }
2929
3030 @ Test
3131 void mediumTransfer_succeeds () {
3232 // This synchronous approach should work as the test device
3333 // has an internal buffer of about 500 bytes.
34- byte [] sampleData = generateRandomBytes (140 , 97333894 );
34+ var sampleData = generateRandomBytes (140 , 97333894 );
3535 writeBytes (sampleData );
36- byte [] data = readBytes (sampleData .length );
36+ var data = readBytes (sampleData .length );
3737 assertArrayEquals (sampleData , data );
3838 }
3939
4040 @ Test
4141 void transferWithZLP_succeeds () {
4242 var inEndpoint = testDevice .getEndpoint (USBDirection .IN , LOOPBACK_EP_IN );
43- byte [] sampleData = generateRandomBytes (inEndpoint .packetSize (), 97333894 );
43+ var sampleData = generateRandomBytes (inEndpoint .packetSize (), 97333894 );
4444 testDevice .transferOut (LOOPBACK_EP_OUT , sampleData );
4545 testDevice .transferOut (LOOPBACK_EP_OUT , new byte [0 ]);
46- byte [] data = testDevice .transferIn (LOOPBACK_EP_IN );
46+ var data = testDevice .transferIn (LOOPBACK_EP_IN );
4747 assertArrayEquals (sampleData , data );
4848 data = testDevice .transferIn (LOOPBACK_EP_IN );
4949 assertNotNull (data );
@@ -52,8 +52,8 @@ void transferWithZLP_succeeds() {
5252
5353 @ Test
5454 void largeTransfer_succeeds () throws Throwable {
55- final int numBytes = 230763 ;
56- byte [] sampleData = generateRandomBytes (numBytes , 3829007493L );
55+ final var numBytes = 230763 ;
56+ var sampleData = generateRandomBytes (numBytes , 3829007493L );
5757 var writer = CompletableFuture .runAsync (() -> writeBytes (sampleData ));
5858 var reader = CompletableFuture .supplyAsync (() -> readBytes (numBytes ));
5959 CompletableFuture .allOf (writer , reader ).join ();
@@ -63,19 +63,19 @@ void largeTransfer_succeeds() throws Throwable {
6363 }
6464
6565 static void writeBytes (byte [] data ) {
66- final int chunkSize = 100 ;
67- int numBytes = 0 ;
66+ final var chunkSize = 100 ;
67+ var numBytes = 0 ;
6868 while (numBytes < data .length ) {
69- int size = Math .min (chunkSize , data .length - numBytes );
69+ var size = Math .min (chunkSize , data .length - numBytes );
7070 testDevice .transferOut (LOOPBACK_EP_OUT , Arrays .copyOfRange (data , numBytes , numBytes + size ));
7171 numBytes += size ;
7272 }
7373 }
7474 static byte [] readBytes (int numBytes ) {
7575 var buffer = new ByteArrayOutputStream ();
76- int bytesRead = 0 ;
76+ var bytesRead = 0 ;
7777 while (bytesRead < numBytes ) {
78- byte [] data = testDevice .transferIn (LOOPBACK_EP_IN );
78+ var data = testDevice .transferIn (LOOPBACK_EP_IN );
7979 buffer .writeBytes (data );
8080 bytesRead += data .length ;
8181 }
0 commit comments