diff --git a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/HttpTestUtils.java b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/HttpTestUtils.java index 7da22f83d..da16d79a8 100644 --- a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/HttpTestUtils.java +++ b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/HttpTestUtils.java @@ -252,7 +252,7 @@ public static boolean equivalent(final HttpResponse r1, final HttpResponse r2) { public static byte[] getRandomBytes(final int nbytes) { final byte[] bytes = new byte[nbytes]; - (new Random()).nextBytes(bytes); + new Random().nextBytes(bytes); return bytes; } diff --git a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java index b29d62802..a154a6cf9 100644 --- a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java +++ b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java @@ -145,7 +145,7 @@ private void verifyMocks() { private HttpEntity makeBody(final int nbytes) { final byte[] bytes = new byte[nbytes]; - (new Random()).nextBytes(bytes); + new Random().nextBytes(bytes); return new ByteArrayEntity(bytes); } @@ -218,7 +218,7 @@ public void testHTTP1_1RequestsWithUnknownBodyLengthAreRejectedOrHaveContentLeng HTTP_1_1); final byte[] bytes = new byte[128]; - (new Random()).nextBytes(bytes); + new Random().nextBytes(bytes); final HttpEntity mockBody = EasyMock.createMockBuilder(ByteArrayEntity.class).withConstructor( new Object[] { bytes }).addMockedMethods("getContentLength").createNiceMock(); diff --git a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java index 17f527b72..754bc98a8 100644 --- a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java +++ b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolRequirements.java @@ -1782,7 +1782,7 @@ public void test206ResponsesAreNotCachedIfTheCacheDoesNotSupportRangeAndContentR originResponse.setHeader("Content-Range", "bytes 0-50/128"); originResponse.setHeader("Cache-Control", "max-age=3600"); final byte[] bytes = new byte[51]; - (new Random()).nextBytes(bytes); + new Random().nextBytes(bytes); originResponse.setEntity(new ByteArrayEntity(bytes)); EasyMock.expect( @@ -2486,7 +2486,7 @@ public void testMustReturnACacheEntryIfItCanRevalidateIt() throws Exception { }; final byte[] bytes = new byte[128]; - (new Random()).nextBytes(bytes); + new Random().nextBytes(bytes); final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(tenSecondsAgo, eightSecondsAgo, hdrs, bytes); @@ -2544,7 +2544,7 @@ public void testMustReturnAFreshEnoughCacheEntryIfItHasIt() throws Exception { }; final byte[] bytes = new byte[128]; - (new Random()).nextBytes(bytes); + new Random().nextBytes(bytes); final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(tenSecondsAgo, eightSecondsAgo, hdrs, bytes); @@ -2592,7 +2592,7 @@ public void testMustServeAppropriateErrorOrWarningIfNoOriginCommunicationPossibl }; final byte[] bytes = new byte[128]; - (new Random()).nextBytes(bytes); + new Random().nextBytes(bytes); final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(tenSecondsAgo, eightSecondsAgo, hdrs, bytes); @@ -2811,7 +2811,7 @@ public void testAgeHeaderPopulatedFromCacheEntryCurrentAge() throws Exception { }; final byte[] bytes = new byte[128]; - (new Random()).nextBytes(bytes); + new Random().nextBytes(bytes); final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(tenSecondsAgo, eightSecondsAgo, hdrs, bytes); @@ -2862,7 +2862,7 @@ public void testHeuristicCacheOlderThan24HoursHasWarningAttached() throws Except }; final byte[] bytes = new byte[128]; - (new Random()).nextBytes(bytes); + new Random().nextBytes(bytes); final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(requestTime, responseTime, hdrs, bytes); diff --git a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestResponseCachingPolicy.java b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestResponseCachingPolicy.java index e7b0387ee..80401c7b6 100644 --- a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestResponseCachingPolicy.java +++ b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestResponseCachingPolicy.java @@ -667,7 +667,7 @@ public void otherStatusCodesAreCacheableWithExplicitCachingHeaders() { } private int getRandomStatus() { - final int rnd = (new Random()).nextInt(acceptableCodes.length); + final int rnd = new Random().nextInt(acceptableCodes.length); return acceptableCodes[rnd]; }