You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2024/06/27 21:11:12 UTC
(httpcomponents-client) 01/03: Test classes and methods should have default package visibility
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
commit 185d4e32aa95906c8d99e4555fa64aa204e156bf
Author: strangelookingnerd <49...@users.noreply.github.com>
AuthorDate: Thu Jun 27 09:36:37 2024 +0200
Test classes and methods should have default package visibility
---
.../hc/client5/http/cache/TestHttpCacheEntry.java | 44 ++--
.../http/cache/TestHttpCacheEntryFactory.java | 30 +--
.../http/impl/cache/CacheControlGeneratorTest.java | 6 +-
.../http/impl/cache/CacheControlParserTest.java | 48 ++--
.../http/impl/cache/ConsumableInputStream.java | 2 +-
.../http/impl/cache/SimpleHttpCacheStorage.java | 6 +-
.../TestAbstractSerializingAsyncCacheStorage.java | 26 +-
.../cache/TestAbstractSerializingCacheStorage.java | 26 +-
.../http/impl/cache/TestBasicHttpAsyncCache.java | 62 ++---
.../http/impl/cache/TestBasicHttpCache.java | 62 ++---
.../cache/TestByteArrayCacheEntrySerializer.java | 76 +++---
.../http/impl/cache/TestCacheKeyGenerator.java | 64 ++---
.../http/impl/cache/TestCacheRevalidatorBase.java | 14 +-
.../client5/http/impl/cache/TestCacheSupport.java | 4 +-
.../http/impl/cache/TestCacheValidityPolicy.java | 58 ++---
.../impl/cache/TestCacheableRequestPolicy.java | 14 +-
.../cache/TestCachedHttpResponseGenerator.java | 18 +-
.../TestCachedResponseSuitabilityChecker.java | 52 ++--
.../http/impl/cache/TestCachingExecChain.java | 86 +++----
.../http/impl/cache/TestCombinedEntity.java | 4 +-
.../impl/cache/TestConditionalRequestBuilder.java | 44 ++--
.../http/impl/cache/TestFileResourceFactory.java | 6 +-
.../TestHttpByteArrayCacheEntrySerializer.java | 30 +--
.../impl/cache/TestHttpCacheJiraNumber1147.java | 8 +-
.../http/impl/cache/TestInternalCacheStorage.java | 6 +-
.../impl/cache/TestProtocolAllowedBehavior.java | 6 +-
.../impl/cache/TestProtocolRecommendations.java | 138 +++++------
.../http/impl/cache/TestProtocolRequirements.java | 268 ++++++++++-----------
.../http/impl/cache/TestRFC5861Compliance.java | 18 +-
.../impl/cache/TestResponseCacheConformance.java | 14 +-
.../http/impl/cache/TestResponseCachingPolicy.java | 170 ++++++-------
.../http/impl/cache/TestViaCacheGenerator.java | 8 +-
.../memcached/TestPrefixKeyHashingScheme.java | 6 +-
.../cache/memcached/TestSHA256HashingScheme.java | 4 +-
...estExponentialBackingOffSchedulingStrategy.java | 6 +-
.../schedule/TestImmediateSchedulingStrategy.java | 6 +-
.../http/schedule/TestConcurrentCountMap.java | 4 +-
.../apache/hc/client5/http/fluent/TestRequest.java | 8 +-
.../AbstractHttpAsyncClientAuthenticationTest.java | 26 +-
.../async/AbstractHttpAsyncFundamentalsTest.java | 14 +-
.../async/AbstractHttpAsyncRedirectsTest.java | 42 ++--
.../AbstractHttpReactiveFundamentalsTest.java | 4 +-
.../testing/async/AbstractIntegrationTestBase.java | 2 +-
.../testing/async/HttpIntegrationTests.java | 66 ++---
.../testing/async/HttpMinimalIntegrationTests.java | 18 +-
.../testing/async/ReactiveIntegrationTests.java | 18 +-
.../async/ReactiveMinimalIntegrationTests.java | 18 +-
.../hc/client5/testing/async/TestH2Async.java | 2 +-
.../client5/testing/async/TestH2AsyncMinimal.java | 2 +-
.../client5/testing/async/TestH2AsyncRedirect.java | 2 +-
.../testing/async/TestH2ClientAuthentication.java | 2 +-
.../hc/client5/testing/async/TestH2Reactive.java | 2 +-
.../testing/async/TestH2ReactiveMinimal.java | 2 +-
.../hc/client5/testing/async/TestHttp1Async.java | 6 +-
.../testing/async/TestHttp1AsyncMinimal.java | 4 +-
.../testing/async/TestHttp1AsyncRedirects.java | 8 +-
.../TestHttp1AsyncStatefulConnManagement.java | 10 +-
.../async/TestHttp1ClientAuthentication.java | 4 +-
.../client5/testing/async/TestHttp1Reactive.java | 2 +-
.../testing/async/TestHttp1ReactiveMinimal.java | 4 +-
.../testing/async/TestHttp1RequestReExecution.java | 8 +-
.../async/TestHttpAsyncMinimalTlsHandshake.java | 6 +-
.../testing/async/TestHttpAsyncProtocolPolicy.java | 4 +-
.../extension/async/TestAsyncResources.java | 2 +-
.../extension/sync/TestClientResources.java | 2 +-
.../hc/client5/testing/fluent/TestFluent.java | 22 +-
.../testing/sync/AbstractIntegrationTestBase.java | 2 +-
.../client5/testing/sync/HttpIntegrationTests.java | 34 +--
.../testing/sync/HttpMinimalIntegrationTests.java | 10 +-
.../testing/sync/TestBasicConnectionManager.java | 6 +-
.../testing/sync/TestClientAuthentication.java | 44 ++--
.../testing/sync/TestClientRequestExecution.java | 14 +-
.../testing/sync/TestConnectionManagement.java | 12 +-
.../client5/testing/sync/TestConnectionReuse.java | 16 +-
.../client5/testing/sync/TestContentCodings.java | 26 +-
.../testing/sync/TestCookieVirtualHost.java | 6 +-
.../testing/sync/TestDefaultClientTlsStrategy.java | 26 +-
.../sync/TestFutureRequestExecutionService.java | 18 +-
.../sync/TestHttpClientBuilderInterceptors.java | 6 +-
.../testing/sync/TestIdleConnectionEviction.java | 4 +-
.../testing/sync/TestMalformedServerResponse.java | 6 +-
.../sync/TestMinimalClientRequestExecution.java | 8 +-
.../hc/client5/testing/sync/TestRedirects.java | 40 +--
.../testing/sync/TestStatefulConnManagement.java | 8 +-
.../client5/http/ConnectExceptionSupportTest.java | 18 +-
.../client5/http/SystemDefaultDnsResolverTest.java | 2 +-
.../org/apache/hc/client5/http/TestHttpRoute.java | 24 +-
.../async/methods/TestSimpleMessageBuilders.java | 14 +-
.../hc/client5/http/auth/TestAuthChallenge.java | 6 +-
.../apache/hc/client5/http/auth/TestAuthScope.java | 18 +-
.../hc/client5/http/auth/TestCredentials.java | 24 +-
.../http/classic/methods/TestHttpOptions.java | 4 +-
.../http/classic/methods/TestHttpRequestBase.java | 38 +--
.../http/classic/methods/TestHttpTrace.java | 4 +-
.../hc/client5/http/config/TestRequestConfig.java | 8 +-
.../hc/client5/http/cookie/TestCookieOrigin.java | 14 +-
.../http/cookie/TestCookiePathComparator.java | 14 +-
.../http/cookie/TestCookiePriorityComparator.java | 16 +-
.../apache/hc/client5/http/entity/TestBrotli.java | 4 +-
.../http/entity/TestDecompressingEntity.java | 8 +-
.../apache/hc/client5/http/entity/TestDeflate.java | 4 +-
.../hc/client5/http/entity/TestEntityBuilder.java | 20 +-
.../apache/hc/client5/http/entity/TestGZip.java | 10 +-
.../client5/http/entity/mime/FormBodyPartTest.java | 4 +-
.../http/entity/mime/HttpRFC7578MultipartTest.java | 4 +-
.../http/entity/mime/TestFormBodyPartBuilder.java | 8 +-
.../hc/client5/http/entity/mime/TestMimeField.java | 4 +-
.../http/entity/mime/TestMultipartContentBody.java | 6 +-
.../entity/mime/TestMultipartEntityBuilder.java | 30 +--
.../http/entity/mime/TestMultipartForm.java | 20 +-
.../entity/mime/TestMultipartFormHttpEntity.java | 10 +-
.../http/entity/mime/TestMultipartFormat.java | 6 +-
.../http/entity/mime/TestMultipartMixed.java | 18 +-
.../http/entity/mime/TestMultipartPartBuilder.java | 8 +-
.../examples/AsyncClientFullDuplexExchange.java | 2 +-
.../examples/AsyncClientH2FullDuplexExchange.java | 2 +-
.../http/examples/AsyncClientH2ServerPush.java | 10 +-
.../examples/AsyncClientHttpExchangeStreaming.java | 6 +-
.../http/examples/AsyncClientInterceptors.java | 2 +-
.../client5/http/examples/ClientInterceptors.java | 2 +-
.../hc/client5/http/impl/ExecSupportTest.java | 4 +-
.../client5/http/impl/InMemoryDnsResolverTest.java | 2 +-
.../http/impl/PrefixedIncrementingIdTest.java | 4 +-
.../http/impl/TestAuthenticationStrategy.java | 10 +-
.../impl/TestDefaultConnKeepAliveStrategy.java | 12 +-
.../impl/TestDefaultHttpRequestRetryStrategy.java | 30 +--
.../http/impl/TestDefaultRedirectStrategy.java | 40 +--
.../http/impl/TestIdleConnectionEvictor.java | 6 +-
.../http/impl/TestProtocolSwitchStrategy.java | 8 +-
.../hc/client5/http/impl/TestRequestSupport.java | 4 +-
.../http/impl/auth/TestAuthChallengeParser.java | 44 ++--
.../client5/http/impl/auth/TestBasicAuthCache.java | 8 +-
.../hc/client5/http/impl/auth/TestBasicScheme.java | 24 +-
.../client5/http/impl/auth/TestBearerScheme.java | 8 +-
.../http/impl/auth/TestCredentialsProviders.java | 24 +-
.../client5/http/impl/auth/TestDigestScheme.java | 64 ++---
.../http/impl/auth/TestHttpAuthenticator.java | 48 ++--
.../client5/http/impl/auth/TestNTLMEngineImpl.java | 29 ++-
.../hc/client5/http/impl/auth/TestNTLMScheme.java | 4 +-
.../auth/TestSystemDefaultCredentialsProvider.java | 6 +-
.../http/impl/classic/TestAIMDBackoffManager.java | 30 +--
.../TestAbstractHttpClientResponseHandler.java | 8 +-
.../impl/classic/TestBasicResponseHandler.java | 6 +-
.../http/impl/classic/TestCloseableHttpClient.java | 16 +-
.../client5/http/impl/classic/TestConnectExec.java | 22 +-
.../impl/classic/TestContentCompressionExec.java | 24 +-
.../impl/classic/TestCookieIdentityComparator.java | 12 +-
.../impl/classic/TestDefaultBackoffStrategy.java | 16 +-
.../classic/TestExponentialBackoffManager.java | 22 +-
.../impl/classic/TestHttpAsyncClientBuilder.java | 10 +-
.../http/impl/classic/TestHttpClientBuilder.java | 6 +-
.../impl/classic/TestHttpRequestRetryExec.java | 22 +-
.../http/impl/classic/TestInternalExecRuntime.java | 24 +-
.../http/impl/classic/TestInternalHttpClient.java | 18 +-
.../impl/classic/TestLinearBackoffManager.java | 20 +-
.../http/impl/classic/TestMainClientExec.java | 24 +-
.../http/impl/classic/TestNullBackoffStrategy.java | 8 +-
.../http/impl/classic/TestProtocolExec.java | 18 +-
.../http/impl/classic/TestRedirectExec.java | 22 +-
.../http/impl/classic/TestResponseEntityProxy.java | 10 +-
.../impl/classic/TestResponseEntityWrapper.java | 18 +-
.../http/impl/cookie/TestBasicClientCookie.java | 8 +-
.../impl/cookie/TestBasicCookieAttribHandlers.java | 66 ++---
.../http/impl/cookie/TestBasicCookieStore.java | 8 +-
.../impl/cookie/TestLaxCookieAttribHandlers.java | 66 ++---
.../impl/cookie/TestPublicSuffixListParser.java | 10 +-
.../http/impl/cookie/TestRFC6265CookieSpec.java | 36 +--
.../io/TestBasicHttpClientConnectionManager.java | 34 +--
.../impl/io/TestHttpClientConnectionOperator.java | 22 +-
.../io/TestPoolingHttpClientConnectionManager.java | 28 +--
.../impl/routing/TestDefaultProxyRoutePlanner.java | 8 +-
.../http/impl/routing/TestDefaultRoutePlanner.java | 16 +-
.../http/impl/routing/TestRouteDirector.java | 16 +-
.../http/impl/routing/TestRouteTracker.java | 18 +-
.../http/impl/routing/TestRoutingSupport.java | 8 +-
.../routing/TestSystemDefaultRoutePlanner.java | 10 +-
.../http/protocol/TestRedirectLocation.java | 4 +-
.../http/protocol/TestRequestAddCookies.java | 36 +--
.../protocol/TestRequestClientConnControl.java | 14 +-
.../http/protocol/TestRequestDefaultHeaders.java | 8 +-
.../http/protocol/TestRequestExpectContinue.java | 14 +-
.../http/protocol/TestResponseProcessCookies.java | 16 +-
.../http/psl/TestPublicSuffixListParser.java | 6 +-
.../client5/http/psl/TestPublicSuffixMatcher.java | 14 +-
.../client5/http/ssl/CertificatesToPlayWith.java | 2 +-
.../http/ssl/TestDefaultHostnameVerifier.java | 32 +--
.../http/ssl/TestDistinguishedNameParser.java | 24 +-
.../apache/hc/client5/http/utils/TestBase64.java | 2 +-
.../client5/http/utils/TestByteArrayBuilder.java | 18 +-
.../hc/client5/http/utils/TestDateUtils.java | 16 +-
.../apache/hc/client5/http/utils/TestDnsUtils.java | 4 +-
.../apache/hc/client5/http/utils/TestURIUtils.java | 16 +-
.../apache/hc/client5/http/validator/TestETag.java | 10 +-
193 files changed, 1873 insertions(+), 1884 deletions(-)
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/cache/TestHttpCacheEntry.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/cache/TestHttpCacheEntry.java
index 52036fa20..b5d9f559c 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/cache/TestHttpCacheEntry.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/cache/TestHttpCacheEntry.java
@@ -56,7 +56,7 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class TestHttpCacheEntry {
+class TestHttpCacheEntry {
private Instant now;
private Instant elevenSecondsAgo;
@@ -65,7 +65,7 @@ public class TestHttpCacheEntry {
private HttpCacheEntry entry;
@BeforeEach
- public void setUp() {
+ void setUp() {
now = Instant.now();
elevenSecondsAgo = now.minusSeconds(11);
nineSecondsAgo = now.minusSeconds(9);
@@ -99,7 +99,7 @@ public class TestHttpCacheEntry {
}
@Test
- public void testGetHeadersReturnsCorrectHeaders() {
+ void testGetHeadersReturnsCorrectHeaders() {
entry = makeEntry(
new BasicHeader("bar", "barValue1"),
new BasicHeader("bar", "barValue2"));
@@ -107,7 +107,7 @@ public class TestHttpCacheEntry {
}
@Test
- public void testGetFirstHeaderReturnsCorrectHeader() {
+ void testGetFirstHeaderReturnsCorrectHeader() {
entry = makeEntry(
new BasicHeader("bar", "barValue1"),
new BasicHeader("bar", "barValue2"));
@@ -115,7 +115,7 @@ public class TestHttpCacheEntry {
}
@Test
- public void testGetHeadersReturnsEmptyArrayIfNoneMatch() {
+ void testGetHeadersReturnsEmptyArrayIfNoneMatch() {
entry = makeEntry(
new BasicHeader("foo", "fooValue"),
new BasicHeader("bar", "barValue1"),
@@ -124,7 +124,7 @@ public class TestHttpCacheEntry {
}
@Test
- public void testGetFirstHeaderReturnsNullIfNoneMatch() {
+ void testGetFirstHeaderReturnsNullIfNoneMatch() {
entry = makeEntry(
new BasicHeader("foo", "fooValue"),
new BasicHeader("bar", "barValue1"),
@@ -133,7 +133,7 @@ public class TestHttpCacheEntry {
}
@Test
- public void testGetMethodReturnsCorrectRequestMethod() {
+ void testGetMethodReturnsCorrectRequestMethod() {
entry = makeEntry(
new BasicHeader("foo", "fooValue"),
new BasicHeader("bar", "barValue1"),
@@ -142,33 +142,33 @@ public class TestHttpCacheEntry {
}
@Test
- public void statusCodeComesFromOriginalStatusLine() {
+ void statusCodeComesFromOriginalStatusLine() {
entry = makeEntry(Instant.now(), Instant.now(), HttpStatus.SC_OK);
assertEquals(HttpStatus.SC_OK, entry.getStatus());
}
@Test
- public void canGetOriginalRequestDate() {
+ void canGetOriginalRequestDate() {
final Instant requestDate = Instant.now();
entry = makeEntry(requestDate, Instant.now(), HttpStatus.SC_OK);
assertEquals(requestDate, entry.getRequestInstant());
}
@Test
- public void canGetOriginalResponseDate() {
+ void canGetOriginalResponseDate() {
final Instant responseDate = Instant.now();
entry = makeEntry(Instant.now(), responseDate, HttpStatus.SC_OK);
assertEquals(responseDate, entry.getResponseInstant());
}
@Test
- public void canGetOriginalResource() {
+ void canGetOriginalResource() {
entry = makeEntry(Instant.now(), Instant.now(), HttpStatus.SC_OK);
assertSame(mockResource, entry.getResource());
}
@Test
- public void canGetOriginalHeaders() {
+ void canGetOriginalHeaders() {
final Header[] headers = {
new BasicHeader("Server", "MockServer/1.0"),
new BasicHeader("Date", DateUtils.formatStandardDate(now))
@@ -182,7 +182,7 @@ public class TestHttpCacheEntry {
}
@Test
- public void canRetrieveOriginalVariantMap() {
+ void canRetrieveOriginalVariantMap() {
final Set<String> variants = new HashSet<>();
variants.add("A");
variants.add("B");
@@ -199,7 +199,7 @@ public class TestHttpCacheEntry {
}
@Test
- public void retrievedVariantMapIsNotModifiable() {
+ void retrievedVariantMapIsNotModifiable() {
final Set<String> variants = new HashSet<>();
variants.add("A");
variants.add("B");
@@ -213,27 +213,27 @@ public class TestHttpCacheEntry {
}
@Test
- public void canConvertToString() {
+ void canConvertToString() {
entry = makeEntry(Instant.now(), Instant.now(), HttpStatus.SC_OK);
assertNotNull(entry.toString());
assertNotEquals("", entry.toString());
}
@Test
- public void testMissingDateHeaderIsIgnored() {
+ void testMissingDateHeaderIsIgnored() {
entry = makeEntry(Instant.now(), Instant.now(), HttpStatus.SC_OK);
assertNull(entry.getInstant());
}
@Test
- public void testMalformedDateHeaderIsIgnored() {
+ void testMalformedDateHeaderIsIgnored() {
entry = makeEntry(Instant.now(), Instant.now(), HttpStatus.SC_OK,
new BasicHeader("Date", "asdf"));
assertNull(entry.getInstant());
}
@Test
- public void testValidDateHeaderIsParsed() {
+ void testValidDateHeaderIsParsed() {
final Instant date = Instant.now().with(ChronoField.MILLI_OF_SECOND, 0);
entry = makeEntry(Instant.now(), Instant.now(), HttpStatus.SC_OK,
new BasicHeader("Date", DateUtils.formatStandardDate(date)));
@@ -243,7 +243,7 @@ public class TestHttpCacheEntry {
}
@Test
- public void testEpochDateHeaderIsParsed() {
+ void testEpochDateHeaderIsParsed() {
entry = makeEntry(Instant.now(), Instant.now(), HttpStatus.SC_OK,
new BasicHeader("Date", DateUtils.formatStandardDate(Instant.EPOCH)));
final Instant dateHeaderValue = entry.getInstant();
@@ -252,7 +252,7 @@ public class TestHttpCacheEntry {
}
@Test
- public void testDateParsedOnce() {
+ void testDateParsedOnce() {
final Instant date = Instant.now().with(ChronoField.MILLI_OF_SECOND, 0);
entry = makeEntry(Instant.now(), Instant.now(), HttpStatus.SC_OK,
new BasicHeader("Date", DateUtils.formatStandardDate(date)));
@@ -263,7 +263,7 @@ public class TestHttpCacheEntry {
}
@Test
- public void testExpiresParsedOnce() {
+ void testExpiresParsedOnce() {
final Instant date = Instant.now().with(ChronoField.MILLI_OF_SECOND, 0);
entry = makeEntry(Instant.now(), Instant.now(), HttpStatus.SC_OK,
new BasicHeader("Last-Modified", DateUtils.formatStandardDate(date)));
@@ -278,7 +278,7 @@ public class TestHttpCacheEntry {
}
@Test
- public void testIsCacheEntryNewer() throws Exception {
+ void testIsCacheEntryNewer() {
assertFalse(HttpCacheEntry.isNewer(null, null));
entry = makeEntry();
final HeaderGroup message = new HeaderGroup();
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/cache/TestHttpCacheEntryFactory.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/cache/TestHttpCacheEntryFactory.java
index 2f1bdcb71..46092c24d 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/cache/TestHttpCacheEntryFactory.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/cache/TestHttpCacheEntryFactory.java
@@ -52,7 +52,7 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class TestHttpCacheEntryFactory {
+class TestHttpCacheEntryFactory {
private Instant requestDate;
private Instant responseDate;
@@ -69,7 +69,7 @@ public class TestHttpCacheEntryFactory {
private HttpCacheEntryFactory impl;
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() {
requestDate = Instant.now().minusSeconds(1);
responseDate = Instant.now();
@@ -87,7 +87,7 @@ public class TestHttpCacheEntryFactory {
}
@Test
- public void testFilterHopByHopAndConnectionSpecificHeaders() {
+ void testFilterHopByHopAndConnectionSpecificHeaders() {
response.setHeaders(
new BasicHeader(HttpHeaders.CONNECTION, "blah, blah, this, that"),
new BasicHeader("Blah", "huh?"),
@@ -106,7 +106,7 @@ public class TestHttpCacheEntryFactory {
}
@Test
- public void testHeadersAreMergedCorrectly() {
+ void testHeadersAreMergedCorrectly() {
entry = HttpTestUtils.makeCacheEntry(
new BasicHeader("Date", DateUtils.formatStandardDate(responseDate)),
new BasicHeader("ETag", "\"etag\""));
@@ -118,7 +118,7 @@ public class TestHttpCacheEntryFactory {
}
@Test
- public void testNewerHeadersReplaceExistingHeaders() {
+ void testNewerHeadersReplaceExistingHeaders() {
entry = HttpTestUtils.makeCacheEntry(
new BasicHeader("Date", DateUtils.formatStandardDate(requestDate)),
new BasicHeader("Cache-Control", "private"),
@@ -139,7 +139,7 @@ public class TestHttpCacheEntryFactory {
}
@Test
- public void testNewHeadersAreAddedByMerge() {
+ void testNewHeadersAreAddedByMerge() {
entry = HttpTestUtils.makeCacheEntry(
new BasicHeader("Date", DateUtils.formatStandardDate(requestDate)),
new BasicHeader("ETag", "\"etag\""));
@@ -156,7 +156,7 @@ public class TestHttpCacheEntryFactory {
}
@Test
- public void entryWithMalformedDateIsStillUpdated() throws Exception {
+ void entryWithMalformedDateIsStillUpdated() {
entry = HttpTestUtils.makeCacheEntry(tenSecondsAgo, eightSecondsAgo,
new BasicHeader("ETag", "\"old\""),
new BasicHeader("Date", "bad-date"));
@@ -169,7 +169,7 @@ public class TestHttpCacheEntryFactory {
}
@Test
- public void entryIsStillUpdatedByResponseWithMalformedDate() throws Exception {
+ void entryIsStillUpdatedByResponseWithMalformedDate() {
entry = HttpTestUtils.makeCacheEntry(tenSecondsAgo, eightSecondsAgo,
new BasicHeader("ETag", "\"old\""),
new BasicHeader("Date", DateUtils.formatStandardDate(tenSecondsAgo)));
@@ -182,14 +182,14 @@ public class TestHttpCacheEntryFactory {
}
@Test
- public void testUpdateCacheEntryReturnsDifferentEntryInstance() {
+ void testUpdateCacheEntryReturnsDifferentEntryInstance() {
entry = HttpTestUtils.makeCacheEntry();
final HttpCacheEntry newEntry = impl.createUpdated(requestDate, responseDate, host, request, response, entry);
Assertions.assertNotSame(newEntry, entry);
}
@Test
- public void testCreateRootVariantEntry() {
+ void testCreateRootVariantEntry() {
request.setHeaders(
new BasicHeader("Keep-Alive", "timeout, max=20"),
new BasicHeader("X-custom", "my stuff"),
@@ -241,7 +241,7 @@ public class TestHttpCacheEntryFactory {
}
@Test
- public void testCreateResourceEntry() {
+ void testCreateResourceEntry() {
request.setHeaders(
new BasicHeader("Keep-Alive", "timeout, max=20"),
new BasicHeader("X-custom", "my stuff"),
@@ -285,7 +285,7 @@ public class TestHttpCacheEntryFactory {
}
@Test
- public void testCreateUpdatedResourceEntry() {
+ void testCreateUpdatedResourceEntry() {
final Resource resource = HttpTestUtils.makeRandomResource(128);
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(
tenSecondsAgo,
@@ -347,7 +347,7 @@ public class TestHttpCacheEntryFactory {
}
@Test
- public void testUpdateNotModifiedIfResponseOlder() {
+ void testUpdateNotModifiedIfResponseOlder() {
entry = HttpTestUtils.makeCacheEntry(twoSecondsAgo, now,
new BasicHeader("Date", DateUtils.formatStandardDate(oneSecondAgo)),
new BasicHeader("ETag", "\"new-etag\""));
@@ -360,7 +360,7 @@ public class TestHttpCacheEntryFactory {
}
@Test
- public void testUpdateHasLatestRequestAndResponseDates() {
+ void testUpdateHasLatestRequestAndResponseDates() {
entry = HttpTestUtils.makeCacheEntry(tenSecondsAgo, eightSecondsAgo);
final HttpCacheEntry updated = impl.createUpdated(twoSecondsAgo, oneSecondAgo, host, request, response, entry);
@@ -369,7 +369,7 @@ public class TestHttpCacheEntryFactory {
}
@Test
- public void cannotUpdateFromANon304OriginResponse() throws Exception {
+ void cannotUpdateFromANon304OriginResponse() {
entry = HttpTestUtils.makeCacheEntry();
response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
Assertions.assertThrows(IllegalArgumentException.class, () ->
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/CacheControlGeneratorTest.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/CacheControlGeneratorTest.java
index 0efa6dad3..058ecd89d 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/CacheControlGeneratorTest.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/CacheControlGeneratorTest.java
@@ -33,12 +33,12 @@ import org.apache.hc.client5.http.cache.RequestCacheControl;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class CacheControlGeneratorTest {
+class CacheControlGeneratorTest {
private final CacheControlHeaderGenerator generator = CacheControlHeaderGenerator.INSTANCE;
@Test
- public void testGenerateRequestCacheControlHeader() {
+ void testGenerateRequestCacheControlHeader() {
assertThat(generator.generate(
RequestCacheControl.builder()
.setMaxAge(12)
@@ -77,7 +77,7 @@ public class CacheControlGeneratorTest {
}
@Test
- public void testGenerateRequestCacheControlHeaderNoDirectives() {
+ void testGenerateRequestCacheControlHeaderNoDirectives() {
final RequestCacheControl cacheControl = RequestCacheControl.builder()
.build();
Assertions.assertNull(generator.generate(cacheControl));
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/CacheControlParserTest.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/CacheControlParserTest.java
index 640402ecb..d4ad63919 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/CacheControlParserTest.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/CacheControlParserTest.java
@@ -40,74 +40,74 @@ import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.message.BasicHeader;
import org.junit.jupiter.api.Test;
-public class CacheControlParserTest {
+class CacheControlParserTest {
private final CacheControlHeaderParser parser = CacheControlHeaderParser.INSTANCE;
@Test
- public void testParseMaxAgeZero() {
+ void testParseMaxAgeZero() {
final Header header = new BasicHeader("Cache-Control", "max-age=0 , this = stuff;");
final ResponseCacheControl cacheControl = parser.parseResponse(Collections.singletonList(header).iterator());
assertEquals(0L, cacheControl.getMaxAge());
}
@Test
- public void testParseSMaxAge() {
+ void testParseSMaxAge() {
final Header header = new BasicHeader("Cache-Control", "s-maxage=3600");
final ResponseCacheControl cacheControl = parser.parseResponse(Collections.singletonList(header).iterator());
assertEquals(3600L, cacheControl.getSharedMaxAge());
}
@Test
- public void testParseInvalidCacheValue() {
+ void testParseInvalidCacheValue() {
final Header header = new BasicHeader("Cache-Control", "max-age=invalid");
final ResponseCacheControl cacheControl = parser.parseResponse(Collections.singletonList(header).iterator());
assertEquals(0L, cacheControl.getMaxAge());
}
@Test
- public void testParseInvalidHeader() {
+ void testParseInvalidHeader() {
final Header header = new BasicHeader("Cache-Control", "max-age");
final ResponseCacheControl cacheControl = parser.parseResponse(Collections.singletonList(header).iterator());
assertEquals(-1L, cacheControl.getMaxAge());
}
@Test
- public void testParseNullHeader() {
+ void testParseNullHeader() {
final Header header = null;
assertThrows(NullPointerException.class, () -> parser.parseResponse(Collections.singletonList(header).iterator()));
}
@Test
- public void testParseEmptyHeader() {
+ void testParseEmptyHeader() {
final Header header = new BasicHeader("Cache-Control", "");
final ResponseCacheControl cacheControl = parser.parseResponse(Collections.singletonList(header).iterator());
assertEquals(-1L, cacheControl.getMaxAge());
}
@Test
- public void testParseCookieEmptyValue() {
+ void testParseCookieEmptyValue() {
final Header header = new BasicHeader("Cache-Control", "max-age=,");
final ResponseCacheControl cacheControl = parser.parseResponse(Collections.singletonList(header).iterator());
assertEquals(-1L, cacheControl.getMaxAge());
}
@Test
- public void testParseNoCache() {
+ void testParseNoCache() {
final Header header = new BasicHeader(" Cache-Control", "no-cache");
final ResponseCacheControl cacheControl = parser.parseResponse(Collections.singletonList(header).iterator());
assertEquals(-1L, cacheControl.getMaxAge());
}
@Test
- public void testParseNoDirective() {
+ void testParseNoDirective() {
final Header header = new BasicHeader(" Cache-Control", "");
final ResponseCacheControl cacheControl = parser.parseResponse(Collections.singletonList(header).iterator());
assertEquals(-1L, cacheControl.getMaxAge());
}
@Test
- public void testGarbage() {
+ void testGarbage() {
final Header header = new BasicHeader("Cache-Control", ",,= blah,");
final ResponseCacheControl cacheControl = parser.parseResponse(Collections.singletonList(header).iterator());
assertEquals(-1L, cacheControl.getMaxAge());
@@ -115,7 +115,7 @@ public class CacheControlParserTest {
@Test
- public void testParseMultipleDirectives() {
+ void testParseMultipleDirectives() {
final Header header = new BasicHeader("Cache-Control", "max-age=604800, stale-while-revalidate=86400, s-maxage=3600, must-revalidate, private");
final ResponseCacheControl cacheControl = parser.parseResponse(Collections.singletonList(header).iterator());
@@ -128,7 +128,7 @@ public class CacheControlParserTest {
}
@Test
- public void testParseMultipleDirectives2() {
+ void testParseMultipleDirectives2() {
final Header header = new BasicHeader("Cache-Control", "max-age=604800, stale-while-revalidate=86400, must-revalidate, private, s-maxage=3600");
final ResponseCacheControl cacheControl = parser.parseResponse(Collections.singletonList(header).iterator());
@@ -141,7 +141,7 @@ public class CacheControlParserTest {
}
@Test
- public void testParsePublic() {
+ void testParsePublic() {
final Header header = new BasicHeader("Cache-Control", "public");
final ResponseCacheControl cacheControl = parser.parseResponse(Collections.singletonList(header).iterator());
@@ -149,7 +149,7 @@ public class CacheControlParserTest {
}
@Test
- public void testParsePrivate() {
+ void testParsePrivate() {
final Header header = new BasicHeader("Cache-Control", "private");
final ResponseCacheControl cacheControl = parser.parseResponse(Collections.singletonList(header).iterator());
@@ -157,7 +157,7 @@ public class CacheControlParserTest {
}
@Test
- public void testParseNoStore() {
+ void testParseNoStore() {
final Header header = new BasicHeader("Cache-Control", "no-store");
final ResponseCacheControl cacheControl = parser.parseResponse(Collections.singletonList(header).iterator());
@@ -165,7 +165,7 @@ public class CacheControlParserTest {
}
@Test
- public void testParseStaleWhileRevalidate() {
+ void testParseStaleWhileRevalidate() {
final Header header = new BasicHeader("Cache-Control", "max-age=3600, stale-while-revalidate=120");
final ResponseCacheControl cacheControl = parser.parseResponse(Collections.singletonList(header).iterator());
@@ -173,7 +173,7 @@ public class CacheControlParserTest {
}
@Test
- public void testParseNoCacheFields() {
+ void testParseNoCacheFields() {
final Header header = new BasicHeader("Cache-Control", "no-cache=\"Set-Cookie, Content-Language\", stale-while-revalidate=120");
final ResponseCacheControl cacheControl = parser.parseResponse(Collections.singletonList(header).iterator());
@@ -185,7 +185,7 @@ public class CacheControlParserTest {
}
@Test
- public void testParseNoCacheFieldsNoQuote() {
+ void testParseNoCacheFieldsNoQuote() {
final Header header = new BasicHeader("Cache-Control", "no-cache=Set-Cookie, Content-Language, stale-while-revalidate=120");
final ResponseCacheControl cacheControl = parser.parseResponse(Collections.singletonList(header).iterator());
@@ -196,7 +196,7 @@ public class CacheControlParserTest {
}
@Test
- public void testParseNoCacheFieldsMessy() {
+ void testParseNoCacheFieldsMessy() {
final Header header = new BasicHeader("Cache-Control", "no-cache=\" , , ,,, Set-Cookie , , Content-Language , \", stale-while-revalidate=120");
final ResponseCacheControl cacheControl = parser.parseResponse(Collections.singletonList(header).iterator());
@@ -209,7 +209,7 @@ public class CacheControlParserTest {
@Test
- public void testParseMultipleHeaders() {
+ void testParseMultipleHeaders() {
// Create headers
final Header header1 = new BasicHeader("Cache-Control", "max-age=3600, no-store");
final Header header2 = new BasicHeader("Cache-Control", "private, must-revalidate");
@@ -230,7 +230,7 @@ public class CacheControlParserTest {
}
@Test
- public void testParseRequestMultipleDirectives() {
+ void testParseRequestMultipleDirectives() {
final Header header = new BasicHeader("Cache-Control", "blah, max-age=1111, max-stale=2222, " +
"min-fresh=3333, no-cache, no-store, no-cache, no-stuff, only-if-cached, only-if-cached-or-maybe-not");
final RequestCacheControl cacheControl = parser.parseRequest(Collections.singletonList(header).iterator());
@@ -246,14 +246,14 @@ public class CacheControlParserTest {
}
@Test
- public void testParseIsImmutable() {
+ void testParseIsImmutable() {
final Header header = new BasicHeader("Cache-Control", "max-age=0 , immutable");
final ResponseCacheControl cacheControl = parser.parseResponse(Collections.singletonList(header).iterator());
assertTrue(cacheControl.isImmutable());
}
@Test
- public void testParseMultipleIsImmutable() {
+ void testParseMultipleIsImmutable() {
final Header header = new BasicHeader("Cache-Control", "immutable, nmax-age=0 , immutable");
final ResponseCacheControl cacheControl = parser.parseResponse(Collections.singletonList(header).iterator());
assertTrue(cacheControl.isImmutable());
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/ConsumableInputStream.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/ConsumableInputStream.java
index a6de12aa0..1cd8c3490 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/ConsumableInputStream.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/ConsumableInputStream.java
@@ -42,7 +42,7 @@ public class ConsumableInputStream extends InputStream {
}
@Override
- public int read() throws IOException {
+ public int read() {
return buf.read();
}
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/SimpleHttpCacheStorage.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/SimpleHttpCacheStorage.java
index 8dcfad757..0b51b730f 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/SimpleHttpCacheStorage.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/SimpleHttpCacheStorage.java
@@ -44,17 +44,17 @@ class SimpleHttpCacheStorage implements HttpCacheStorage {
}
@Override
- public void putEntry(final String key, final HttpCacheEntry entry) throws ResourceIOException {
+ public void putEntry(final String key, final HttpCacheEntry entry) {
map.put(key, entry);
}
@Override
- public HttpCacheEntry getEntry(final String key) throws ResourceIOException {
+ public HttpCacheEntry getEntry(final String key) {
return map.get(key);
}
@Override
- public void removeEntry(final String key) throws ResourceIOException {
+ public void removeEntry(final String key) {
map.remove(key);
}
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestAbstractSerializingAsyncCacheStorage.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestAbstractSerializingAsyncCacheStorage.java
index aefbe66ea..56891428d 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestAbstractSerializingAsyncCacheStorage.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestAbstractSerializingAsyncCacheStorage.java
@@ -54,7 +54,7 @@ import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.stubbing.Answer;
-public class TestAbstractSerializingAsyncCacheStorage {
+class TestAbstractSerializingAsyncCacheStorage {
@Mock
private Cancellable cancellable;
@@ -80,7 +80,7 @@ public class TestAbstractSerializingAsyncCacheStorage {
}
@Test
- public void testCachePut() throws Exception {
+ void testCachePut() throws Exception {
final String key = "foo";
final HttpCacheEntry value = HttpTestUtils.makeCacheEntry();
@@ -103,7 +103,7 @@ public class TestAbstractSerializingAsyncCacheStorage {
}
@Test
- public void testCacheGetNullEntry() throws Exception {
+ void testCacheGetNullEntry() {
final String key = "foo";
Mockito.when(impl.digestToStorageKey(key)).thenReturn("bar");
@@ -121,7 +121,7 @@ public class TestAbstractSerializingAsyncCacheStorage {
}
@Test
- public void testCacheGet() throws Exception {
+ void testCacheGet() {
final String key = "foo";
final HttpCacheEntry value = HttpTestUtils.makeCacheEntry();
@@ -141,7 +141,7 @@ public class TestAbstractSerializingAsyncCacheStorage {
}
@Test
- public void testCacheGetKeyMismatch() throws Exception {
+ void testCacheGetKeyMismatch() {
final String key = "foo";
final HttpCacheEntry value = HttpTestUtils.makeCacheEntry();
Mockito.when(impl.digestToStorageKey(key)).thenReturn("bar");
@@ -159,7 +159,7 @@ public class TestAbstractSerializingAsyncCacheStorage {
}
@Test
- public void testCacheRemove() throws Exception{
+ void testCacheRemove() {
final String key = "foo";
Mockito.when(impl.digestToStorageKey(key)).thenReturn("bar");
@@ -177,7 +177,7 @@ public class TestAbstractSerializingAsyncCacheStorage {
}
@Test
- public void testCacheUpdateNullEntry() throws Exception {
+ void testCacheUpdateNullEntry() {
final String key = "foo";
final HttpCacheEntry updatedValue = HttpTestUtils.makeCacheEntry();
@@ -207,7 +207,7 @@ public class TestAbstractSerializingAsyncCacheStorage {
}
@Test
- public void testCacheCASUpdate() throws Exception {
+ void testCacheCASUpdate() throws Exception {
final String key = "foo";
final HttpCacheEntry existingValue = HttpTestUtils.makeCacheEntry();
final HttpCacheEntry updatedValue = HttpTestUtils.makeCacheEntry();
@@ -238,7 +238,7 @@ public class TestAbstractSerializingAsyncCacheStorage {
}
@Test
- public void testCacheCASUpdateKeyMismatch() throws Exception {
+ void testCacheCASUpdateKeyMismatch() throws Exception {
final String key = "foo";
final HttpCacheEntry existingValue = HttpTestUtils.makeCacheEntry();
final HttpCacheEntry updatedValue = HttpTestUtils.makeCacheEntry();
@@ -274,7 +274,7 @@ public class TestAbstractSerializingAsyncCacheStorage {
}
@Test
- public void testSingleCacheUpdateRetry() throws Exception {
+ void testSingleCacheUpdateRetry() throws Exception {
final String key = "foo";
final HttpCacheEntry existingValue = HttpTestUtils.makeCacheEntry();
final HttpCacheEntry updatedValue = HttpTestUtils.makeCacheEntry();
@@ -312,7 +312,7 @@ public class TestAbstractSerializingAsyncCacheStorage {
}
@Test
- public void testCacheUpdateFail() throws Exception {
+ void testCacheUpdateFail() throws Exception {
final String key = "foo";
final HttpCacheEntry existingValue = HttpTestUtils.makeCacheEntry();
final HttpCacheEntry updatedValue = HttpTestUtils.makeCacheEntry();
@@ -351,7 +351,7 @@ public class TestAbstractSerializingAsyncCacheStorage {
@Test
@SuppressWarnings("unchecked")
- public void testBulkGet() throws Exception {
+ void testBulkGet() {
final String key1 = "foo this";
final String key2 = "foo that";
final String storageKey1 = "bar this";
@@ -396,7 +396,7 @@ public class TestAbstractSerializingAsyncCacheStorage {
@Test
@SuppressWarnings("unchecked")
- public void testBulkGetKeyMismatch() throws Exception {
+ void testBulkGetKeyMismatch() {
final String key1 = "foo this";
final String key2 = "foo that";
final String storageKey1 = "bar this";
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestAbstractSerializingCacheStorage.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestAbstractSerializingCacheStorage.java
index 618c7f183..7e37fd4de 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestAbstractSerializingCacheStorage.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestAbstractSerializingCacheStorage.java
@@ -51,7 +51,7 @@ import org.mockito.Mockito;
import org.mockito.stubbing.Answer;
@SuppressWarnings("boxing") // test code
-public class TestAbstractSerializingCacheStorage {
+class TestAbstractSerializingCacheStorage {
public static byte[] serialize(final String key, final HttpCacheEntry value) throws ResourceIOException {
return HttpByteArrayCacheEntrySerializer.INSTANCE.serialize(new HttpCacheStorageEntry(key, value));
@@ -67,7 +67,7 @@ public class TestAbstractSerializingCacheStorage {
}
@Test
- public void testCachePut() throws Exception {
+ void testCachePut() throws Exception {
final String key = "foo";
final HttpCacheEntry value = HttpTestUtils.makeCacheEntry();
@@ -81,7 +81,7 @@ public class TestAbstractSerializingCacheStorage {
}
@Test
- public void testCacheGetNullEntry() throws Exception {
+ void testCacheGetNullEntry() throws Exception {
final String key = "foo";
when(impl.digestToStorageKey(key)).thenReturn("bar");
@@ -95,7 +95,7 @@ public class TestAbstractSerializingCacheStorage {
}
@Test
- public void testCacheGet() throws Exception {
+ void testCacheGet() throws Exception {
final String key = "foo";
final HttpCacheEntry value = HttpTestUtils.makeCacheEntry();
@@ -110,7 +110,7 @@ public class TestAbstractSerializingCacheStorage {
}
@Test
- public void testCacheGetKeyMismatch() throws Exception {
+ void testCacheGetKeyMismatch() throws Exception {
final String key = "foo";
final HttpCacheEntry value = HttpTestUtils.makeCacheEntry();
@@ -125,7 +125,7 @@ public class TestAbstractSerializingCacheStorage {
}
@Test
- public void testCacheRemove() throws Exception{
+ void testCacheRemove() throws Exception{
final String key = "foo";
when(impl.digestToStorageKey(key)).thenReturn("bar");
@@ -135,7 +135,7 @@ public class TestAbstractSerializingCacheStorage {
}
@Test
- public void testCacheUpdateNullEntry() throws Exception {
+ void testCacheUpdateNullEntry() throws Exception {
final String key = "foo";
final HttpCacheEntry updatedValue = HttpTestUtils.makeCacheEntry();
@@ -152,7 +152,7 @@ public class TestAbstractSerializingCacheStorage {
}
@Test
- public void testCacheCASUpdate() throws Exception {
+ void testCacheCASUpdate() throws Exception {
final String key = "foo";
final HttpCacheEntry existingValue = HttpTestUtils.makeCacheEntry();
final HttpCacheEntry updatedValue = HttpTestUtils.makeCacheEntry();
@@ -170,7 +170,7 @@ public class TestAbstractSerializingCacheStorage {
}
@Test
- public void testCacheCASUpdateKeyMismatch() throws Exception {
+ void testCacheCASUpdateKeyMismatch() throws Exception {
final String key = "foo";
final HttpCacheEntry existingValue = HttpTestUtils.makeCacheEntry();
final HttpCacheEntry updatedValue = HttpTestUtils.makeCacheEntry();
@@ -191,7 +191,7 @@ public class TestAbstractSerializingCacheStorage {
}
@Test
- public void testSingleCacheUpdateRetry() throws Exception {
+ void testSingleCacheUpdateRetry() throws Exception {
final String key = "foo";
final HttpCacheEntry existingValue = HttpTestUtils.makeCacheEntry();
final HttpCacheEntry updatedValue = HttpTestUtils.makeCacheEntry();
@@ -209,7 +209,7 @@ public class TestAbstractSerializingCacheStorage {
}
@Test
- public void testCacheUpdateFail() throws Exception {
+ void testCacheUpdateFail() throws Exception {
final String key = "foo";
final HttpCacheEntry existingValue = HttpTestUtils.makeCacheEntry();
final HttpCacheEntry updatedValue = HttpTestUtils.makeCacheEntry();
@@ -228,7 +228,7 @@ public class TestAbstractSerializingCacheStorage {
}
@Test
- public void testBulkGet() throws Exception {
+ void testBulkGet() throws Exception {
final String key1 = "foo this";
final String key2 = "foo that";
final String storageKey1 = "bar this";
@@ -262,7 +262,7 @@ public class TestAbstractSerializingCacheStorage {
}
@Test
- public void testBulkGetKeyMismatch() throws Exception {
+ void testBulkGetKeyMismatch() throws Exception {
final String key1 = "foo this";
final String key2 = "foo that";
final String storageKey1 = "bar this";
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestBasicHttpAsyncCache.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestBasicHttpAsyncCache.java
index f8632e65d..068fadef2 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestBasicHttpAsyncCache.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestBasicHttpAsyncCache.java
@@ -64,7 +64,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
-public class TestBasicHttpAsyncCache {
+class TestBasicHttpAsyncCache {
private HttpHost host;
private Instant now;
@@ -73,7 +73,7 @@ public class TestBasicHttpAsyncCache {
private BasicHttpAsyncCache impl;
@BeforeEach
- public void setUp() {
+ void setUp() {
host = new HttpHost("foo.example.com");
now = Instant.now();
tenSecondsAgo = now.minusSeconds(10);
@@ -82,7 +82,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testGetCacheEntryReturnsNullOnCacheMiss() throws Exception {
+ void testGetCacheEntryReturnsNullOnCacheMiss() throws Exception {
final HttpHost host = new HttpHost("foo.example.com");
final HttpRequest request = new HttpGet("http://foo.example.com/bar");
@@ -97,7 +97,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testGetCacheEntryFetchesFromCacheOnCacheHitIfNoVariants() throws Exception {
+ void testGetCacheEntryFetchesFromCacheOnCacheHitIfNoVariants() throws Exception {
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry();
assertFalse(entry.hasVariants());
final HttpHost host = new HttpHost("foo.example.com");
@@ -121,7 +121,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testGetCacheEntryReturnsNullIfNoVariantInCache() throws Exception {
+ void testGetCacheEntryReturnsNullIfNoVariantInCache() throws Exception {
final HttpRequest origRequest = new HttpGet("http://foo.example.com/bar");
origRequest.setHeader("Accept-Encoding","gzip");
@@ -153,7 +153,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testGetCacheEntryReturnsVariantIfPresentInCache() throws Exception {
+ void testGetCacheEntryReturnsVariantIfPresentInCache() throws Exception {
final HttpRequest origRequest = new HttpGet("http://foo.example.com/bar");
origRequest.setHeader("Accept-Encoding","gzip");
@@ -186,7 +186,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testGetCacheEntryReturnsVariantWithMostRecentDateHeader() throws Exception {
+ void testGetCacheEntryReturnsVariantWithMostRecentDateHeader() throws Exception {
final HttpRequest origRequest = new HttpGet("http://foo.example.com/bar");
origRequest.setHeader("Accept-Encoding", "gzip");
@@ -237,7 +237,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testGetVariantsRootNoVariants() throws Exception {
+ void testGetVariantsRootNoVariants() throws Exception {
final HttpCacheEntry root = HttpTestUtils.makeCacheEntry();
final CountDownLatch latch1 = new CountDownLatch(1);
@@ -252,7 +252,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testGetVariantsRootNonExistentVariants() throws Exception {
+ void testGetVariantsRootNonExistentVariants() throws Exception {
final Set<String> varinats = new HashSet<>();
varinats.add("variant1");
varinats.add("variant2");
@@ -270,7 +270,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testGetVariantCacheEntriesReturnsAllVariants() throws Exception {
+ void testGetVariantCacheEntriesReturnsAllVariants() throws Exception {
final HttpHost host = new HttpHost("foo.example.com");
final URI uri = new URI("http://foo.example.com/bar");
final HttpRequest req1 = new HttpGet(uri);
@@ -332,7 +332,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testUpdateCacheEntry() throws Exception {
+ void testUpdateCacheEntry() throws Exception {
final HttpHost host = new HttpHost("foo.example.com");
final URI uri = new URI("http://foo.example.com/bar");
final HttpRequest req1 = new HttpGet(uri);
@@ -386,7 +386,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testUpdateVariantCacheEntry() throws Exception {
+ void testUpdateVariantCacheEntry() throws Exception {
final HttpHost host = new HttpHost("foo.example.com");
final URI uri = new URI("http://foo.example.com/bar");
final HttpRequest req1 = new HttpGet(uri);
@@ -443,7 +443,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testUpdateCacheEntryTurnsVariant() throws Exception {
+ void testUpdateCacheEntryTurnsVariant() throws Exception {
final HttpHost host = new HttpHost("foo.example.com");
final URI uri = new URI("http://foo.example.com/bar");
final HttpRequest req1 = new HttpGet(uri);
@@ -498,7 +498,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testStoreFromNegotiatedVariant() throws Exception {
+ void testStoreFromNegotiatedVariant() throws Exception {
final HttpHost host = new HttpHost("foo.example.com");
final URI uri = new URI("http://foo.example.com/bar");
final HttpRequest req1 = new HttpGet(uri);
@@ -552,7 +552,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testInvalidatesUnsafeRequests() throws Exception {
+ void testInvalidatesUnsafeRequests() throws Exception {
final HttpRequest request = new BasicHttpRequest("POST", "/path");
final HttpResponse response = HttpTestUtils.make200Response();
@@ -571,7 +571,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testDoesNotInvalidateSafeRequests() throws Exception {
+ void testDoesNotInvalidateSafeRequests() throws Exception {
final HttpRequest request1 = new BasicHttpRequest("GET", "/");
final HttpResponse response1 = HttpTestUtils.make200Response();
final CountDownLatch latch1 = new CountDownLatch(1);
@@ -594,7 +594,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testInvalidatesUnsafeRequestsWithVariants() throws Exception {
+ void testInvalidatesUnsafeRequestsWithVariants() throws Exception {
final HttpRequest request = new BasicHttpRequest("POST", "/path");
final String rootKey = CacheKeyGenerator.INSTANCE.generateKey(host, request);
final Set<String> variants = new HashSet<>();
@@ -625,7 +625,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testInvalidateUriSpecifiedByContentLocationAndFresher() throws Exception {
+ void testInvalidateUriSpecifiedByContentLocationAndFresher() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final String rootKey = CacheKeyGenerator.INSTANCE.generateKey(host, request);
final URI contentUri = new URIBuilder()
@@ -657,7 +657,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testInvalidateUriSpecifiedByLocationAndFresher() throws Exception {
+ void testInvalidateUriSpecifiedByLocationAndFresher() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final String rootKey = CacheKeyGenerator.INSTANCE.generateKey(host, request);
final URI contentUri = new URIBuilder()
@@ -689,7 +689,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testDoesNotInvalidateForUnsuccessfulResponse() throws Exception {
+ void testDoesNotInvalidateForUnsuccessfulResponse() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final URI contentUri = new URIBuilder()
.setHttpHost(host)
@@ -709,7 +709,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testInvalidateUriSpecifiedByContentLocationNonCanonical() throws Exception {
+ void testInvalidateUriSpecifiedByContentLocationNonCanonical() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final String rootKey = CacheKeyGenerator.INSTANCE.generateKey(host, request);
final URI contentUri = new URIBuilder()
@@ -744,7 +744,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testInvalidateUriSpecifiedByContentLocationRelative() throws Exception {
+ void testInvalidateUriSpecifiedByContentLocationRelative() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final String rootKey = CacheKeyGenerator.INSTANCE.generateKey(host, request);
final URI contentUri = new URIBuilder()
@@ -779,7 +779,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testDoesNotInvalidateUriSpecifiedByContentLocationOtherOrigin() throws Exception {
+ void testDoesNotInvalidateUriSpecifiedByContentLocationOtherOrigin() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/");
final URI contentUri = new URIBuilder()
.setHost("bar.example.com")
@@ -804,7 +804,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testDoesNotInvalidateUriSpecifiedByContentLocationIfEtagsMatch() throws Exception {
+ void testDoesNotInvalidateUriSpecifiedByContentLocationIfEtagsMatch() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final URI contentUri = new URIBuilder()
.setHttpHost(host)
@@ -831,7 +831,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testDoesNotInvalidateUriSpecifiedByContentLocationIfOlder() throws Exception {
+ void testDoesNotInvalidateUriSpecifiedByContentLocationIfOlder() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final URI contentUri = new URIBuilder()
.setHttpHost(host)
@@ -858,7 +858,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testDoesNotInvalidateUriSpecifiedByContentLocationIfResponseHasNoEtag() throws Exception {
+ void testDoesNotInvalidateUriSpecifiedByContentLocationIfResponseHasNoEtag() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final URI contentUri = new URIBuilder()
.setHttpHost(host)
@@ -885,7 +885,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testDoesNotInvalidateUriSpecifiedByContentLocationIfEntryHasNoEtag() throws Exception {
+ void testDoesNotInvalidateUriSpecifiedByContentLocationIfEntryHasNoEtag() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final URI contentUri = new URIBuilder()
.setHttpHost(host)
@@ -911,7 +911,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testInvalidatesUriSpecifiedByContentLocationIfResponseHasNoDate() throws Exception {
+ void testInvalidatesUriSpecifiedByContentLocationIfResponseHasNoDate() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final URI contentUri = new URIBuilder()
.setHttpHost(host)
@@ -938,7 +938,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testInvalidatesUriSpecifiedByContentLocationIfEntryHasNoDate() throws Exception {
+ void testInvalidatesUriSpecifiedByContentLocationIfEntryHasNoDate() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final URI contentUri = new URIBuilder()
.setHttpHost(host)
@@ -964,7 +964,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testInvalidatesUriSpecifiedByContentLocationIfResponseHasMalformedDate() throws Exception {
+ void testInvalidatesUriSpecifiedByContentLocationIfResponseHasMalformedDate() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final URI contentUri = new URIBuilder()
.setHttpHost(host)
@@ -991,7 +991,7 @@ public class TestBasicHttpAsyncCache {
}
@Test
- public void testInvalidatesUriSpecifiedByContentLocationIfEntryHasMalformedDate() throws Exception {
+ void testInvalidatesUriSpecifiedByContentLocationIfEntryHasMalformedDate() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final URI contentUri = new URIBuilder()
.setHttpHost(host)
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestBasicHttpCache.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestBasicHttpCache.java
index 359188273..1fadffadd 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestBasicHttpCache.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestBasicHttpCache.java
@@ -63,7 +63,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
-public class TestBasicHttpCache {
+class TestBasicHttpCache {
private HttpHost host;
private Instant now;
@@ -72,7 +72,7 @@ public class TestBasicHttpCache {
private BasicHttpCache impl;
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() {
host = new HttpHost("foo.example.com");
now = Instant.now();
tenSecondsAgo = now.minusSeconds(10);
@@ -81,7 +81,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testGetCacheEntryReturnsNullOnCacheMiss() throws Exception {
+ void testGetCacheEntryReturnsNullOnCacheMiss() {
final HttpHost host = new HttpHost("foo.example.com");
final HttpRequest request = new HttpGet("http://foo.example.com/bar");
final CacheMatch result = impl.match(host, request);
@@ -89,7 +89,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testGetCacheEntryFetchesFromCacheOnCacheHitIfNoVariants() throws Exception {
+ void testGetCacheEntryFetchesFromCacheOnCacheHitIfNoVariants() {
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry();
assertFalse(entry.hasVariants());
final HttpHost host = new HttpHost("foo.example.com");
@@ -106,7 +106,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testGetCacheEntryReturnsNullIfNoVariantInCache() throws Exception {
+ void testGetCacheEntryReturnsNullIfNoVariantInCache() {
final HttpRequest origRequest = new HttpGet("http://foo.example.com/bar");
origRequest.setHeader("Accept-Encoding","gzip");
@@ -127,7 +127,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testGetCacheEntryReturnsVariantIfPresentInCache() throws Exception {
+ void testGetCacheEntryReturnsVariantIfPresentInCache() {
final HttpRequest origRequest = new HttpGet("http://foo.example.com/bar");
origRequest.setHeader("Accept-Encoding","gzip");
@@ -149,7 +149,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testGetCacheEntryReturnsVariantWithMostRecentDateHeader() throws Exception {
+ void testGetCacheEntryReturnsVariantWithMostRecentDateHeader() {
final HttpRequest origRequest = new HttpGet("http://foo.example.com/bar");
origRequest.setHeader("Accept-Encoding", "gzip");
@@ -189,7 +189,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testGetVariantsRootNoVariants() throws Exception {
+ void testGetVariantsRootNoVariants() {
final HttpCacheEntry root = HttpTestUtils.makeCacheEntry();
final List<CacheHit> variants = impl.getVariants(new CacheHit("root-key", root));
@@ -198,7 +198,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testGetVariantsRootNonExistentVariants() throws Exception {
+ void testGetVariantsRootNonExistentVariants() {
final Set<String> varinats = new HashSet<>();
varinats.add("variant1");
varinats.add("variant2");
@@ -210,7 +210,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testGetVariantCacheEntriesReturnsAllVariants() throws Exception {
+ void testGetVariantCacheEntriesReturnsAllVariants() throws Exception {
final HttpHost host = new HttpHost("foo.example.com");
final URI uri = new URI("http://foo.example.com/bar");
final HttpRequest req1 = new HttpGet(uri);
@@ -255,7 +255,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testUpdateCacheEntry() throws Exception {
+ void testUpdateCacheEntry() throws Exception {
final HttpHost host = new HttpHost("foo.example.com");
final URI uri = new URI("http://foo.example.com/bar");
final HttpRequest req1 = new HttpGet(uri);
@@ -295,7 +295,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testUpdateVariantCacheEntry() throws Exception {
+ void testUpdateVariantCacheEntry() throws Exception {
final HttpHost host = new HttpHost("foo.example.com");
final URI uri = new URI("http://foo.example.com/bar");
final HttpRequest req1 = new HttpGet(uri);
@@ -338,7 +338,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testUpdateCacheEntryTurnsVariant() throws Exception {
+ void testUpdateCacheEntryTurnsVariant() throws Exception {
final HttpHost host = new HttpHost("foo.example.com");
final URI uri = new URI("http://foo.example.com/bar");
final HttpRequest req1 = new HttpGet(uri);
@@ -379,7 +379,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testStoreFromNegotiatedVariant() throws Exception {
+ void testStoreFromNegotiatedVariant() throws Exception {
final HttpHost host = new HttpHost("foo.example.com");
final URI uri = new URI("http://foo.example.com/bar");
final HttpRequest req1 = new HttpGet(uri);
@@ -420,7 +420,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testInvalidatesUnsafeRequests() throws Exception {
+ void testInvalidatesUnsafeRequests() throws Exception {
final HttpRequest request = new BasicHttpRequest("POST","/path");
final String key = CacheKeyGenerator.INSTANCE.generateKey(host, request);
@@ -437,7 +437,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testDoesNotInvalidateSafeRequests() throws Exception {
+ void testDoesNotInvalidateSafeRequests() {
final HttpRequest request1 = new BasicHttpRequest("GET","/");
final HttpResponse response1 = HttpTestUtils.make200Response();
@@ -453,7 +453,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testInvalidatesUnsafeRequestsWithVariants() throws Exception {
+ void testInvalidatesUnsafeRequestsWithVariants() throws Exception {
final HttpRequest request = new BasicHttpRequest("POST","/path");
final String rootKey = CacheKeyGenerator.INSTANCE.generateKey(host, request);
final Set<String> variants = new HashSet<>();
@@ -481,7 +481,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testInvalidateUriSpecifiedByContentLocationAndFresher() throws Exception {
+ void testInvalidateUriSpecifiedByContentLocationAndFresher() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final String rootKey = CacheKeyGenerator.INSTANCE.generateKey(host, request);
final URI contentUri = new URIBuilder()
@@ -510,7 +510,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testInvalidateUriSpecifiedByLocationAndFresher() throws Exception {
+ void testInvalidateUriSpecifiedByLocationAndFresher() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final String rootKey = CacheKeyGenerator.INSTANCE.generateKey(host, request);
final URI contentUri = new URIBuilder()
@@ -539,7 +539,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testDoesNotInvalidateForUnsuccessfulResponse() throws Exception {
+ void testDoesNotInvalidateForUnsuccessfulResponse() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final URI contentUri = new URIBuilder()
.setHttpHost(host)
@@ -556,7 +556,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testInvalidateUriSpecifiedByContentLocationNonCanonical() throws Exception {
+ void testInvalidateUriSpecifiedByContentLocationNonCanonical() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final String rootKey = CacheKeyGenerator.INSTANCE.generateKey(host, request);
final URI contentUri = new URIBuilder()
@@ -588,7 +588,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testInvalidateUriSpecifiedByContentLocationRelative() throws Exception {
+ void testInvalidateUriSpecifiedByContentLocationRelative() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final String rootKey = CacheKeyGenerator.INSTANCE.generateKey(host, request);
final URI contentUri = new URIBuilder()
@@ -620,7 +620,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testDoesNotInvalidateUriSpecifiedByContentLocationOtherOrigin() throws Exception {
+ void testDoesNotInvalidateUriSpecifiedByContentLocationOtherOrigin() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/");
final URI contentUri = new URIBuilder()
.setHost("bar.example.com")
@@ -642,7 +642,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testDoesNotInvalidateUriSpecifiedByContentLocationIfEtagsMatch() throws Exception {
+ void testDoesNotInvalidateUriSpecifiedByContentLocationIfEtagsMatch() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final URI contentUri = new URIBuilder()
.setHttpHost(host)
@@ -666,7 +666,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testDoesNotInvalidateUriSpecifiedByContentLocationIfOlder() throws Exception {
+ void testDoesNotInvalidateUriSpecifiedByContentLocationIfOlder() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final URI contentUri = new URIBuilder()
.setHttpHost(host)
@@ -690,7 +690,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testDoesNotInvalidateUriSpecifiedByContentLocationIfResponseHasNoEtag() throws Exception {
+ void testDoesNotInvalidateUriSpecifiedByContentLocationIfResponseHasNoEtag() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final URI contentUri = new URIBuilder()
.setHttpHost(host)
@@ -714,7 +714,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testDoesNotInvalidateUriSpecifiedByContentLocationIfEntryHasNoEtag() throws Exception {
+ void testDoesNotInvalidateUriSpecifiedByContentLocationIfEntryHasNoEtag() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final URI contentUri = new URIBuilder()
.setHttpHost(host)
@@ -737,7 +737,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testInvalidatesUriSpecifiedByContentLocationIfResponseHasNoDate() throws Exception {
+ void testInvalidatesUriSpecifiedByContentLocationIfResponseHasNoDate() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final URI contentUri = new URIBuilder()
.setHttpHost(host)
@@ -761,7 +761,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testInvalidatesUriSpecifiedByContentLocationIfEntryHasNoDate() throws Exception {
+ void testInvalidatesUriSpecifiedByContentLocationIfEntryHasNoDate() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final URI contentUri = new URIBuilder()
.setHttpHost(host)
@@ -784,7 +784,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testInvalidatesUriSpecifiedByContentLocationIfResponseHasMalformedDate() throws Exception {
+ void testInvalidatesUriSpecifiedByContentLocationIfResponseHasMalformedDate() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final URI contentUri = new URIBuilder()
.setHttpHost(host)
@@ -808,7 +808,7 @@ public class TestBasicHttpCache {
}
@Test
- public void testInvalidatesUriSpecifiedByContentLocationIfEntryHasMalformedDate() throws Exception {
+ void testInvalidatesUriSpecifiedByContentLocationIfEntryHasMalformedDate() throws Exception {
final HttpRequest request = new BasicHttpRequest("PUT", "/foo");
final URI contentUri = new URIBuilder()
.setHttpHost(host)
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestByteArrayCacheEntrySerializer.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestByteArrayCacheEntrySerializer.java
index faba93f3b..57d2d64ad 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestByteArrayCacheEntrySerializer.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestByteArrayCacheEntrySerializer.java
@@ -52,192 +52,192 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@SuppressWarnings("deprecation")
-public class TestByteArrayCacheEntrySerializer {
+class TestByteArrayCacheEntrySerializer {
private ByteArrayCacheEntrySerializer impl;
@BeforeEach
- public void setUp() {
+ void setUp() {
impl = new ByteArrayCacheEntrySerializer();
}
@Test
- public void canSerializeEntriesWithVariantMapsDeprecatedConstructor() throws Exception {
+ void canSerializeEntriesWithVariantMapsDeprecatedConstructor() throws Exception {
readWriteVerify(makeCacheEntryDeprecatedConstructorWithVariantMap("somekey"));
}
@Test
- public void canSerializeEntriesWithVariantMapsAndInstant() throws Exception {
+ void canSerializeEntriesWithVariantMapsAndInstant() throws Exception {
readWriteVerify(makeCacheEntryWithVariantMap("somekey"));
}
@Test
- public void isAllowedClassNameStringTrue() {
+ void isAllowedClassNameStringTrue() {
assertIsAllowedClassNameTrue(String.class.getName());
}
@Test
- public void isAllowedClassNameStringArrayTrue() {
+ void isAllowedClassNameStringArrayTrue() {
assertIsAllowedClassNameTrue("[L" + String.class.getName());
}
@Test
- public void isAllowedClassNameStringArrayArrayTrue() {
+ void isAllowedClassNameStringArrayArrayTrue() {
assertIsAllowedClassNameTrue("[[L" + String.class.getName());
}
@Test
- public void isAllowedClassNameDataTrue() {
+ void isAllowedClassNameDataTrue() {
assertIsAllowedClassNameTrue(Date.class.getName());
}
@Test
- public void isAllowedClassNameInstantTrue() {
+ void isAllowedClassNameInstantTrue() {
assertIsAllowedClassNameTrue(Instant.class.getName());
}
@Test
- public void isAllowedClassNameStatusLineTrue() {
+ void isAllowedClassNameStatusLineTrue() {
assertIsAllowedClassNameTrue(StatusLine.class.getName());
}
@Test
- public void isAllowedClassNameResourceTrue() {
+ void isAllowedClassNameResourceTrue() {
assertIsAllowedClassNameTrue(Resource.class.getName());
}
@Test
- public void isAllowedClassNameByteArrayTrue() {
+ void isAllowedClassNameByteArrayTrue() {
assertIsAllowedClassNameTrue("[B");
}
@Test
- public void isAllowedClassNameByteArrayArrayTrue() {
+ void isAllowedClassNameByteArrayArrayTrue() {
assertIsAllowedClassNameTrue("[[B");
}
@Test
- public void isAllowedClassNameCharArrayTrue() {
+ void isAllowedClassNameCharArrayTrue() {
assertIsAllowedClassNameTrue("[C");
}
@Test
- public void isAllowedClassNameCharArrayArrayTrue() {
+ void isAllowedClassNameCharArrayArrayTrue() {
assertIsAllowedClassNameTrue("[[C");
}
@Test
- public void isAllowedClassNameDoubleArrayTrue() {
+ void isAllowedClassNameDoubleArrayTrue() {
assertIsAllowedClassNameTrue("[D");
}
@Test
- public void isAllowedClassNameDoubleArrayArrayTrue() {
+ void isAllowedClassNameDoubleArrayArrayTrue() {
assertIsAllowedClassNameTrue("[[D");
}
@Test
- public void isAllowedClassNameFloatArrayTrue() {
+ void isAllowedClassNameFloatArrayTrue() {
assertIsAllowedClassNameTrue("[F");
}
@Test
- public void isAllowedClassNameFloatArrayArrayTrue() {
+ void isAllowedClassNameFloatArrayArrayTrue() {
assertIsAllowedClassNameTrue("[[F");
}
@Test
- public void isAllowedClassNameIntArrayTrue() {
+ void isAllowedClassNameIntArrayTrue() {
assertIsAllowedClassNameTrue("[I");
}
@Test
- public void isAllowedClassNameIntArrayArrayTrue() {
+ void isAllowedClassNameIntArrayArrayTrue() {
assertIsAllowedClassNameTrue("[[I");
}
@Test
- public void isAllowedClassNameLongArrayTrue() {
+ void isAllowedClassNameLongArrayTrue() {
assertIsAllowedClassNameTrue("[J");
}
@Test
- public void isAllowedClassNameLongArrayArrayTrue() {
+ void isAllowedClassNameLongArrayArrayTrue() {
assertIsAllowedClassNameTrue("[[J");
}
@Test
- public void isAllowedClassNameShortArrayTrue() {
+ void isAllowedClassNameShortArrayTrue() {
assertIsAllowedClassNameTrue("[S");
}
@Test
- public void isAllowedClassNameShortArrayArrayTrue() {
+ void isAllowedClassNameShortArrayArrayTrue() {
assertIsAllowedClassNameTrue("[[S");
}
@Test
- public void isAllowedClassNameCollectionsInvokerTransformerFalse() {
+ void isAllowedClassNameCollectionsInvokerTransformerFalse() {
assertIsAllowedClassNameFalse("org.apache.commons.collections.functors.InvokerTransformer");
}
@Test
- public void isAllowedClassNameCollections4InvokerTransformerFalse() {
+ void isAllowedClassNameCollections4InvokerTransformerFalse() {
assertIsAllowedClassNameFalse("org.apache.commons.collections4.functors.InvokerTransformer");
}
@Test
- public void isAllowedClassNameCollectionsInstantiateTransformerFalse() {
+ void isAllowedClassNameCollectionsInstantiateTransformerFalse() {
assertIsAllowedClassNameFalse("org.apache.commons.collections.functors.InstantiateTransformer");
}
@Test
- public void isAllowedClassNameCollections4InstantiateTransformerFalse() {
+ void isAllowedClassNameCollections4InstantiateTransformerFalse() {
assertIsAllowedClassNameFalse("org.apache.commons.collections4.functors.InstantiateTransformer");
}
@Test
- public void isAllowedClassNameGroovyConvertedClosureFalse() {
+ void isAllowedClassNameGroovyConvertedClosureFalse() {
assertIsAllowedClassNameFalse("org.codehaus.groovy.runtime.ConvertedClosure");
}
@Test
- public void isAllowedClassNameGroovyMethodClosureFalse() {
+ void isAllowedClassNameGroovyMethodClosureFalse() {
assertIsAllowedClassNameFalse("org.codehaus.groovy.runtime.MethodClosure");
}
@Test
- public void isAllowedClassNameSpringObjectFactoryFalse() {
+ void isAllowedClassNameSpringObjectFactoryFalse() {
assertIsAllowedClassNameFalse("org.springframework.beans.factory.ObjectFactory");
}
@Test
- public void isAllowedClassNameCalanTemplatesImplFalse() {
+ void isAllowedClassNameCalanTemplatesImplFalse() {
assertIsAllowedClassNameFalse("com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl");
}
@Test
- public void isAllowedClassNameCalanTemplatesImplArrayFalse() {
+ void isAllowedClassNameCalanTemplatesImplArrayFalse() {
assertIsAllowedClassNameFalse("[Lcom.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl");
}
@Test
- public void isAllowedClassNameJavaRmiRegistryFalse() {
+ void isAllowedClassNameJavaRmiRegistryFalse() {
assertIsAllowedClassNameFalse("java.rmi.registry.Registry");
}
@Test
- public void isAllowedClassNameJavaRmiServerRemoteObjectInvocationHandlerFalse() {
+ void isAllowedClassNameJavaRmiServerRemoteObjectInvocationHandlerFalse() {
assertIsAllowedClassNameFalse("java.rmi.server.RemoteObjectInvocationHandler");
}
@Test
- public void isAllowedClassNameJavaxXmlTransformTemplatesFalse() {
+ void isAllowedClassNameJavaxXmlTransformTemplatesFalse() {
assertIsAllowedClassNameFalse("javax.xml.transform.Templates");
}
@Test
- public void isAllowedClassNameJavaxManagementMBeanServerInvocationHandlerFalse() {
+ void isAllowedClassNameJavaxManagementMBeanServerInvocationHandlerFalse() {
assertIsAllowedClassNameFalse("javax.management.MBeanServerInvocationHandler");
}
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheKeyGenerator.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheKeyGenerator.java
index 8a27c4937..8fcb19553 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheKeyGenerator.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheKeyGenerator.java
@@ -49,17 +49,17 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@SuppressWarnings({"boxing","static-access"}) // this is test code
-public class TestCacheKeyGenerator {
+class TestCacheKeyGenerator {
private CacheKeyGenerator extractor;
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() {
extractor = CacheKeyGenerator.INSTANCE;
}
@Test
- public void testGetRequestUri() {
+ void testGetRequestUri() {
Assertions.assertEquals("http://foo.example.com/stuff?huh",
CacheKeyGenerator.getRequestUri(
new HttpHost("bar.example.com"),
@@ -92,7 +92,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testNormalizeRequestUri() throws URISyntaxException {
+ void testNormalizeRequestUri() throws URISyntaxException {
Assertions.assertEquals(URI.create("http://bar.example.com:80/stuff?huh"),
CacheKeyGenerator.normalize(URI.create("//bar.example.com/stuff?huh")));
@@ -107,14 +107,14 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testExtractsUriFromAbsoluteUriInRequest() {
+ void testExtractsUriFromAbsoluteUriInRequest() {
final HttpHost host = new HttpHost("bar.example.com");
final HttpRequest req = new HttpGet("http://foo.example.com/");
Assertions.assertEquals("http://foo.example.com:80/", extractor.generateKey(host, req));
}
@Test
- public void testGetURIWithDefaultPortAndScheme() {
+ void testGetURIWithDefaultPortAndScheme() {
Assertions.assertEquals("http://www.comcast.net:80/", extractor.generateKey(
new HttpHost("www.comcast.net"),
new BasicHttpRequest("GET", "/")));
@@ -125,7 +125,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testGetURIWithDifferentScheme() {
+ void testGetURIWithDifferentScheme() {
Assertions.assertEquals("https://www.comcast.net:443/", extractor.generateKey(
new HttpHost("https", "www.comcast.net", -1),
new BasicHttpRequest("GET", "/")));
@@ -136,7 +136,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testGetURIWithDifferentPort() {
+ void testGetURIWithDifferentPort() {
Assertions.assertEquals("http://www.comcast.net:8080/", extractor.generateKey(
new HttpHost("www.comcast.net", 8080),
new BasicHttpRequest("GET", "/")));
@@ -147,7 +147,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testGetURIWithDifferentPortAndScheme() {
+ void testGetURIWithDifferentPortAndScheme() {
Assertions.assertEquals("https://www.comcast.net:8080/", extractor.generateKey(
new HttpHost("https", "www.comcast.net", 8080),
new BasicHttpRequest("GET", "/")));
@@ -158,7 +158,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testEmptyPortEquivalentToDefaultPortForHttp() {
+ void testEmptyPortEquivalentToDefaultPortForHttp() {
final HttpHost host1 = new HttpHost("foo.example.com:");
final HttpHost host2 = new HttpHost("foo.example.com:80");
final HttpRequest req = new BasicHttpRequest("GET", "/");
@@ -166,7 +166,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testEmptyPortEquivalentToDefaultPortForHttps() {
+ void testEmptyPortEquivalentToDefaultPortForHttps() {
final HttpHost host1 = new HttpHost("https", "foo.example.com", -1);
final HttpHost host2 = new HttpHost("https", "foo.example.com", 443);
final HttpRequest req = new BasicHttpRequest("GET", "/");
@@ -176,7 +176,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testEmptyPortEquivalentToDefaultPortForHttpsAbsoluteURI() {
+ void testEmptyPortEquivalentToDefaultPortForHttpsAbsoluteURI() {
final HttpHost host = new HttpHost("https", "foo.example.com", -1);
final HttpGet get1 = new HttpGet("https://bar.example.com:/");
final HttpGet get2 = new HttpGet("https://bar.example.com:443/");
@@ -186,7 +186,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testNotProvidedPortEquivalentToDefaultPortForHttpsAbsoluteURI() {
+ void testNotProvidedPortEquivalentToDefaultPortForHttpsAbsoluteURI() {
final HttpHost host = new HttpHost("https", "foo.example.com", -1);
final HttpGet get1 = new HttpGet("https://bar.example.com/");
final HttpGet get2 = new HttpGet("https://bar.example.com:443/");
@@ -196,7 +196,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testNotProvidedPortEquivalentToDefaultPortForHttp() {
+ void testNotProvidedPortEquivalentToDefaultPortForHttp() {
final HttpHost host1 = new HttpHost("foo.example.com");
final HttpHost host2 = new HttpHost("foo.example.com:80");
final HttpRequest req = new BasicHttpRequest("GET", "/");
@@ -204,7 +204,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testHostNameComparisonsAreCaseInsensitive() {
+ void testHostNameComparisonsAreCaseInsensitive() {
final HttpHost host1 = new HttpHost("foo.example.com");
final HttpHost host2 = new HttpHost("FOO.EXAMPLE.COM");
final HttpRequest req = new BasicHttpRequest("GET", "/");
@@ -212,7 +212,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testSchemeNameComparisonsAreCaseInsensitive() {
+ void testSchemeNameComparisonsAreCaseInsensitive() {
final HttpHost host1 = new HttpHost("http", "foo.example.com", -1);
final HttpHost host2 = new HttpHost("HTTP", "foo.example.com", -1);
final HttpRequest req = new BasicHttpRequest("GET", "/");
@@ -220,7 +220,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testEmptyAbsPathIsEquivalentToSlash() {
+ void testEmptyAbsPathIsEquivalentToSlash() {
final HttpHost host = new HttpHost("foo.example.com");
final HttpRequest req1 = new BasicHttpRequest("GET", "/");
final HttpRequest req2 = new HttpGet("http://foo.example.com");
@@ -228,7 +228,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testExtraDotSegmentsAreIgnored() {
+ void testExtraDotSegmentsAreIgnored() {
final HttpHost host = new HttpHost("foo.example.com");
final HttpRequest req1 = new BasicHttpRequest("GET", "/");
final HttpRequest req2 = new HttpGet("http://foo.example.com/./");
@@ -236,7 +236,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testExtraDotDotSegmentsAreIgnored() {
+ void testExtraDotDotSegmentsAreIgnored() {
final HttpHost host = new HttpHost("foo.example.com");
final HttpRequest req1 = new BasicHttpRequest("GET", "/");
final HttpRequest req2 = new HttpGet("http://foo.example.com/.././../");
@@ -244,7 +244,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testIntermidateDotDotSegementsAreEquivalent() {
+ void testIntermidateDotDotSegementsAreEquivalent() {
final HttpHost host = new HttpHost("foo.example.com");
final HttpRequest req1 = new BasicHttpRequest("GET", "/home.html");
final HttpRequest req2 = new BasicHttpRequest("GET", "/%7Esmith/../home.html");
@@ -252,7 +252,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testIntermidateEncodedDotDotSegementsAreEquivalent() {
+ void testIntermidateEncodedDotDotSegementsAreEquivalent() {
final HttpHost host = new HttpHost("foo.example.com");
final HttpRequest req1 = new BasicHttpRequest("GET", "/home.html");
final HttpRequest req2 = new BasicHttpRequest("GET", "/%7Esmith/../home.html");
@@ -260,7 +260,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testIntermidateDotSegementsAreEquivalent() {
+ void testIntermidateDotSegementsAreEquivalent() {
final HttpHost host = new HttpHost("foo.example.com");
final HttpRequest req1 = new BasicHttpRequest("GET", "/~smith/home.html");
final HttpRequest req2 = new BasicHttpRequest("GET", "/%7Esmith/./home.html");
@@ -268,7 +268,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testEquivalentPathEncodingsAreEquivalent() {
+ void testEquivalentPathEncodingsAreEquivalent() {
final HttpHost host = new HttpHost("foo.example.com");
final HttpRequest req1 = new BasicHttpRequest("GET", "/~smith/home.html");
final HttpRequest req2 = new BasicHttpRequest("GET", "/%7Esmith/home.html");
@@ -276,7 +276,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testEquivalentExtraPathEncodingsAreEquivalent() {
+ void testEquivalentExtraPathEncodingsAreEquivalent() {
final HttpHost host = new HttpHost("foo.example.com");
final HttpRequest req1 = new BasicHttpRequest("GET", "/~smith/home.html");
final HttpRequest req2 = new BasicHttpRequest("GET", "/%7Esmith/home.html");
@@ -284,7 +284,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testEquivalentExtraPathEncodingsWithPercentAreEquivalent() {
+ void testEquivalentExtraPathEncodingsWithPercentAreEquivalent() {
final HttpHost host = new HttpHost("foo.example.com");
final HttpRequest req1 = new BasicHttpRequest("GET", "/~smith/home%20folder.html");
final HttpRequest req2 = new BasicHttpRequest("GET", "/%7Esmith/home%20folder.html");
@@ -292,7 +292,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testGetURIWithQueryParameters() {
+ void testGetURIWithQueryParameters() {
Assertions.assertEquals("http://www.comcast.net:80/?foo=bar", extractor.generateKey(
new HttpHost("http", "www.comcast.net", -1), new BasicHttpRequest("GET", "/?foo=bar")));
Assertions.assertEquals("http://www.fancast.com:80/full_episodes?foo=bar", extractor.generateKey(
@@ -305,7 +305,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testNormalizeHeaderElements() {
+ void testNormalizeHeaderElements() {
final List<String> tokens = new ArrayList<>();
CacheKeyGenerator.normalizeElements(headers(
new BasicHeader("Accept-Encoding", "gzip,zip,deflate")
@@ -336,7 +336,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testGetVariantKey() {
+ void testGetVariantKey() {
final HttpRequest request = BasicRequestBuilder.get("/blah")
.addHeader(HttpHeaders.USER_AGENT, "some-agent")
.addHeader(HttpHeaders.ACCEPT_ENCODING, "gzip,zip")
@@ -352,7 +352,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testGetVariantKeyInputNormalization() {
+ void testGetVariantKeyInputNormalization() {
final HttpRequest request = BasicRequestBuilder.get("/blah")
.addHeader(HttpHeaders.USER_AGENT, "Some-Agent")
.addHeader(HttpHeaders.ACCEPT_ENCODING, "gzip, ZIP,,")
@@ -370,7 +370,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testGetVariantKeyInputNormalizationReservedChars() {
+ void testGetVariantKeyInputNormalizationReservedChars() {
final HttpRequest request = BasicRequestBuilder.get("/blah")
.addHeader(HttpHeaders.USER_AGENT, "*===some-agent===*")
.build();
@@ -380,7 +380,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testGetVariantKeyInputNoMatchingHeaders() {
+ void testGetVariantKeyInputNoMatchingHeaders() {
final HttpRequest request = BasicRequestBuilder.get("/blah")
.build();
@@ -389,7 +389,7 @@ public class TestCacheKeyGenerator {
}
@Test
- public void testGetVariantKeyFromCachedResponse() {
+ void testGetVariantKeyFromCachedResponse() {
final HttpRequest request = BasicRequestBuilder.get("/blah")
.addHeader("User-Agent", "agent1")
.addHeader("Accept-Encoding", "text/plain")
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheRevalidatorBase.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheRevalidatorBase.java
index 9d6e974cb..0370e3a56 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheRevalidatorBase.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheRevalidatorBase.java
@@ -42,7 +42,7 @@ import org.mockito.ArgumentMatchers;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-public class TestCacheRevalidatorBase {
+class TestCacheRevalidatorBase {
@Mock
private SchedulingStrategy mockSchedulingStrategy;
@@ -55,13 +55,13 @@ public class TestCacheRevalidatorBase {
@BeforeEach
- public void setUp() {
+ void setUp() {
MockitoAnnotations.openMocks(this);
impl = new CacheRevalidatorBase(mockScheduledExecutor, mockSchedulingStrategy);
}
@Test
- public void testRevalidateCacheEntrySchedulesExecutionAndPopulatesIdentifier() {
+ void testRevalidateCacheEntrySchedulesExecutionAndPopulatesIdentifier() {
when(mockSchedulingStrategy.schedule(ArgumentMatchers.anyInt())).thenReturn(TimeValue.ofSeconds(1));
final String cacheKey = "blah";
@@ -74,7 +74,7 @@ public class TestCacheRevalidatorBase {
}
@Test
- public void testMarkCompleteRemovesIdentifier() {
+ void testMarkCompleteRemovesIdentifier() {
when(mockSchedulingStrategy.schedule(ArgumentMatchers.anyInt())).thenReturn(TimeValue.ofSeconds(3));
final String cacheKey = "blah";
@@ -92,7 +92,7 @@ public class TestCacheRevalidatorBase {
}
@Test
- public void testRevalidateCacheEntryDoesNotPopulateIdentifierOnRejectedExecutionException() {
+ void testRevalidateCacheEntryDoesNotPopulateIdentifierOnRejectedExecutionException() {
when(mockSchedulingStrategy.schedule(ArgumentMatchers.anyInt())).thenReturn(TimeValue.ofSeconds(2));
doThrow(new RejectedExecutionException()).when(mockScheduledExecutor).schedule(ArgumentMatchers.any(), ArgumentMatchers.any());
@@ -104,7 +104,7 @@ public class TestCacheRevalidatorBase {
}
@Test
- public void testRevalidateCacheEntryProperlyCollapsesRequest() {
+ void testRevalidateCacheEntryProperlyCollapsesRequest() {
when(mockSchedulingStrategy.schedule(ArgumentMatchers.anyInt())).thenReturn(TimeValue.ofSeconds(2));
final String cacheKey = "blah";
@@ -119,7 +119,7 @@ public class TestCacheRevalidatorBase {
}
@Test
- public void testShutdown() throws Exception {
+ void testShutdown() throws Exception {
impl.close();
impl.awaitTermination(Timeout.ofMinutes(2));
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheSupport.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheSupport.java
index 3be79ad2f..8572bba77 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheSupport.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheSupport.java
@@ -33,10 +33,10 @@ import org.junit.jupiter.api.Test;
/**
* Unit tests for {@link CacheSupport}.
*/
-public class TestCacheSupport {
+class TestCacheSupport {
@Test
- public void testParseDeltaSeconds() throws Exception {
+ void testParseDeltaSeconds() {
Assertions.assertEquals(1234L, CacheSupport.deltaSeconds("1234"));
Assertions.assertEquals(0L, CacheSupport.deltaSeconds("0"));
Assertions.assertEquals(-1L, CacheSupport.deltaSeconds("-1"));
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheValidityPolicy.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheValidityPolicy.java
index 93a27f00c..fe42b5edb 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheValidityPolicy.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheValidityPolicy.java
@@ -41,7 +41,7 @@ import org.apache.hc.core5.util.TimeValue;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class TestCacheValidityPolicy {
+class TestCacheValidityPolicy {
private CacheValidityPolicy impl;
private Instant now;
@@ -51,7 +51,7 @@ public class TestCacheValidityPolicy {
private Instant elevenSecondsAgo;
@BeforeEach
- public void setUp() {
+ void setUp() {
impl = new CacheValidityPolicy();
now = Instant.now();
oneSecondAgo = now.minusSeconds(1);
@@ -61,7 +61,7 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testApparentAgeIsMaxIntIfDateHeaderNotPresent() {
+ void testApparentAgeIsMaxIntIfDateHeaderNotPresent() {
final Header[] headers = {
new BasicHeader("Server", "MockServer/1.0")
};
@@ -70,7 +70,7 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testApparentAgeIsResponseReceivedTimeLessDateHeader() {
+ void testApparentAgeIsResponseReceivedTimeLessDateHeader() {
final Header[] headers = new Header[] { new BasicHeader("Date", DateUtils.formatStandardDate(tenSecondsAgo)) };
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(now, sixSecondsAgo, headers);
@@ -78,14 +78,14 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testNegativeApparentAgeIsBroughtUpToZero() {
+ void testNegativeApparentAgeIsBroughtUpToZero() {
final Header[] headers = new Header[] { new BasicHeader("Date", DateUtils.formatStandardDate(sixSecondsAgo)) };
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(now, tenSecondsAgo, headers);
assertEquals(TimeValue.ofSeconds(0), impl.getApparentAge(entry));
}
@Test
- public void testCorrectedReceivedAgeIsAgeHeaderIfLarger() {
+ void testCorrectedReceivedAgeIsAgeHeaderIfLarger() {
final Header[] headers = new Header[] { new BasicHeader("Age", "10"), };
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(headers);
impl = new CacheValidityPolicy() {
@@ -98,20 +98,20 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testGetCorrectedAgeValue() {
+ void testGetCorrectedAgeValue() {
final Header[] headers = new Header[] { new BasicHeader("Age", "6"), };
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(headers);
assertEquals(TimeValue.ofSeconds(6), impl.getCorrectedAgeValue(entry));
}
@Test
- public void testResponseDelayIsDifferenceBetweenResponseAndRequestTimes() {
+ void testResponseDelayIsDifferenceBetweenResponseAndRequestTimes() {
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(tenSecondsAgo, sixSecondsAgo);
assertEquals(TimeValue.ofSeconds(4), impl.getResponseDelay(entry));
}
@Test
- public void testCorrectedInitialAgeIsCorrectedReceivedAgePlusResponseDelay() {
+ void testCorrectedInitialAgeIsCorrectedReceivedAgePlusResponseDelay() {
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry();
impl = new CacheValidityPolicy() {
@Override
@@ -128,13 +128,13 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testResidentTimeSecondsIsTimeSinceResponseTime() {
+ void testResidentTimeSecondsIsTimeSinceResponseTime() {
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(now, sixSecondsAgo);
assertEquals(TimeValue.ofSeconds(6), impl.getResidentTime(entry, now));
}
@Test
- public void testCurrentAgeIsCorrectedInitialAgePlusResidentTime() {
+ void testCurrentAgeIsCorrectedInitialAgePlusResidentTime() {
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry();
impl = new CacheValidityPolicy() {
@Override
@@ -150,7 +150,7 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testFreshnessLifetimeIsSMaxAgeIfPresent() {
+ void testFreshnessLifetimeIsSMaxAgeIfPresent() {
final ResponseCacheControl cacheControl = ResponseCacheControl.builder()
.setSharedMaxAge(10)
.setMaxAge(5)
@@ -160,7 +160,7 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testSMaxAgeIsIgnoredWhenNotShared() {
+ void testSMaxAgeIsIgnoredWhenNotShared() {
final CacheConfig cacheConfig = CacheConfig.custom()
.setSharedCache(false)
.build();
@@ -174,7 +174,7 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testFreshnessLifetimeIsMaxAgeIfPresent() {
+ void testFreshnessLifetimeIsMaxAgeIfPresent() {
final ResponseCacheControl cacheControl = ResponseCacheControl.builder()
.setMaxAge(10)
.build();
@@ -183,7 +183,7 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testFreshnessLifetimeUsesSharedMaxAgeInSharedCache() {
+ void testFreshnessLifetimeUsesSharedMaxAgeInSharedCache() {
// assuming impl represents a shared cache
final ResponseCacheControl cacheControl = ResponseCacheControl.builder()
.setMaxAge(10)
@@ -194,7 +194,7 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testFreshnessLifetimeUsesMaxAgeWhenSharedMaxAgeNotPresent() {
+ void testFreshnessLifetimeUsesMaxAgeWhenSharedMaxAgeNotPresent() {
// assuming impl represents a shared cache
final ResponseCacheControl cacheControl = ResponseCacheControl.builder()
.setMaxAge(10)
@@ -204,7 +204,7 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testFreshnessLifetimeIsMaxAgeEvenIfExpiresIsPresent() {
+ void testFreshnessLifetimeIsMaxAgeEvenIfExpiresIsPresent() {
final ResponseCacheControl cacheControl = ResponseCacheControl.builder()
.setMaxAge(10)
.build();
@@ -215,7 +215,7 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testFreshnessLifetimeIsSMaxAgeEvenIfExpiresIsPresent() {
+ void testFreshnessLifetimeIsSMaxAgeEvenIfExpiresIsPresent() {
final ResponseCacheControl cacheControl = ResponseCacheControl.builder()
.setSharedMaxAge(10)
.build();
@@ -226,7 +226,7 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testFreshnessLifetimeIsFromExpiresHeaderIfNoMaxAge() {
+ void testFreshnessLifetimeIsFromExpiresHeaderIfNoMaxAge() {
final ResponseCacheControl cacheControl = ResponseCacheControl.builder()
.build();
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(
@@ -236,7 +236,7 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testHeuristicFreshnessLifetime() {
+ void testHeuristicFreshnessLifetime() {
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(
new BasicHeader("Date", DateUtils.formatStandardDate(oneSecondAgo)),
new BasicHeader("Last-Modified", DateUtils.formatStandardDate(elevenSecondsAgo)));
@@ -244,14 +244,14 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testHeuristicFreshnessLifetimeDefaultsProperly() {
+ void testHeuristicFreshnessLifetimeDefaultsProperly() {
final TimeValue defaultFreshness = TimeValue.ofSeconds(0);
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry();
assertEquals(defaultFreshness, impl.getHeuristicFreshnessLifetime(entry));
}
@Test
- public void testHeuristicFreshnessLifetimeIsNonNegative() {
+ void testHeuristicFreshnessLifetimeIsNonNegative() {
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(
new BasicHeader("Date", DateUtils.formatStandardDate(elevenSecondsAgo)),
new BasicHeader("Last-Modified", DateUtils.formatStandardDate(oneSecondAgo)));
@@ -259,7 +259,7 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testHeuristicFreshnessLifetimeCustomProperly() {
+ void testHeuristicFreshnessLifetimeCustomProperly() {
final CacheConfig cacheConfig = CacheConfig.custom().setHeuristicDefaultLifetime(TimeValue.ofSeconds(10))
.setHeuristicCoefficient(0.5f).build();
impl = new CacheValidityPolicy(cacheConfig);
@@ -269,7 +269,7 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testNegativeAgeHeaderValueReturnsZero() {
+ void testNegativeAgeHeaderValueReturnsZero() {
final Header[] headers = new Header[] { new BasicHeader("Age", "-100") };
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(headers);
// in seconds
@@ -277,7 +277,7 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testMalformedAgeHeaderValueReturnsMaxAge() {
+ void testMalformedAgeHeaderValueReturnsMaxAge() {
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(
new BasicHeader("Age", "asdf"));
// in seconds
@@ -285,7 +285,7 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testMalformedAgeHeaderMultipleWellFormedAges() {
+ void testMalformedAgeHeaderMultipleWellFormedAges() {
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(
new BasicHeader("Age", "123,456,789"));
// in seconds
@@ -293,7 +293,7 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testMalformedAgeHeaderMultiplesMalformedAges() {
+ void testMalformedAgeHeaderMultiplesMalformedAges() {
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(
new BasicHeader("Age", "123 456 789"));
// in seconds
@@ -301,7 +301,7 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testMalformedAgeHeaderNegativeAge() {
+ void testMalformedAgeHeaderNegativeAge() {
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(
new BasicHeader("Age", "-123"));
// in seconds
@@ -309,7 +309,7 @@ public class TestCacheValidityPolicy {
}
@Test
- public void testMalformedAgeHeaderOverflow() {
+ void testMalformedAgeHeaderOverflow() {
final String reallyOldAge = "1" + Long.MAX_VALUE;
final HttpCacheEntry entry = HttpTestUtils.makeCacheEntry(
new BasicHeader("Age", reallyOldAge));
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheableRequestPolicy.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheableRequestPolicy.java
index 3c5d88074..99b423e9a 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheableRequestPolicy.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCacheableRequestPolicy.java
@@ -32,17 +32,17 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class TestCacheableRequestPolicy {
+class TestCacheableRequestPolicy {
private CacheableRequestPolicy policy;
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() {
policy = new CacheableRequestPolicy();
}
@Test
- public void testIsGetServableFromCache() {
+ void testIsGetServableFromCache() {
final BasicHttpRequest request = new BasicHttpRequest("GET", "someUri");
final RequestCacheControl cacheControl = RequestCacheControl.builder().build();
@@ -50,7 +50,7 @@ public class TestCacheableRequestPolicy {
}
@Test
- public void testIsGetWithCacheControlServableFromCache() {
+ void testIsGetWithCacheControlServableFromCache() {
final BasicHttpRequest request = new BasicHttpRequest("GET", "someUri");
final RequestCacheControl cacheControl = RequestCacheControl.builder()
.setNoCache(true)
@@ -67,7 +67,7 @@ public class TestCacheableRequestPolicy {
}
@Test
- public void testIsHeadServableFromCache() {
+ void testIsHeadServableFromCache() {
final BasicHttpRequest request = new BasicHttpRequest("HEAD", "someUri");
final RequestCacheControl cacheControl = RequestCacheControl.builder().build();
@@ -81,7 +81,7 @@ public class TestCacheableRequestPolicy {
}
@Test
- public void testIsHeadWithCacheControlServableFromCache() {
+ void testIsHeadWithCacheControlServableFromCache() {
final BasicHttpRequest request = new BasicHttpRequest("HEAD", "someUri");
final RequestCacheControl cacheControl = RequestCacheControl.builder()
.setNoCache(true)
@@ -100,7 +100,7 @@ public class TestCacheableRequestPolicy {
}
@Test
- public void testIsArbitraryMethodServableFromCache() {
+ void testIsArbitraryMethodServableFromCache() {
final BasicHttpRequest request = new BasicHttpRequest("TRACE", "someUri");
final RequestCacheControl cacheControl = RequestCacheControl.builder()
.build();
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCachedHttpResponseGenerator.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCachedHttpResponseGenerator.java
index 3a9cc6ff8..59eca4b3a 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCachedHttpResponseGenerator.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCachedHttpResponseGenerator.java
@@ -44,7 +44,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@SuppressWarnings({"boxing","static-access"}) // test code
-public class TestCachedHttpResponseGenerator {
+class TestCachedHttpResponseGenerator {
private HttpCacheEntry entry;
private ClassicHttpRequest request;
@@ -52,7 +52,7 @@ public class TestCachedHttpResponseGenerator {
private CachedHttpResponseGenerator impl;
@BeforeEach
- public void setUp() {
+ void setUp() {
entry = HttpTestUtils.makeCacheEntry();
request = HttpTestUtils.makeDefaultRequest();
mockValidityPolicy = mock(CacheValidityPolicy.class);
@@ -60,7 +60,7 @@ public class TestCachedHttpResponseGenerator {
}
@Test
- public void testResponseHasContentLength() throws Exception {
+ void testResponseHasContentLength() throws Exception {
final byte[] buf = new byte[] { 1, 2, 3, 4, 5 };
final HttpCacheEntry entry1 = HttpTestUtils.makeCacheEntry(buf);
@@ -73,14 +73,14 @@ public class TestCachedHttpResponseGenerator {
}
@Test
- public void testResponseStatusCodeMatchesCacheEntry() throws Exception {
+ void testResponseStatusCodeMatchesCacheEntry() throws Exception {
final SimpleHttpResponse response = impl.generateResponse(request, entry);
Assertions.assertEquals(entry.getStatus(), response.getCode());
}
@Test
- public void testAgeHeaderIsPopulatedWithCurrentAgeOfCacheEntryIfNonZero() throws Exception {
+ void testAgeHeaderIsPopulatedWithCurrentAgeOfCacheEntryIfNonZero() throws Exception {
currentAge(TimeValue.ofSeconds(10L));
final SimpleHttpResponse response = impl.generateResponse(request, entry);
@@ -93,7 +93,7 @@ public class TestCachedHttpResponseGenerator {
}
@Test
- public void testAgeHeaderIsNotPopulatedIfCurrentAgeOfCacheEntryIsZero() throws Exception {
+ void testAgeHeaderIsNotPopulatedIfCurrentAgeOfCacheEntryIsZero() throws Exception {
currentAge(TimeValue.ofSeconds(0L));
final SimpleHttpResponse response = impl.generateResponse(request, entry);
@@ -105,7 +105,7 @@ public class TestCachedHttpResponseGenerator {
}
@Test
- public void testAgeHeaderIsPopulatedWithMaxAgeIfCurrentAgeTooBig() throws Exception {
+ void testAgeHeaderIsPopulatedWithMaxAgeIfCurrentAgeTooBig() throws Exception {
currentAge(TimeValue.ofSeconds(CacheSupport.MAX_AGE.toSeconds() + 1L));
final SimpleHttpResponse response = impl.generateResponse(request, entry);
@@ -124,14 +124,14 @@ public class TestCachedHttpResponseGenerator {
}
@Test
- public void testResponseContainsEntityToServeGETRequestIfEntryContainsResource() throws Exception {
+ void testResponseContainsEntityToServeGETRequestIfEntryContainsResource() throws Exception {
final SimpleHttpResponse response = impl.generateResponse(request, entry);
Assertions.assertNotNull(response.getBody());
}
@Test
- public void testResponseDoesNotContainEntityToServeHEADRequestIfEntryContainsResource() throws Exception {
+ void testResponseDoesNotContainEntityToServeHEADRequestIfEntryContainsResource() throws Exception {
final ClassicHttpRequest headRequest = HttpTestUtils.makeDefaultHEADRequest();
final SimpleHttpResponse response = impl.generateResponse(headRequest, entry);
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCachedResponseSuitabilityChecker.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCachedResponseSuitabilityChecker.java
index 0219f3311..899dc5107 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCachedResponseSuitabilityChecker.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCachedResponseSuitabilityChecker.java
@@ -44,7 +44,7 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class TestCachedResponseSuitabilityChecker {
+class TestCachedResponseSuitabilityChecker {
private Instant now;
private Instant elevenSecondsAgo;
@@ -58,7 +58,7 @@ public class TestCachedResponseSuitabilityChecker {
private CachedResponseSuitabilityChecker impl;
@BeforeEach
- public void setUp() {
+ void setUp() {
now = Instant.now();
elevenSecondsAgo = now.minusSeconds(11);
tenSecondsAgo = now.minusSeconds(10);
@@ -104,7 +104,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testRequestMethodMatch() {
+ void testRequestMethodMatch() {
request = new BasicHttpRequest("GET", "/foo");
entry = makeEntry(Method.GET, "/foo",
new BasicHeader("Date", DateUtils.formatStandardDate(tenSecondsAgo)));
@@ -128,7 +128,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testRequestUriMatch() {
+ void testRequestUriMatch() {
request = new BasicHttpRequest("GET", "/foo");
entry = makeEntry(Method.GET, "/foo",
new BasicHeader("Date", DateUtils.formatStandardDate(tenSecondsAgo)));
@@ -156,7 +156,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testRequestHeadersMatch() {
+ void testRequestHeadersMatch() {
request = BasicRequestBuilder.get("/foo").build();
entry = makeEntry(
Method.GET, "/foo",
@@ -225,7 +225,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testResponseNoCache() {
+ void testResponseNoCache() {
entry = makeEntry(new BasicHeader("Date", DateUtils.formatStandardDate(tenSecondsAgo)));
responseCacheControl = ResponseCacheControl.builder()
.setNoCache(false)
@@ -254,7 +254,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testSuitableIfCacheEntryIsFresh() {
+ void testSuitableIfCacheEntryIsFresh() {
entry = makeEntry(new BasicHeader("Date", DateUtils.formatStandardDate(tenSecondsAgo)));
responseCacheControl = ResponseCacheControl.builder()
.setMaxAge(3600)
@@ -263,7 +263,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testNotSuitableIfCacheEntryIsNotFresh() {
+ void testNotSuitableIfCacheEntryIsNotFresh() {
entry = makeEntry(
new BasicHeader("Date", DateUtils.formatStandardDate(tenSecondsAgo)));
responseCacheControl = ResponseCacheControl.builder()
@@ -273,7 +273,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testNotSuitableIfRequestHasNoCache() {
+ void testNotSuitableIfRequestHasNoCache() {
requestCacheControl = RequestCacheControl.builder()
.setNoCache(true)
.build();
@@ -286,7 +286,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testNotSuitableIfAgeExceedsRequestMaxAge() {
+ void testNotSuitableIfAgeExceedsRequestMaxAge() {
requestCacheControl = RequestCacheControl.builder()
.setMaxAge(10)
.build();
@@ -299,7 +299,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testSuitableIfFreshAndAgeIsUnderRequestMaxAge() {
+ void testSuitableIfFreshAndAgeIsUnderRequestMaxAge() {
requestCacheControl = RequestCacheControl.builder()
.setMaxAge(15)
.build();
@@ -312,7 +312,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testSuitableIfFreshAndFreshnessLifetimeGreaterThanRequestMinFresh() {
+ void testSuitableIfFreshAndFreshnessLifetimeGreaterThanRequestMinFresh() {
requestCacheControl = RequestCacheControl.builder()
.setMinFresh(10)
.build();
@@ -325,7 +325,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testNotSuitableIfFreshnessLifetimeLessThanRequestMinFresh() {
+ void testNotSuitableIfFreshnessLifetimeLessThanRequestMinFresh() {
requestCacheControl = RequestCacheControl.builder()
.setMinFresh(10)
.build();
@@ -338,7 +338,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testSuitableEvenIfStaleButPermittedByRequestMaxStale() {
+ void testSuitableEvenIfStaleButPermittedByRequestMaxStale() {
requestCacheControl = RequestCacheControl.builder()
.setMaxStale(10)
.build();
@@ -353,7 +353,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testNotSuitableIfStaleButTooStaleForRequestMaxStale() {
+ void testNotSuitableIfStaleButTooStaleForRequestMaxStale() {
requestCacheControl = RequestCacheControl.builder()
.setMaxStale(2)
.build();
@@ -366,7 +366,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testSuitableIfCacheEntryIsHeuristicallyFreshEnough() {
+ void testSuitableIfCacheEntryIsHeuristicallyFreshEnough() {
final Instant oneSecondAgo = now.minusSeconds(1);
final Instant twentyOneSecondsAgo = now.minusSeconds(21);
@@ -383,7 +383,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testSuitableIfCacheEntryIsHeuristicallyFreshEnoughByDefault() {
+ void testSuitableIfCacheEntryIsHeuristicallyFreshEnoughByDefault() {
entry = makeEntry(
new BasicHeader("Date", DateUtils.formatStandardDate(tenSecondsAgo)));
@@ -397,7 +397,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testSuitableIfRequestMethodisHEAD() {
+ void testSuitableIfRequestMethodisHEAD() {
final HttpRequest headRequest = new BasicHttpRequest("HEAD", "/foo");
entry = makeEntry(
new BasicHeader("Date", DateUtils.formatStandardDate(tenSecondsAgo)));
@@ -409,7 +409,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testSuitableForGETIfEntryDoesNotSpecifyARequestMethodButContainsEntity() {
+ void testSuitableForGETIfEntryDoesNotSpecifyARequestMethodButContainsEntity() {
impl = new CachedResponseSuitabilityChecker(CacheConfig.custom().build());
entry = makeEntry(Method.GET, "/foo",
new BasicHeader("Date", DateUtils.formatStandardDate(tenSecondsAgo)));
@@ -421,7 +421,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testSuitableForGETIfHeadResponseCachingEnabledAndEntryDoesNotSpecifyARequestMethodButContains204Response() {
+ void testSuitableForGETIfHeadResponseCachingEnabledAndEntryDoesNotSpecifyARequestMethodButContains204Response() {
impl = new CachedResponseSuitabilityChecker(CacheConfig.custom().build());
entry = makeEntry(Method.GET, "/foo",
new BasicHeader("Date", DateUtils.formatStandardDate(tenSecondsAgo)));
@@ -433,7 +433,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testSuitableForHEADIfHeadResponseCachingEnabledAndEntryDoesNotSpecifyARequestMethod() {
+ void testSuitableForHEADIfHeadResponseCachingEnabledAndEntryDoesNotSpecifyARequestMethod() {
final HttpRequest headRequest = new BasicHttpRequest("HEAD", "/foo");
impl = new CachedResponseSuitabilityChecker(CacheConfig.custom().build());
final Header[] headers = {
@@ -449,7 +449,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testNotSuitableIfGetRequestWithHeadCacheEntry() {
+ void testNotSuitableIfGetRequestWithHeadCacheEntry() {
// Prepare a cache entry with HEAD method
entry = makeEntry(Method.HEAD, "/foo",
new BasicHeader("Date", DateUtils.formatStandardDate(tenSecondsAgo)));
@@ -461,7 +461,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testSuitableIfErrorRequestCacheControl() {
+ void testSuitableIfErrorRequestCacheControl() {
// Prepare a cache entry with HEAD method
entry = makeEntry(Method.GET, "/foo",
new BasicHeader("Date", DateUtils.formatStandardDate(tenSecondsAgo)));
@@ -494,7 +494,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testSuitableIfErrorResponseCacheControl() {
+ void testSuitableIfErrorResponseCacheControl() {
// Prepare a cache entry with HEAD method
entry = makeEntry(Method.GET, "/foo",
new BasicHeader("Date", DateUtils.formatStandardDate(tenSecondsAgo)));
@@ -521,7 +521,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testSuitableIfErrorRequestCacheControlTakesPrecedenceOverResponseCacheControl() {
+ void testSuitableIfErrorRequestCacheControlTakesPrecedenceOverResponseCacheControl() {
// Prepare a cache entry with HEAD method
entry = makeEntry(Method.GET, "/foo",
new BasicHeader("Date", DateUtils.formatStandardDate(tenSecondsAgo)));
@@ -541,7 +541,7 @@ public class TestCachedResponseSuitabilityChecker {
}
@Test
- public void testSuitableIfErrorConfigDefault() {
+ void testSuitableIfErrorConfigDefault() {
// Prepare a cache entry with HEAD method
entry = makeEntry(Method.GET, "/foo",
new BasicHeader("Date", DateUtils.formatStandardDate(tenSecondsAgo)));
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCachingExecChain.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCachingExecChain.java
index e40ab6782..9a8592ec1 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCachingExecChain.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCachingExecChain.java
@@ -71,7 +71,7 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
-public class TestCachingExecChain {
+class TestCachingExecChain {
@Mock
ExecChain mockExecChain;
@@ -93,7 +93,7 @@ public class TestCachingExecChain {
ExecChain.Scope scope;
@BeforeEach
- public void setUp() {
+ void setUp() {
MockitoAnnotations.openMocks(this);
host = new HttpHost("foo.example.com", 80);
route = new HttpRoute(host);
@@ -115,7 +115,7 @@ public class TestCachingExecChain {
}
@Test
- public void testCacheableResponsesGoIntoCache() throws Exception {
+ void testCacheableResponsesGoIntoCache() throws Exception {
final ClassicHttpRequest req1 = HttpTestUtils.makeDefaultRequest();
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
resp1.setHeader("Cache-Control", "max-age=3600");
@@ -133,7 +133,7 @@ public class TestCachingExecChain {
}
@Test
- public void testOlderCacheableResponsesDoNotGoIntoCache() throws Exception {
+ void testOlderCacheableResponsesDoNotGoIntoCache() throws Exception {
final Instant now = Instant.now();
final Instant fiveSecondsAgo = now.minusSeconds(5);
@@ -165,7 +165,7 @@ public class TestCachingExecChain {
}
@Test
- public void testNewerCacheableResponsesReplaceExistingCacheEntry() throws Exception {
+ void testNewerCacheableResponsesReplaceExistingCacheEntry() throws Exception {
final Instant now = Instant.now();
final Instant fiveSecondsAgo = now.minusSeconds(5);
@@ -197,7 +197,7 @@ public class TestCachingExecChain {
}
@Test
- public void testNonCacheableResponseIsNotCachedAndIsReturnedAsIs() throws Exception {
+ void testNonCacheableResponseIsNotCachedAndIsReturnedAsIs() throws Exception {
final HttpCache cache = new BasicHttpCache(new HeapResourceFactory(), mockStorage);
impl = new CachingExec(cache, null, CacheConfig.DEFAULT);
@@ -216,7 +216,7 @@ public class TestCachingExecChain {
}
@Test
- public void testSetsModuleGeneratedResponseContextForCacheOptionsResponse() throws Exception {
+ void testSetsModuleGeneratedResponseContextForCacheOptionsResponse() throws Exception {
final ClassicHttpRequest req = new BasicClassicHttpRequest("OPTIONS", "*");
req.setHeader("Max-Forwards", "0");
@@ -225,7 +225,7 @@ public class TestCachingExecChain {
}
@Test
- public void testSetsCacheMissContextIfRequestNotServableFromCache() throws Exception {
+ void testSetsCacheMissContextIfRequestNotServableFromCache() throws Exception {
final ClassicHttpRequest req = new HttpGet("http://foo.example.com/");
req.setHeader("Cache-Control", "no-cache");
final ClassicHttpResponse resp = new BasicClassicHttpResponse(HttpStatus.SC_NO_CONTENT, "No Content");
@@ -237,7 +237,7 @@ public class TestCachingExecChain {
}
@Test
- public void testSetsCacheHitContextIfRequestServedFromCache() throws Exception {
+ void testSetsCacheHitContextIfRequestServedFromCache() throws Exception {
final ClassicHttpRequest req1 = new HttpGet("http://foo.example.com/");
final ClassicHttpRequest req2 = new HttpGet("http://foo.example.com/");
final ClassicHttpResponse resp1 = new BasicClassicHttpResponse(HttpStatus.SC_OK, "OK");
@@ -255,7 +255,7 @@ public class TestCachingExecChain {
}
@Test
- public void testReturns304ForIfModifiedSinceHeaderIfRequestServedFromCache() throws Exception {
+ void testReturns304ForIfModifiedSinceHeaderIfRequestServedFromCache() throws Exception {
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
final ClassicHttpRequest req1 = new HttpGet("http://foo.example.com/");
@@ -277,7 +277,7 @@ public class TestCachingExecChain {
}
@Test
- public void testReturns304ForIfModifiedSinceHeaderIf304ResponseInCache() throws Exception {
+ void testReturns304ForIfModifiedSinceHeaderIf304ResponseInCache() throws Exception {
final Instant now = Instant.now();
final Instant oneHourAgo = now.minus(1, ChronoUnit.HOURS);
final Instant inTenMinutes = now.plus(10, ChronoUnit.MINUTES);
@@ -304,7 +304,7 @@ public class TestCachingExecChain {
}
@Test
- public void testReturns304ForIfModifiedSinceHeaderIf304ResponseInCacheWithLastModified() throws Exception {
+ void testReturns304ForIfModifiedSinceHeaderIf304ResponseInCacheWithLastModified() throws Exception {
final Instant now = Instant.now();
final Instant oneHourAgo = now.minus(1, ChronoUnit.HOURS);
final Instant inTenMinutes = now.plus(10, ChronoUnit.MINUTES);
@@ -330,7 +330,7 @@ public class TestCachingExecChain {
}
@Test
- public void testReturns200ForIfModifiedSinceDateIsLess() throws Exception {
+ void testReturns200ForIfModifiedSinceDateIsLess() throws Exception {
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
final ClassicHttpRequest req1 = new HttpGet("http://foo.example.com/");
@@ -360,7 +360,7 @@ public class TestCachingExecChain {
}
@Test
- public void testReturns200ForIfModifiedSinceDateIsInvalid() throws Exception {
+ void testReturns200ForIfModifiedSinceDateIsInvalid() throws Exception {
final Instant now = Instant.now();
final Instant tenSecondsAfter = now.plusSeconds(10);
final ClassicHttpRequest req1 = new HttpGet("http://foo.example.com/");
@@ -387,7 +387,7 @@ public class TestCachingExecChain {
}
@Test
- public void testReturns304ForIfNoneMatchHeaderIfRequestServedFromCache() throws Exception {
+ void testReturns304ForIfNoneMatchHeaderIfRequestServedFromCache() throws Exception {
final ClassicHttpRequest req1 = new HttpGet("http://foo.example.com/");
final ClassicHttpRequest req2 = new HttpGet("http://foo.example.com/");
req2.addHeader("If-None-Match", "*");
@@ -407,7 +407,7 @@ public class TestCachingExecChain {
}
@Test
- public void testReturns200ForIfNoneMatchHeaderFails() throws Exception {
+ void testReturns200ForIfNoneMatchHeaderFails() throws Exception {
final ClassicHttpRequest req1 = new HttpGet("http://foo.example.com/");
final ClassicHttpRequest req2 = new HttpGet("http://foo.example.com/");
@@ -433,7 +433,7 @@ public class TestCachingExecChain {
}
@Test
- public void testReturns304ForIfNoneMatchHeaderAndIfModifiedSinceIfRequestServedFromCache() throws Exception {
+ void testReturns304ForIfNoneMatchHeaderAndIfModifiedSinceIfRequestServedFromCache() throws Exception {
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
final ClassicHttpRequest req1 = new HttpGet("http://foo.example.com/");
@@ -458,7 +458,7 @@ public class TestCachingExecChain {
}
@Test
- public void testReturns200ForIfNoneMatchHeaderFailsIfModifiedSinceIgnored() throws Exception {
+ void testReturns200ForIfNoneMatchHeaderFailsIfModifiedSinceIgnored() throws Exception {
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
final ClassicHttpRequest req1 = new HttpGet("http://foo.example.com/");
@@ -481,7 +481,7 @@ public class TestCachingExecChain {
}
@Test
- public void testReturns200ForOptionsFollowedByGetIfAuthorizationHeaderAndSharedCache() throws Exception {
+ void testReturns200ForOptionsFollowedByGetIfAuthorizationHeaderAndSharedCache() throws Exception {
impl = new CachingExec(cache, null, CacheConfig.custom().setSharedCache(true).build());
final Instant now = Instant.now();
final ClassicHttpRequest req1 = new HttpOptions("http://foo.example.com/");
@@ -512,7 +512,7 @@ public class TestCachingExecChain {
}
@Test
- public void testSetsValidatedContextIfRequestWasSuccessfullyValidated() throws Exception {
+ void testSetsValidatedContextIfRequestWasSuccessfullyValidated() throws Exception {
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
@@ -543,7 +543,7 @@ public class TestCachingExecChain {
}
@Test
- public void testSetsModuleResponseContextIfValidationRequiredButFailed() throws Exception {
+ void testSetsModuleResponseContextIfValidationRequiredButFailed() throws Exception {
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
@@ -569,7 +569,7 @@ public class TestCachingExecChain {
}
@Test
- public void testSetsModuleResponseContextIfValidationFailsButNotRequired() throws Exception {
+ void testSetsModuleResponseContextIfValidationFailsButNotRequired() throws Exception {
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
@@ -594,7 +594,7 @@ public class TestCachingExecChain {
}
@Test
- public void testReturns304ForIfNoneMatchPassesIfRequestServedFromOrigin() throws Exception {
+ void testReturns304ForIfNoneMatchPassesIfRequestServedFromOrigin() throws Exception {
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
@@ -626,7 +626,7 @@ public class TestCachingExecChain {
}
@Test
- public void testReturns200ForIfNoneMatchFailsIfRequestServedFromOrigin() throws Exception {
+ void testReturns200ForIfNoneMatchFailsIfRequestServedFromOrigin() throws Exception {
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
@@ -660,7 +660,7 @@ public class TestCachingExecChain {
}
@Test
- public void testReturns304ForIfModifiedSincePassesIfRequestServedFromOrigin() throws Exception {
+ void testReturns304ForIfModifiedSincePassesIfRequestServedFromOrigin() throws Exception {
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
@@ -694,7 +694,7 @@ public class TestCachingExecChain {
}
@Test
- public void testReturns200ForIfModifiedSinceFailsIfRequestServedFromOrigin() throws Exception {
+ void testReturns200ForIfModifiedSinceFailsIfRequestServedFromOrigin() throws Exception {
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
@@ -730,7 +730,7 @@ public class TestCachingExecChain {
}
@Test
- public void testVariantMissServerIfReturns304CacheReturns200() throws Exception {
+ void testVariantMissServerIfReturns304CacheReturns200() throws Exception {
final Instant now = Instant.now();
final ClassicHttpRequest req1 = new HttpGet("http://foo.example.com");
@@ -792,7 +792,7 @@ public class TestCachingExecChain {
}
@Test
- public void testVariantsMissServerReturns304CacheReturns304() throws Exception {
+ void testVariantsMissServerReturns304CacheReturns304() throws Exception {
final Instant now = Instant.now();
final ClassicHttpRequest req1 = new HttpGet("http://foo.example.com");
@@ -853,7 +853,7 @@ public class TestCachingExecChain {
}
@Test
- public void testSocketTimeoutExceptionIsNotSilentlyCatched() throws Exception {
+ void testSocketTimeoutExceptionIsNotSilentlyCatched() throws Exception {
final Instant now = Instant.now();
final ClassicHttpRequest req1 = new HttpGet("http://foo.example.com");
@@ -863,7 +863,7 @@ public class TestCachingExecChain {
private boolean closed;
@Override
- public void close() throws IOException {
+ public void close() {
closed = true;
}
@@ -886,7 +886,7 @@ public class TestCachingExecChain {
}
@Test
- public void testTooLargeResponsesAreNotCached() throws Exception {
+ void testTooLargeResponsesAreNotCached() throws Exception {
final HttpHost host = new HttpHost("foo.example.com");
final ClassicHttpRequest request = new HttpGet("http://foo.example.com/bar");
@@ -908,7 +908,7 @@ public class TestCachingExecChain {
}
@Test
- public void testSmallEnoughResponsesAreCached() throws Exception {
+ void testSmallEnoughResponsesAreCached() throws Exception {
final HttpCache mockCache = mock(HttpCache.class);
impl = new CachingExec(mockCache, null, CacheConfig.DEFAULT);
@@ -949,7 +949,7 @@ public class TestCachingExecChain {
}
@Test
- public void testIfOnlyIfCachedAndNoCacheEntryBackendNotCalled() throws Exception {
+ void testIfOnlyIfCachedAndNoCacheEntryBackendNotCalled() throws Exception {
request.addHeader("Cache-Control", "only-if-cached");
final ClassicHttpResponse resp = execute(request);
@@ -958,7 +958,7 @@ public class TestCachingExecChain {
}
@Test
- public void testCanCacheAResponseWithoutABody() throws Exception {
+ void testCanCacheAResponseWithoutABody() throws Exception {
final ClassicHttpResponse response = new BasicClassicHttpResponse(HttpStatus.SC_NO_CONTENT, "No Content");
response.setHeader("Date", DateUtils.formatStandardDate(Instant.now()));
response.setHeader("Cache-Control", "max-age=300");
@@ -971,7 +971,7 @@ public class TestCachingExecChain {
}
@Test
- public void testNoEntityForIfNoneMatchRequestNotYetInCache() throws Exception {
+ void testNoEntityForIfNoneMatchRequestNotYetInCache() throws Exception {
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
@@ -993,7 +993,7 @@ public class TestCachingExecChain {
}
@Test
- public void testNotModifiedResponseUpdatesCacheEntryWhenNoEntity() throws Exception {
+ void testNotModifiedResponseUpdatesCacheEntryWhenNoEntity() throws Exception {
final Instant now = Instant.now();
@@ -1027,7 +1027,7 @@ public class TestCachingExecChain {
}
@Test
- public void testNotModifiedResponseWithVaryUpdatesCacheEntryWhenNoEntity() throws Exception {
+ void testNotModifiedResponseWithVaryUpdatesCacheEntryWhenNoEntity() throws Exception {
final Instant now = Instant.now();
@@ -1064,7 +1064,7 @@ public class TestCachingExecChain {
}
@Test
- public void testDoesNotSend304ForNonConditionalRequest() throws Exception {
+ void testDoesNotSend304ForNonConditionalRequest() throws Exception {
final Instant now = Instant.now();
final Instant inOneMinute = now.plus(1, ChronoUnit.MINUTES);
@@ -1105,7 +1105,7 @@ public class TestCachingExecChain {
}
@Test
- public void testUsesVirtualHostForCacheKey() throws Exception {
+ void testUsesVirtualHostForCacheKey() throws Exception {
final ClassicHttpResponse response = HttpTestUtils.make200Response();
response.setHeader("Cache-Control", "max-age=3600");
Mockito.when(mockExecChain.proceed(Mockito.any(), Mockito.any())).thenReturn(response);
@@ -1125,7 +1125,7 @@ public class TestCachingExecChain {
}
@Test
- public void testReturnssetStaleIfErrorNotEnabled() throws Exception {
+ void testReturnssetStaleIfErrorNotEnabled() throws Exception {
// Create the first request and response
final ClassicHttpRequest req1 = new HttpGet("http://foo.example.com/");
@@ -1156,7 +1156,7 @@ public class TestCachingExecChain {
@Test
- public void testReturnssetStaleIfErrorEnabled() throws Exception {
+ void testReturnssetStaleIfErrorEnabled() throws Exception {
final CacheConfig customConfig = CacheConfig.custom()
.setMaxCacheEntries(100)
.setMaxObjectSize(1024)
@@ -1196,7 +1196,7 @@ public class TestCachingExecChain {
}
@Test
- public void testNotModifiedResponseUpdatesCacheEntry() throws Exception {
+ void testNotModifiedResponseUpdatesCacheEntry() throws Exception {
final HttpCache mockCache = mock(HttpCache.class);
impl = new CachingExec(mockCache, null, CacheConfig.DEFAULT);
// Prepare request and host
@@ -1251,7 +1251,7 @@ public class TestCachingExecChain {
}
@Test
- public void testNoCacheFieldsRevalidation() throws Exception {
+ void testNoCacheFieldsRevalidation() throws Exception {
final Instant now = Instant.now();
final Instant fiveSecondsAgo = now.minusSeconds(5);
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCombinedEntity.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCombinedEntity.java
index 3b35a11bf..abb6aa50b 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCombinedEntity.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestCombinedEntity.java
@@ -38,10 +38,10 @@ import org.apache.hc.core5.util.ByteArrayBuffer;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class TestCombinedEntity {
+class TestCombinedEntity {
@Test
- public void testCombinedEntityBasics() throws Exception {
+ void testCombinedEntityBasics() throws Exception {
final HttpEntity httpEntity = mock(HttpEntity.class);
when(httpEntity.getContent()).thenReturn(
new ByteArrayInputStream(new byte[] { 6, 7, 8, 9, 10 }));
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestConditionalRequestBuilder.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestConditionalRequestBuilder.java
index 3daf75c51..3e1e08029 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestConditionalRequestBuilder.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestConditionalRequestBuilder.java
@@ -51,19 +51,19 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class TestConditionalRequestBuilder {
+class TestConditionalRequestBuilder {
private ConditionalRequestBuilder<HttpRequest> impl;
private HttpRequest request;
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() {
impl = new ConditionalRequestBuilder<>(request -> BasicRequestBuilder.copy(request).build());
request = new BasicHttpRequest("GET", "/");
}
@Test
- public void testBuildConditionalRequestWithLastModified() {
+ void testBuildConditionalRequestWithLastModified() {
final String theMethod = "GET";
final String theUri = "/theuri";
final String lastModified = "this is my last modified date";
@@ -91,8 +91,7 @@ public class TestConditionalRequestBuilder {
}
@Test
- public void testConditionalRequestForEntryWithLastModifiedAndEtagIncludesBothAsValidators()
- throws Exception {
+ void testConditionalRequestForEntryWithLastModifiedAndEtagIncludesBothAsValidators() {
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
final Instant twentySecondsAgo = now.plusSeconds(20);
@@ -114,7 +113,7 @@ public class TestConditionalRequestBuilder {
}
@Test
- public void testBuildConditionalRequestWithETag() {
+ void testBuildConditionalRequestWithETag() {
final String theMethod = "GET";
final String theUri = "/theuri";
final String theETag = "\"this is my eTag\"";
@@ -146,7 +145,7 @@ public class TestConditionalRequestBuilder {
}
@Test
- public void testCacheEntryWithMustRevalidateDoesEndToEndRevalidation() throws Exception {
+ void testCacheEntryWithMustRevalidateDoesEndToEndRevalidation() {
final HttpRequest basicRequest = new BasicHttpRequest("GET","/");
final Instant now = Instant.now();
final Instant elevenSecondsAgo = now.minusSeconds(11);
@@ -170,7 +169,7 @@ public class TestConditionalRequestBuilder {
}
@Test
- public void testCacheEntryWithProxyRevalidateDoesEndToEndRevalidation() throws Exception {
+ void testCacheEntryWithProxyRevalidateDoesEndToEndRevalidation() {
final HttpRequest basicRequest = new BasicHttpRequest("GET", "/");
final Instant now = Instant.now();
final Instant elevenSecondsAgo = now.minusSeconds(11);
@@ -194,15 +193,13 @@ public class TestConditionalRequestBuilder {
}
@Test
- public void testBuildUnconditionalRequestUsesGETMethod()
- throws Exception {
+ void testBuildUnconditionalRequestUsesGETMethod() {
final HttpRequest result = impl.buildUnconditionalRequest(request);
Assertions.assertEquals("GET", result.getMethod());
}
@Test
- public void testBuildUnconditionalRequestUsesRequestUri()
- throws Exception {
+ void testBuildUnconditionalRequestUsesRequestUri() {
final String uri = "/theURI";
request = new BasicHttpRequest("GET", uri);
final HttpRequest result = impl.buildUnconditionalRequest(request);
@@ -210,56 +207,49 @@ public class TestConditionalRequestBuilder {
}
@Test
- public void testBuildUnconditionalRequestAddsCacheControlNoCache()
- throws Exception {
+ void testBuildUnconditionalRequestAddsCacheControlNoCache() {
final HttpRequest result = impl.buildUnconditionalRequest(request);
final RequestCacheControl requestCacheControl = CacheControlHeaderParser.INSTANCE.parse(result);
Assertions.assertTrue(requestCacheControl.isNoCache());
}
@Test
- public void testBuildUnconditionalRequestDoesNotUseIfRange()
- throws Exception {
+ void testBuildUnconditionalRequestDoesNotUseIfRange() {
request.addHeader("If-Range","\"etag\"");
final HttpRequest result = impl.buildUnconditionalRequest(request);
Assertions.assertNull(result.getFirstHeader("If-Range"));
}
@Test
- public void testBuildUnconditionalRequestDoesNotUseIfMatch()
- throws Exception {
+ void testBuildUnconditionalRequestDoesNotUseIfMatch() {
request.addHeader("If-Match","\"etag\"");
final HttpRequest result = impl.buildUnconditionalRequest(request);
Assertions.assertNull(result.getFirstHeader("If-Match"));
}
@Test
- public void testBuildUnconditionalRequestDoesNotUseIfNoneMatch()
- throws Exception {
+ void testBuildUnconditionalRequestDoesNotUseIfNoneMatch() {
request.addHeader("If-None-Match","\"etag\"");
final HttpRequest result = impl.buildUnconditionalRequest(request);
Assertions.assertNull(result.getFirstHeader("If-None-Match"));
}
@Test
- public void testBuildUnconditionalRequestDoesNotUseIfUnmodifiedSince()
- throws Exception {
+ void testBuildUnconditionalRequestDoesNotUseIfUnmodifiedSince() {
request.addHeader("If-Unmodified-Since", DateUtils.formatStandardDate(Instant.now()));
final HttpRequest result = impl.buildUnconditionalRequest(request);
Assertions.assertNull(result.getFirstHeader("If-Unmodified-Since"));
}
@Test
- public void testBuildUnconditionalRequestDoesNotUseIfModifiedSince()
- throws Exception {
+ void testBuildUnconditionalRequestDoesNotUseIfModifiedSince() {
request.addHeader("If-Modified-Since", DateUtils.formatStandardDate(Instant.now()));
final HttpRequest result = impl.buildUnconditionalRequest(request);
Assertions.assertNull(result.getFirstHeader("If-Modified-Since"));
}
@Test
- public void testBuildUnconditionalRequestCarriesOtherRequestHeaders()
- throws Exception {
+ void testBuildUnconditionalRequestCarriesOtherRequestHeaders() {
request.addHeader("User-Agent","MyBrowser/1.0");
final HttpRequest result = impl.buildUnconditionalRequest(request);
Assertions.assertEquals("MyBrowser/1.0",
@@ -267,7 +257,7 @@ public class TestConditionalRequestBuilder {
}
@Test
- public void testBuildConditionalRequestFromVariants() throws Exception {
+ void testBuildConditionalRequestFromVariants() {
final ETag etag1 = new ETag("123");
final ETag etag2 = new ETag("456");
final ETag etag3 = new ETag("789");
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestFileResourceFactory.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestFileResourceFactory.java
index 952f75712..ba814be0c 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestFileResourceFactory.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestFileResourceFactory.java
@@ -33,17 +33,17 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class TestFileResourceFactory {
+class TestFileResourceFactory {
CacheKeyGenerator keyGenerator;
@BeforeEach
- public void setUp() {
+ void setUp() {
keyGenerator = new CacheKeyGenerator();
}
@Test
- public void testViaValueLookup() throws Exception {
+ void testViaValueLookup() throws Exception {
final String requestId = keyGenerator.generateKey(new URI("http://localhost/stuff"));
Assertions.assertEquals(
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestHttpByteArrayCacheEntrySerializer.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestHttpByteArrayCacheEntrySerializer.java
index 4647ab038..7a60f31db 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestHttpByteArrayCacheEntrySerializer.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestHttpByteArrayCacheEntrySerializer.java
@@ -50,17 +50,17 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class TestHttpByteArrayCacheEntrySerializer {
+class TestHttpByteArrayCacheEntrySerializer {
private HttpCacheEntrySerializer<byte[]> httpCacheEntrySerializer;
@BeforeEach
- public void before() {
+ void before() {
httpCacheEntrySerializer = HttpByteArrayCacheEntrySerializer.INSTANCE;
}
@Test
- public void testSimpleSerializeAndDeserialize() throws Exception {
+ void testSimpleSerializeAndDeserialize() throws Exception {
final String content = "Hello World";
final ContentType contentType = ContentType.TEXT_PLAIN.withCharset(StandardCharsets.UTF_8);
final HttpCacheEntry cacheEntry = new HttpCacheEntry(Instant.now(), Instant.now(),
@@ -77,7 +77,7 @@ public class TestHttpByteArrayCacheEntrySerializer {
}
@Test
- public void testSerializeAndDeserializeLargeContent() throws Exception {
+ void testSerializeAndDeserializeLargeContent() throws Exception {
final ContentType contentType = ContentType.IMAGE_JPEG;
final HeapResource resource = load(getClass().getResource("/ApacheLogo.png"));
final HttpCacheEntry cacheEntry = new HttpCacheEntry(Instant.now(), Instant.now(),
@@ -97,7 +97,7 @@ public class TestHttpByteArrayCacheEntrySerializer {
* Deserialize a cache entry in a bad format, expecting an exception.
*/
@Test
- public void testInvalidCacheEntry() throws Exception {
+ void testInvalidCacheEntry() throws Exception {
// This file is a JPEG not a cache entry, so should fail to deserialize
final HeapResource resource = load(getClass().getResource("/ApacheLogo.png"));
Assertions.assertThrows(ResourceIOException.class, () ->
@@ -108,7 +108,7 @@ public class TestHttpByteArrayCacheEntrySerializer {
* Deserialize truncated cache entries.
*/
@Test
- public void testTruncatedCacheEntry() throws Exception {
+ void testTruncatedCacheEntry() {
final String content1 = HttpByteArrayCacheEntrySerializer.HC_CACHE_VERSION_LINE + "\n" +
"HC-Key: unique-cache-key\n" +
"HC-Resource-Length: 11\n" +
@@ -190,7 +190,7 @@ public class TestHttpByteArrayCacheEntrySerializer {
* Deserialize cache entries with a missing mandatory header.
*/
@Test
- public void testMissingHeaderCacheEntry() throws Exception {
+ void testMissingHeaderCacheEntry() {
final String content1 = HttpByteArrayCacheEntrySerializer.HC_CACHE_VERSION_LINE + "\n" +
"HC-Key: unique-cache-key\n" +
"HC-Resource-Length: 11\n" +
@@ -230,7 +230,7 @@ public class TestHttpByteArrayCacheEntrySerializer {
* Deserialize cache entries with an invalid header value.
*/
@Test
- public void testInvalidHeaderCacheEntry() throws Exception {
+ void testInvalidHeaderCacheEntry() {
final String content1 = HttpByteArrayCacheEntrySerializer.HC_CACHE_VERSION_LINE + "\n" +
"HC-Key: unique-cache-key\n" +
"HC-Resource-Length: 11\n" +
@@ -271,7 +271,7 @@ public class TestHttpByteArrayCacheEntrySerializer {
* Deserialize cache entries with an invalid request line.
*/
@Test
- public void testInvalidRequestLineCacheEntry() throws Exception {
+ void testInvalidRequestLineCacheEntry() {
final String content1 = HttpByteArrayCacheEntrySerializer.HC_CACHE_VERSION_LINE + "\n" +
"HC-Key: unique-cache-key\n" +
"HC-Resource-Length: 11\n" +
@@ -295,7 +295,7 @@ public class TestHttpByteArrayCacheEntrySerializer {
* Deserialize cache entries with an invalid request line.
*/
@Test
- public void testInvalidStatusLineCacheEntry() throws Exception {
+ void testInvalidStatusLineCacheEntry() {
final String content1 = HttpByteArrayCacheEntrySerializer.HC_CACHE_VERSION_LINE + "\n" +
"HC-Key: unique-cache-key\n" +
"HC-Resource-Length: 11\n" +
@@ -319,7 +319,7 @@ public class TestHttpByteArrayCacheEntrySerializer {
* Serialize and deserialize a cache entry with no headers.
*/
@Test
- public void noHeadersTest() throws Exception {
+ void noHeadersTest() throws Exception {
final String content = "Hello World";
final ContentType contentType = ContentType.TEXT_PLAIN.withCharset(StandardCharsets.UTF_8);
final HttpCacheEntry cacheEntry = new HttpCacheEntry(Instant.now(), Instant.now(),
@@ -339,7 +339,7 @@ public class TestHttpByteArrayCacheEntrySerializer {
* Serialize and deserialize a cache entry with an empty body.
*/
@Test
- public void emptyBodyTest() throws Exception {
+ void emptyBodyTest() throws Exception {
final HttpCacheEntry cacheEntry = new HttpCacheEntry(Instant.now(), Instant.now(),
"GET", "/stuff", HttpTestUtils.headers(),
HttpStatus.SC_OK, HttpTestUtils.headers(),
@@ -357,7 +357,7 @@ public class TestHttpByteArrayCacheEntrySerializer {
* Serialize and deserialize a cache entry with no body.
*/
@Test
- public void noBodyTest() throws Exception {
+ void noBodyTest() throws Exception {
final HttpCacheEntry cacheEntry = new HttpCacheEntry(Instant.now(), Instant.now(),
"GET", "/stuff", HttpTestUtils.headers(),
HttpStatus.SC_OK, HttpTestUtils.headers(),
@@ -375,7 +375,7 @@ public class TestHttpByteArrayCacheEntrySerializer {
* Serialize and deserialize a cache entry with a variant map.
*/
@Test
- public void testSimpleVariantMap() throws Exception {
+ void testSimpleVariantMap() throws Exception {
final String content = "Hello World";
final ContentType contentType = ContentType.TEXT_PLAIN.withCharset(StandardCharsets.UTF_8);
final Set<String> variants = new HashSet<>();
@@ -398,7 +398,7 @@ public class TestHttpByteArrayCacheEntrySerializer {
* Deserialize cache entries with trailing garbage.
*/
@Test
- public void testDeserializeCacheEntryWithTrailingGarbage() throws Exception {
+ void testDeserializeCacheEntryWithTrailingGarbage() {
final String content1 =HttpByteArrayCacheEntrySerializer.HC_CACHE_VERSION_LINE + "\n" +
"HC-Key: unique-cache-key\n" +
"HC-Resource-Length: 11\n" +
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestHttpCacheJiraNumber1147.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestHttpCacheJiraNumber1147.java
index 8452f9974..d165e3b34 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestHttpCacheJiraNumber1147.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestHttpCacheJiraNumber1147.java
@@ -56,7 +56,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
-public class TestHttpCacheJiraNumber1147 {
+class TestHttpCacheJiraNumber1147 {
private File cacheDir;
@@ -72,7 +72,7 @@ public class TestHttpCacheJiraNumber1147 {
}
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() throws Exception {
cacheDir = File.createTempFile("cachedir", "");
if (cacheDir.exists()) {
cacheDir.delete();
@@ -81,12 +81,12 @@ public class TestHttpCacheJiraNumber1147 {
}
@AfterEach
- public void cleanUp() {
+ void cleanUp() {
removeCache();
}
@Test
- public void testIssue1147() throws Exception {
+ void testIssue1147() throws Exception {
final CacheConfig cacheConfig = CacheConfig.custom()
.setSharedCache(true)
.setMaxObjectSize(262144) //256kb
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestInternalCacheStorage.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestInternalCacheStorage.java
index 7e688c05b..4bf184aa8 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestInternalCacheStorage.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestInternalCacheStorage.java
@@ -33,10 +33,10 @@ import org.apache.hc.client5.http.cache.HttpCacheEntry;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class TestInternalCacheStorage {
+class TestInternalCacheStorage {
@Test
- public void testCacheBasics() {
+ void testCacheBasics() {
final InternalCacheStorage storage = new InternalCacheStorage();
final String key1 = "some-key-1";
Assertions.assertNull(storage.get(key1));
@@ -61,7 +61,7 @@ public class TestInternalCacheStorage {
}
@Test
- public void testCacheEviction() {
+ void testCacheEviction() {
final Queue<HttpCacheEntry> evictedEntries = new LinkedList<>();
final InternalCacheStorage storage = new InternalCacheStorage(2, e -> evictedEntries.add(e.getContent()));
final String key1 = "some-key-1";
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestProtocolAllowedBehavior.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestProtocolAllowedBehavior.java
index 81669953c..f40f318d1 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestProtocolAllowedBehavior.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestProtocolAllowedBehavior.java
@@ -51,7 +51,7 @@ import org.mockito.MockitoAnnotations;
* This class tests behavior that is allowed (MAY) by the HTTP/1.1 protocol
* specification and for which we have implemented the behavior in HTTP cache.
*/
-public class TestProtocolAllowedBehavior {
+class TestProtocolAllowedBehavior {
static final int MAX_BYTES = 1024;
static final int MAX_ENTRIES = 100;
@@ -73,7 +73,7 @@ public class TestProtocolAllowedBehavior {
HttpCache cache;
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() throws Exception {
MockitoAnnotations.openMocks(this);
host = new HttpHost("foo.example.com", 80);
@@ -105,7 +105,7 @@ public class TestProtocolAllowedBehavior {
}
@Test
- public void testNonSharedCacheMayCacheResponsesWithCacheControlPrivate() throws Exception {
+ void testNonSharedCacheMayCacheResponsesWithCacheControlPrivate() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET","/");
originResponse.setHeader("Cache-Control","private,max-age=3600");
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestProtocolRecommendations.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestProtocolRecommendations.java
index 607f35533..3bdcce722 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestProtocolRecommendations.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestProtocolRecommendations.java
@@ -68,7 +68,7 @@ import org.mockito.MockitoAnnotations;
* compliance with the HTTP/1.1 caching protocol (SHOULD, SHOULD NOT,
* RECOMMENDED, and NOT RECOMMENDED behaviors).
*/
-public class TestProtocolRecommendations {
+class TestProtocolRecommendations {
static final int MAX_BYTES = 1024;
static final int MAX_ENTRIES = 100;
@@ -92,7 +92,7 @@ public class TestProtocolRecommendations {
Instant twoMinutesAgo;
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() throws Exception {
MockitoAnnotations.openMocks(this);
host = new HttpHost("foo.example.com", 80);
@@ -164,85 +164,85 @@ public class TestProtocolRecommendations {
}
@Test
- public void cacheGenerated304ForStrongEtagValidatorShouldNotContainAllow() throws Exception {
+ void cacheGenerated304ForStrongEtagValidatorShouldNotContainAllow() throws Exception {
cacheGenerated304ForStrongETagValidatorShouldNotContainEntityHeader(
"Allow", "GET,HEAD");
}
@Test
- public void cacheGenerated304ForStrongDateValidatorShouldNotContainAllow() throws Exception {
+ void cacheGenerated304ForStrongDateValidatorShouldNotContainAllow() throws Exception {
cacheGenerated304ForStrongDateValidatorShouldNotContainEntityHeader(
"Allow", "GET,HEAD");
}
@Test
- public void cacheGenerated304ForStrongEtagValidatorShouldNotContainContentEncoding() throws Exception {
+ void cacheGenerated304ForStrongEtagValidatorShouldNotContainContentEncoding() throws Exception {
cacheGenerated304ForStrongETagValidatorShouldNotContainEntityHeader(
"Content-Encoding", "gzip");
}
@Test
- public void cacheGenerated304ForStrongDateValidatorShouldNotContainContentEncoding() throws Exception {
+ void cacheGenerated304ForStrongDateValidatorShouldNotContainContentEncoding() throws Exception {
cacheGenerated304ForStrongDateValidatorShouldNotContainEntityHeader(
"Content-Encoding", "gzip");
}
@Test
- public void cacheGenerated304ForStrongEtagValidatorShouldNotContainContentLanguage() throws Exception {
+ void cacheGenerated304ForStrongEtagValidatorShouldNotContainContentLanguage() throws Exception {
cacheGenerated304ForStrongETagValidatorShouldNotContainEntityHeader(
"Content-Language", "en");
}
@Test
- public void cacheGenerated304ForStrongDateValidatorShouldNotContainContentLanguage() throws Exception {
+ void cacheGenerated304ForStrongDateValidatorShouldNotContainContentLanguage() throws Exception {
cacheGenerated304ForStrongDateValidatorShouldNotContainEntityHeader(
"Content-Language", "en");
}
@Test
- public void cacheGenerated304ForStrongValidatorShouldNotContainContentLength() throws Exception {
+ void cacheGenerated304ForStrongValidatorShouldNotContainContentLength() throws Exception {
cacheGenerated304ForStrongETagValidatorShouldNotContainEntityHeader(
"Content-Length", "128");
}
@Test
- public void cacheGenerated304ForStrongDateValidatorShouldNotContainContentLength() throws Exception {
+ void cacheGenerated304ForStrongDateValidatorShouldNotContainContentLength() throws Exception {
cacheGenerated304ForStrongDateValidatorShouldNotContainEntityHeader(
"Content-Length", "128");
}
@Test
- public void cacheGenerated304ForStrongValidatorShouldNotContainContentMD5() throws Exception {
+ void cacheGenerated304ForStrongValidatorShouldNotContainContentMD5() throws Exception {
cacheGenerated304ForStrongETagValidatorShouldNotContainEntityHeader(
"Content-MD5", "Q2hlY2sgSW50ZWdyaXR5IQ==");
}
@Test
- public void cacheGenerated304ForStrongDateValidatorShouldNotContainContentMD5() throws Exception {
+ void cacheGenerated304ForStrongDateValidatorShouldNotContainContentMD5() throws Exception {
cacheGenerated304ForStrongDateValidatorShouldNotContainEntityHeader(
"Content-MD5", "Q2hlY2sgSW50ZWdyaXR5IQ==");
}
@Test
- public void cacheGenerated304ForStrongEtagValidatorShouldNotContainContentType() throws Exception {
+ void cacheGenerated304ForStrongEtagValidatorShouldNotContainContentType() throws Exception {
cacheGenerated304ForStrongETagValidatorShouldNotContainEntityHeader(
"Content-Type", "text/html");
}
@Test
- public void cacheGenerated304ForStrongDateValidatorShouldNotContainContentType() throws Exception {
+ void cacheGenerated304ForStrongDateValidatorShouldNotContainContentType() throws Exception {
cacheGenerated304ForStrongDateValidatorShouldNotContainEntityHeader(
"Content-Type", "text/html");
}
@Test
- public void cacheGenerated304ForStrongEtagValidatorShouldNotContainLastModified() throws Exception {
+ void cacheGenerated304ForStrongEtagValidatorShouldNotContainLastModified() throws Exception {
cacheGenerated304ForStrongETagValidatorShouldNotContainEntityHeader(
"Last-Modified", DateUtils.formatStandardDate(tenSecondsAgo));
}
@Test
- public void cacheGenerated304ForStrongDateValidatorShouldNotContainLastModified() throws Exception {
+ void cacheGenerated304ForStrongDateValidatorShouldNotContainLastModified() throws Exception {
cacheGenerated304ForStrongDateValidatorShouldNotContainEntityHeader(
"Last-Modified", DateUtils.formatStandardDate(twoMinutesAgo));
}
@@ -277,21 +277,21 @@ public class TestProtocolRecommendations {
}
@Test
- public void testDoesNotReturnStaleResponseIfClientExplicitlyRequestsFirstHandOneWithCacheControl() throws Exception {
+ void testDoesNotReturnStaleResponseIfClientExplicitlyRequestsFirstHandOneWithCacheControl() throws Exception {
final ClassicHttpRequest req = new BasicClassicHttpRequest("GET", "/");
req.setHeader("Cache-Control","no-cache");
testDoesNotReturnStaleResponseOnError(req);
}
@Test
- public void testDoesNotReturnStaleResponseIfClientExplicitlyRequestsFreshWithMaxAge() throws Exception {
+ void testDoesNotReturnStaleResponseIfClientExplicitlyRequestsFreshWithMaxAge() throws Exception {
final ClassicHttpRequest req = new BasicClassicHttpRequest("GET", "/");
req.setHeader("Cache-Control","max-age=0");
testDoesNotReturnStaleResponseOnError(req);
}
@Test
- public void testDoesNotReturnStaleResponseIfClientExplicitlySpecifiesLargerMaxAge() throws Exception {
+ void testDoesNotReturnStaleResponseIfClientExplicitlySpecifiesLargerMaxAge() throws Exception {
final ClassicHttpRequest req = new BasicClassicHttpRequest("GET", "/");
req.setHeader("Cache-Control","max-age=20");
testDoesNotReturnStaleResponseOnError(req);
@@ -299,7 +299,7 @@ public class TestProtocolRecommendations {
@Test
- public void testDoesNotReturnStaleResponseIfClientExplicitlyRequestsFreshWithMinFresh() throws Exception {
+ void testDoesNotReturnStaleResponseIfClientExplicitlyRequestsFreshWithMinFresh() throws Exception {
final ClassicHttpRequest req = new BasicClassicHttpRequest("GET", "/");
req.setHeader("Cache-Control","min-fresh=2");
@@ -307,7 +307,7 @@ public class TestProtocolRecommendations {
}
@Test
- public void testDoesNotReturnStaleResponseIfClientExplicitlyRequestsFreshWithMaxStale() throws Exception {
+ void testDoesNotReturnStaleResponseIfClientExplicitlyRequestsFreshWithMaxStale() throws Exception {
final ClassicHttpRequest req = new BasicClassicHttpRequest("GET", "/");
req.setHeader("Cache-Control","max-stale=2");
@@ -315,7 +315,7 @@ public class TestProtocolRecommendations {
}
@Test
- public void testMayReturnStaleResponseIfClientExplicitlySpecifiesAcceptableMaxStale() throws Exception {
+ void testMayReturnStaleResponseIfClientExplicitlySpecifiesAcceptableMaxStale() throws Exception {
final ClassicHttpRequest req1 = requestToPopulateStaleCacheEntry();
final ClassicHttpRequest req2 = new BasicClassicHttpRequest("GET", "/");
req2.setHeader("Cache-Control","max-stale=20");
@@ -352,20 +352,20 @@ public class TestProtocolRecommendations {
}
@Test
- public void testDoesNotModifyAcceptRangesOnResponses() throws Exception {
+ void testDoesNotModifyAcceptRangesOnResponses() throws Exception {
final String headerName = "Accept-Ranges";
originResponse.setHeader(headerName,"bytes");
testDoesNotModifyHeaderOnResponses(headerName);
}
@Test
- public void testDoesNotModifyAuthorizationOnRequests() throws Exception {
+ void testDoesNotModifyAuthorizationOnRequests() throws Exception {
request.setHeader("Authorization", StandardAuthScheme.BASIC + " dXNlcjpwYXNzd2Q=");
testDoesNotModifyHeaderOnRequests("Authorization");
}
@Test
- public void testDoesNotModifyContentLengthOnRequests() throws Exception {
+ void testDoesNotModifyContentLengthOnRequests() throws Exception {
final ClassicHttpRequest post = new BasicClassicHttpRequest("POST", "/");
post.setEntity(HttpTestUtils.makeBody(128));
post.setHeader("Content-Length","128");
@@ -374,14 +374,14 @@ public class TestProtocolRecommendations {
}
@Test
- public void testDoesNotModifyContentLengthOnResponses() throws Exception {
+ void testDoesNotModifyContentLengthOnResponses() throws Exception {
originResponse.setEntity(HttpTestUtils.makeBody(128));
originResponse.setHeader("Content-Length","128");
testDoesNotModifyHeaderOnResponses("Content-Length");
}
@Test
- public void testDoesNotModifyContentMD5OnRequests() throws Exception {
+ void testDoesNotModifyContentMD5OnRequests() throws Exception {
final ClassicHttpRequest post = new BasicClassicHttpRequest("POST", "/");
post.setEntity(HttpTestUtils.makeBody(128));
post.setHeader("Content-Length","128");
@@ -391,14 +391,14 @@ public class TestProtocolRecommendations {
}
@Test
- public void testDoesNotModifyContentMD5OnResponses() throws Exception {
+ void testDoesNotModifyContentMD5OnResponses() throws Exception {
originResponse.setEntity(HttpTestUtils.makeBody(128));
originResponse.setHeader("Content-MD5","Q2hlY2sgSW50ZWdyaXR5IQ==");
testDoesNotModifyHeaderOnResponses("Content-MD5");
}
@Test
- public void testDoesNotModifyContentRangeOnRequests() throws Exception {
+ void testDoesNotModifyContentRangeOnRequests() throws Exception {
final ClassicHttpRequest put = new BasicClassicHttpRequest("PUT", "/");
put.setEntity(HttpTestUtils.makeBody(128));
put.setHeader("Content-Length","128");
@@ -408,7 +408,7 @@ public class TestProtocolRecommendations {
}
@Test
- public void testDoesNotModifyContentRangeOnResponses() throws Exception {
+ void testDoesNotModifyContentRangeOnResponses() throws Exception {
request.setHeader("Range","bytes=0-128");
originResponse.setCode(HttpStatus.SC_PARTIAL_CONTENT);
originResponse.setReasonPhrase("Partial Content");
@@ -418,7 +418,7 @@ public class TestProtocolRecommendations {
}
@Test
- public void testDoesNotModifyContentTypeOnRequests() throws Exception {
+ void testDoesNotModifyContentTypeOnRequests() throws Exception {
final ClassicHttpRequest post = new BasicClassicHttpRequest("POST", "/");
post.setEntity(HttpTestUtils.makeBody(128));
post.setHeader("Content-Length","128");
@@ -428,82 +428,82 @@ public class TestProtocolRecommendations {
}
@Test
- public void testDoesNotModifyContentTypeOnResponses() throws Exception {
+ void testDoesNotModifyContentTypeOnResponses() throws Exception {
originResponse.setHeader("Content-Type","application/octet-stream");
testDoesNotModifyHeaderOnResponses("Content-Type");
}
@Test
- public void testDoesNotModifyDateOnRequests() throws Exception {
+ void testDoesNotModifyDateOnRequests() throws Exception {
request.setHeader("Date", DateUtils.formatStandardDate(Instant.now()));
testDoesNotModifyHeaderOnRequests("Date");
}
@Test
- public void testDoesNotModifyDateOnResponses() throws Exception {
+ void testDoesNotModifyDateOnResponses() throws Exception {
originResponse.setHeader("Date", DateUtils.formatStandardDate(Instant.now()));
testDoesNotModifyHeaderOnResponses("Date");
}
@Test
- public void testDoesNotModifyETagOnResponses() throws Exception {
+ void testDoesNotModifyETagOnResponses() throws Exception {
originResponse.setHeader("ETag", "\"random-etag\"");
testDoesNotModifyHeaderOnResponses("ETag");
}
@Test
- public void testDoesNotModifyExpiresOnResponses() throws Exception {
+ void testDoesNotModifyExpiresOnResponses() throws Exception {
originResponse.setHeader("Expires", DateUtils.formatStandardDate(Instant.now()));
testDoesNotModifyHeaderOnResponses("Expires");
}
@Test
- public void testDoesNotModifyFromOnRequests() throws Exception {
+ void testDoesNotModifyFromOnRequests() throws Exception {
request.setHeader("From", "foo@example.com");
testDoesNotModifyHeaderOnRequests("From");
}
@Test
- public void testDoesNotModifyIfMatchOnRequests() throws Exception {
+ void testDoesNotModifyIfMatchOnRequests() throws Exception {
request = new BasicClassicHttpRequest("DELETE", "/");
request.setHeader("If-Match", "\"etag\"");
testDoesNotModifyHeaderOnRequests("If-Match");
}
@Test
- public void testDoesNotModifyIfModifiedSinceOnRequests() throws Exception {
+ void testDoesNotModifyIfModifiedSinceOnRequests() throws Exception {
request.setHeader("If-Modified-Since", DateUtils.formatStandardDate(Instant.now()));
testDoesNotModifyHeaderOnRequests("If-Modified-Since");
}
@Test
- public void testDoesNotModifyIfNoneMatchOnRequests() throws Exception {
+ void testDoesNotModifyIfNoneMatchOnRequests() throws Exception {
request.setHeader("If-None-Match", "\"etag\"");
testDoesNotModifyHeaderOnRequests("If-None-Match");
}
@Test
- public void testDoesNotModifyIfRangeOnRequests() throws Exception {
+ void testDoesNotModifyIfRangeOnRequests() throws Exception {
request.setHeader("Range","bytes=0-128");
request.setHeader("If-Range", "\"etag\"");
testDoesNotModifyHeaderOnRequests("If-Range");
}
@Test
- public void testDoesNotModifyIfUnmodifiedSinceOnRequests() throws Exception {
+ void testDoesNotModifyIfUnmodifiedSinceOnRequests() throws Exception {
request = new BasicClassicHttpRequest("DELETE", "/");
request.setHeader("If-Unmodified-Since", DateUtils.formatStandardDate(Instant.now()));
testDoesNotModifyHeaderOnRequests("If-Unmodified-Since");
}
@Test
- public void testDoesNotModifyLastModifiedOnResponses() throws Exception {
+ void testDoesNotModifyLastModifiedOnResponses() throws Exception {
originResponse.setHeader("Last-Modified", DateUtils.formatStandardDate(Instant.now()));
testDoesNotModifyHeaderOnResponses("Last-Modified");
}
@Test
- public void testDoesNotModifyLocationOnResponses() throws Exception {
+ void testDoesNotModifyLocationOnResponses() throws Exception {
originResponse.setCode(HttpStatus.SC_TEMPORARY_REDIRECT);
originResponse.setReasonPhrase("Temporary Redirect");
originResponse.setHeader("Location", "http://foo.example.com/bar");
@@ -511,19 +511,19 @@ public class TestProtocolRecommendations {
}
@Test
- public void testDoesNotModifyRangeOnRequests() throws Exception {
+ void testDoesNotModifyRangeOnRequests() throws Exception {
request.setHeader("Range", "bytes=0-128");
testDoesNotModifyHeaderOnRequests("Range");
}
@Test
- public void testDoesNotModifyRefererOnRequests() throws Exception {
+ void testDoesNotModifyRefererOnRequests() throws Exception {
request.setHeader("Referer", "http://foo.example.com/bar");
testDoesNotModifyHeaderOnRequests("Referer");
}
@Test
- public void testDoesNotModifyRetryAfterOnResponses() throws Exception {
+ void testDoesNotModifyRetryAfterOnResponses() throws Exception {
originResponse.setCode(HttpStatus.SC_SERVICE_UNAVAILABLE);
originResponse.setReasonPhrase("Service Unavailable");
originResponse.setHeader("Retry-After", "120");
@@ -531,38 +531,38 @@ public class TestProtocolRecommendations {
}
@Test
- public void testDoesNotModifyServerOnResponses() throws Exception {
+ void testDoesNotModifyServerOnResponses() throws Exception {
originResponse.setHeader("Server", "SomeServer/1.0");
testDoesNotModifyHeaderOnResponses("Server");
}
@Test
- public void testDoesNotModifyUserAgentOnRequests() throws Exception {
+ void testDoesNotModifyUserAgentOnRequests() throws Exception {
request.setHeader("User-Agent", "MyClient/1.0");
testDoesNotModifyHeaderOnRequests("User-Agent");
}
@Test
- public void testDoesNotModifyVaryOnResponses() throws Exception {
+ void testDoesNotModifyVaryOnResponses() throws Exception {
request.setHeader("Accept-Encoding","identity");
originResponse.setHeader("Vary", "Accept-Encoding");
testDoesNotModifyHeaderOnResponses("Vary");
}
@Test
- public void testDoesNotModifyExtensionHeaderOnRequests() throws Exception {
+ void testDoesNotModifyExtensionHeaderOnRequests() throws Exception {
request.setHeader("X-Extension","x-value");
testDoesNotModifyHeaderOnRequests("X-Extension");
}
@Test
- public void testDoesNotModifyExtensionHeaderOnResponses() throws Exception {
+ void testDoesNotModifyExtensionHeaderOnResponses() throws Exception {
originResponse.setHeader("X-Extension", "x-value");
testDoesNotModifyHeaderOnResponses("X-Extension");
}
@Test
- public void testUsesLastModifiedDateForCacheConditionalRequests() throws Exception {
+ void testUsesLastModifiedDateForCacheConditionalRequests() throws Exception {
final Instant twentySecondsAgo = now.plusSeconds(20);
final String lmDate = DateUtils.formatStandardDate(twentySecondsAgo);
@@ -592,7 +592,7 @@ public class TestProtocolRecommendations {
}
@Test
- public void testUsesBothLastModifiedAndETagForConditionalRequestsIfAvailable() throws Exception {
+ void testUsesBothLastModifiedAndETagForConditionalRequestsIfAvailable() throws Exception {
final Instant twentySecondsAgo = now.plusSeconds(20);
final String lmDate = DateUtils.formatStandardDate(twentySecondsAgo);
final String etag = "\"etag\"";
@@ -625,7 +625,7 @@ public class TestProtocolRecommendations {
}
@Test
- public void testRevalidatesCachedResponseWithExpirationInThePast() throws Exception {
+ void testRevalidatesCachedResponseWithExpirationInThePast() throws Exception {
final Instant oneSecondAgo = now.minusSeconds(1);
final Instant oneSecondFromNow = now.plusSeconds(1);
final Instant twoSecondsFromNow = now.plusSeconds(2);
@@ -656,7 +656,7 @@ public class TestProtocolRecommendations {
}
@Test
- public void testRetriesValidationThatResultsInAnOlderDated304Response() throws Exception {
+ void testRetriesValidationThatResultsInAnOlderDated304Response() throws Exception {
final Instant elevenSecondsAgo = now.minusSeconds(11);
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
@@ -708,7 +708,7 @@ public class TestProtocolRecommendations {
}
@Test
- public void testSendsAllVariantEtagsInConditionalRequest() throws Exception {
+ void testSendsAllVariantEtagsInConditionalRequest() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET","/");
req1.setHeader("User-Agent","agent1");
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
@@ -759,7 +759,7 @@ public class TestProtocolRecommendations {
}
@Test
- public void testResponseToExistingVariantsUpdatesEntry() throws Exception {
+ void testResponseToExistingVariantsUpdatesEntry() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
req1.setHeader("User-Agent", "agent1");
@@ -807,7 +807,7 @@ public class TestProtocolRecommendations {
}
@Test
- public void testResponseToExistingVariantsIsCachedForFutureResponses() throws Exception {
+ void testResponseToExistingVariantsIsCachedForFutureResponses() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
req1.setHeader("User-Agent", "agent1");
@@ -842,7 +842,7 @@ public class TestProtocolRecommendations {
}
@Test
- public void shouldInvalidateNonvariantCacheEntryForUnknownMethod() throws Exception {
+ void shouldInvalidateNonvariantCacheEntryForUnknownMethod() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
resp1.setHeader("Cache-Control","max-age=3600");
@@ -870,7 +870,7 @@ public class TestProtocolRecommendations {
}
@Test
- public void shouldInvalidateAllVariantsForUnknownMethod() throws Exception {
+ void shouldInvalidateAllVariantsForUnknownMethod() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
req1.setHeader("User-Agent", "agent1");
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
@@ -923,7 +923,7 @@ public class TestProtocolRecommendations {
}
@Test
- public void cacheShouldUpdateWithNewCacheableResponse() throws Exception {
+ void cacheShouldUpdateWithNewCacheableResponse() throws Exception {
final ClassicHttpRequest req1 = HttpTestUtils.makeDefaultRequest();
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
resp1.setHeader("Date", DateUtils.formatStandardDate(tenSecondsAgo));
@@ -952,7 +952,7 @@ public class TestProtocolRecommendations {
}
@Test
- public void expiresEqualToDateWithNoCacheControlIsNotCacheable() throws Exception {
+ void expiresEqualToDateWithNoCacheControlIsNotCacheable() throws Exception {
final ClassicHttpRequest req1 = HttpTestUtils.makeDefaultRequest();
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
resp1.setHeader("Date", DateUtils.formatStandardDate(now));
@@ -976,7 +976,7 @@ public class TestProtocolRecommendations {
}
@Test
- public void expiresPriorToDateWithNoCacheControlIsNotCacheable() throws Exception {
+ void expiresPriorToDateWithNoCacheControlIsNotCacheable() throws Exception {
final ClassicHttpRequest req1 = HttpTestUtils.makeDefaultRequest();
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
resp1.setHeader("Date", DateUtils.formatStandardDate(now));
@@ -1000,7 +1000,7 @@ public class TestProtocolRecommendations {
}
@Test
- public void cacheMissResultsIn504WithOnlyIfCached() throws Exception {
+ void cacheMissResultsIn504WithOnlyIfCached() throws Exception {
final ClassicHttpRequest req = HttpTestUtils.makeDefaultRequest();
req.setHeader("Cache-Control", "only-if-cached");
@@ -1010,7 +1010,7 @@ public class TestProtocolRecommendations {
}
@Test
- public void cacheHitOkWithOnlyIfCached() throws Exception {
+ void cacheHitOkWithOnlyIfCached() throws Exception {
final ClassicHttpRequest req1 = HttpTestUtils.makeDefaultRequest();
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
resp1.setHeader("Cache-Control","max-age=3600");
@@ -1027,7 +1027,7 @@ public class TestProtocolRecommendations {
}
@Test
- public void returns504ForStaleEntryWithOnlyIfCached() throws Exception {
+ void returns504ForStaleEntryWithOnlyIfCached() throws Exception {
final ClassicHttpRequest req1 = HttpTestUtils.makeDefaultRequest();
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
resp1.setHeader("Date", DateUtils.formatStandardDate(tenSecondsAgo));
@@ -1045,7 +1045,7 @@ public class TestProtocolRecommendations {
}
@Test
- public void returnsStaleCacheEntryWithOnlyIfCachedAndMaxStale() throws Exception {
+ void returnsStaleCacheEntryWithOnlyIfCachedAndMaxStale() throws Exception {
final ClassicHttpRequest req1 = HttpTestUtils.makeDefaultRequest();
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
@@ -1064,7 +1064,7 @@ public class TestProtocolRecommendations {
}
@Test
- public void issues304EvenWithWeakETag() throws Exception {
+ void issues304EvenWithWeakETag() throws Exception {
final ClassicHttpRequest req1 = HttpTestUtils.makeDefaultRequest();
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
resp1.setHeader("Date", DateUtils.formatStandardDate(tenSecondsAgo));
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestProtocolRequirements.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestProtocolRequirements.java
index e813b5ea6..02d22a80c 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestProtocolRequirements.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestProtocolRequirements.java
@@ -72,7 +72,7 @@ import org.mockito.MockitoAnnotations;
* This test class captures functionality required to achieve conditional
* compliance with the HTTP/1.1 caching protocol (MUST and MUST NOT behaviors).
*/
-public class TestProtocolRequirements {
+class TestProtocolRequirements {
static final int MAX_BYTES = 1024;
static final int MAX_ENTRIES = 100;
@@ -95,7 +95,7 @@ public class TestProtocolRequirements {
HttpCache cache;
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() throws Exception {
MockitoAnnotations.openMocks(this);
host = new HttpHost("foo.example.com", 80);
@@ -128,7 +128,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testCacheMissOnGETUsesOriginResponse() throws Exception {
+ void testCacheMissOnGETUsesOriginResponse() throws Exception {
Mockito.when(mockExecChain.proceed(RequestEquivalent.eq(request), Mockito.any())).thenReturn(originResponse);
@@ -149,7 +149,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testOrderOfMultipleAllowHeadersIsPreservedOnResponses() throws Exception {
+ void testOrderOfMultipleAllowHeadersIsPreservedOnResponses() throws Exception {
originResponse = new BasicClassicHttpResponse(405, "Method Not Allowed");
originResponse.addHeader("Allow", "HEAD");
originResponse.addHeader("Allow", "DELETE");
@@ -157,35 +157,35 @@ public class TestProtocolRequirements {
}
@Test
- public void testOrderOfMultipleCacheControlHeadersIsPreservedOnResponses() throws Exception {
+ void testOrderOfMultipleCacheControlHeadersIsPreservedOnResponses() throws Exception {
originResponse.addHeader("Cache-Control", "max-age=0");
originResponse.addHeader("Cache-Control", "no-store, must-revalidate");
testOrderOfMultipleHeadersIsPreservedOnResponses("Cache-Control");
}
@Test
- public void testOrderOfMultipleContentEncodingHeadersIsPreservedOnResponses() throws Exception {
+ void testOrderOfMultipleContentEncodingHeadersIsPreservedOnResponses() throws Exception {
originResponse.addHeader("Content-Encoding", "gzip");
originResponse.addHeader("Content-Encoding", "compress");
testOrderOfMultipleHeadersIsPreservedOnResponses("Content-Encoding");
}
@Test
- public void testOrderOfMultipleContentLanguageHeadersIsPreservedOnResponses() throws Exception {
+ void testOrderOfMultipleContentLanguageHeadersIsPreservedOnResponses() throws Exception {
originResponse.addHeader("Content-Language", "mi");
originResponse.addHeader("Content-Language", "en");
testOrderOfMultipleHeadersIsPreservedOnResponses("Content-Language");
}
@Test
- public void testOrderOfMultipleViaHeadersIsPreservedOnResponses() throws Exception {
+ void testOrderOfMultipleViaHeadersIsPreservedOnResponses() throws Exception {
originResponse.addHeader(HttpHeaders.VIA, "1.0 fred, 1.1 nowhere.com (Apache/1.1)");
originResponse.addHeader(HttpHeaders.VIA, "1.0 ricky, 1.1 mertz, 1.0 lucy");
testOrderOfMultipleHeadersIsPreservedOnResponses(HttpHeaders.VIA);
}
@Test
- public void testOrderOfMultipleWWWAuthenticateHeadersIsPreservedOnResponses() throws Exception {
+ void testOrderOfMultipleWWWAuthenticateHeadersIsPreservedOnResponses() throws Exception {
originResponse.addHeader("WWW-Authenticate", "x-challenge-1");
originResponse.addHeader("WWW-Authenticate", "x-challenge-2");
testOrderOfMultipleHeadersIsPreservedOnResponses("WWW-Authenticate");
@@ -208,7 +208,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testUnknownResponseStatusCodesAreNotCached() throws Exception {
+ void testUnknownResponseStatusCodesAreNotCached() throws Exception {
for (int i = 100; i <= 199; i++) {
testUnknownResponseStatusCodeIsNotCached(i);
}
@@ -227,7 +227,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testUnknownHeadersOnRequestsAreForwarded() throws Exception {
+ void testUnknownHeadersOnRequestsAreForwarded() throws Exception {
request.addHeader("X-Unknown-Header", "blahblah");
Mockito.when(mockExecChain.proceed(Mockito.any(), Mockito.any())).thenReturn(originResponse);
@@ -240,7 +240,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testUnknownHeadersOnResponsesAreForwarded() throws Exception {
+ void testUnknownHeadersOnResponsesAreForwarded() throws Exception {
originResponse.addHeader("X-Unknown-Header", "blahblah");
Mockito.when(mockExecChain.proceed(Mockito.any(), Mockito.any())).thenReturn(originResponse);
@@ -249,7 +249,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testResponsesToOPTIONSAreNotCacheable() throws Exception {
+ void testResponsesToOPTIONSAreNotCacheable() throws Exception {
request = new BasicClassicHttpRequest("OPTIONS", "/");
originResponse.addHeader("Cache-Control", "max-age=3600");
@@ -261,7 +261,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testResponsesToPOSTWithoutCacheControlOrExpiresAreNotCached() throws Exception {
+ void testResponsesToPOSTWithoutCacheControlOrExpiresAreNotCached() throws Exception {
final BasicClassicHttpRequest post = new BasicClassicHttpRequest("POST", "/");
post.setHeader("Content-Length", "128");
@@ -278,7 +278,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testResponsesToPUTsAreNotCached() throws Exception {
+ void testResponsesToPUTsAreNotCached() throws Exception {
final BasicClassicHttpRequest put = new BasicClassicHttpRequest("PUT", "/");
put.setEntity(HttpTestUtils.makeBody(128));
@@ -294,7 +294,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testResponsesToDELETEsAreNotCached() throws Exception {
+ void testResponsesToDELETEsAreNotCached() throws Exception {
request = new BasicClassicHttpRequest("DELETE", "/");
originResponse.setHeader("Cache-Control", "max-age=3600");
@@ -307,7 +307,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testResponsesToTRACEsAreNotCached() throws Exception {
+ void testResponsesToTRACEsAreNotCached() throws Exception {
request = new BasicClassicHttpRequest("TRACE", "/");
originResponse.setHeader("Cache-Control", "max-age=3600");
@@ -320,7 +320,7 @@ public class TestProtocolRequirements {
}
@Test
- public void test304ResponseGeneratedFromCacheIncludesDateHeader() throws Exception {
+ void test304ResponseGeneratedFromCacheIncludesDateHeader() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
originResponse.setHeader("Cache-Control", "max-age=3600");
@@ -340,7 +340,7 @@ public class TestProtocolRequirements {
}
@Test
- public void test304ResponseGeneratedFromCacheIncludesEtagIfOriginResponseDid() throws Exception {
+ void test304ResponseGeneratedFromCacheIncludesEtagIfOriginResponseDid() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
originResponse.setHeader("Cache-Control", "max-age=3600");
originResponse.setHeader("ETag", "\"etag\"");
@@ -359,7 +359,7 @@ public class TestProtocolRequirements {
}
@Test
- public void test304ResponseGeneratedFromCacheIncludesContentLocationIfOriginResponseDid() throws Exception {
+ void test304ResponseGeneratedFromCacheIncludesContentLocationIfOriginResponseDid() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
originResponse.setHeader("Cache-Control", "max-age=3600");
originResponse.setHeader("Content-Location", "http://foo.example.com/other");
@@ -379,7 +379,7 @@ public class TestProtocolRequirements {
}
@Test
- public void test304ResponseGeneratedFromCacheIncludesExpiresCacheControlAndOrVaryIfResponseMightDiffer() throws Exception {
+ void test304ResponseGeneratedFromCacheIncludesExpiresCacheControlAndOrVaryIfResponseMightDiffer() throws Exception {
final Instant now = Instant.now();
final Instant inTwoHours = now.plus(2, ChronoUnit.HOURS);
@@ -426,7 +426,7 @@ public class TestProtocolRequirements {
}
@Test
- public void test304GeneratedFromCacheOnWeakValidatorDoesNotIncludeOtherEntityHeaders() throws Exception {
+ void test304GeneratedFromCacheOnWeakValidatorDoesNotIncludeOtherEntityHeaders() throws Exception {
final Instant now = Instant.now();
final Instant oneHourAgo = now.minus(1, ChronoUnit.HOURS);
@@ -463,7 +463,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testNotModifiedOfNonCachedEntityShouldRevalidateWithUnconditionalGET() throws Exception {
+ void testNotModifiedOfNonCachedEntityShouldRevalidateWithUnconditionalGET() throws Exception {
final Instant now = Instant.now();
@@ -497,7 +497,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testCacheEntryIsUpdatedWithNewFieldValuesIn304Response() throws Exception {
+ void testCacheEntryIsUpdatedWithNewFieldValuesIn304Response() throws Exception {
final Instant now = Instant.now();
final Instant inFiveSeconds = now.plusSeconds(5);
@@ -539,7 +539,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testMustReturnACacheEntryIfItCanRevalidateIt() throws Exception {
+ void testMustReturnACacheEntryIfItCanRevalidateIt() throws Exception {
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
@@ -594,7 +594,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testMustReturnAFreshEnoughCacheEntryIfItHasIt() throws Exception {
+ void testMustReturnAFreshEnoughCacheEntryIfItHasIt() throws Exception {
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
@@ -624,7 +624,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testAgeHeaderPopulatedFromCacheEntryCurrentAge() throws Exception {
+ void testAgeHeaderPopulatedFromCacheEntryCurrentAge() throws Exception {
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
@@ -661,7 +661,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testKeepsMostRecentDateHeaderForFreshResponse() throws Exception {
+ void testKeepsMostRecentDateHeaderForFreshResponse() throws Exception {
final Instant now = Instant.now();
final Instant inFiveSecond = now.plusSeconds(5);
@@ -699,7 +699,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testValidationMustUseETagIfProvidedByOriginServer() throws Exception {
+ void testValidationMustUseETagIfProvidedByOriginServer() throws Exception {
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
@@ -744,7 +744,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testConditionalRequestWhereNotAllValidatorsMatchCannotBeServedFromCache() throws Exception {
+ void testConditionalRequestWhereNotAllValidatorsMatchCannotBeServedFromCache() throws Exception {
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
final Instant twentySecondsAgo = now.plusSeconds(20);
@@ -771,7 +771,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testConditionalRequestWhereAllValidatorsMatchMayBeServedFromCache() throws Exception {
+ void testConditionalRequestWhereAllValidatorsMatchMayBeServedFromCache() throws Exception {
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
@@ -797,7 +797,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testCacheWithoutSupportForRangeAndContentRangeHeadersDoesNotCacheA206Response() throws Exception {
+ void testCacheWithoutSupportForRangeAndContentRangeHeadersDoesNotCacheA206Response() throws Exception {
final ClassicHttpRequest req = new BasicClassicHttpRequest("GET", "/");
req.setHeader("Range", "bytes=0-50");
@@ -814,7 +814,7 @@ public class TestProtocolRequirements {
}
@Test
- public void test302ResponseWithoutExplicitCacheabilityIsNotReturnedFromCache() throws Exception {
+ void test302ResponseWithoutExplicitCacheabilityIsNotReturnedFromCache() throws Exception {
originResponse = new BasicClassicHttpResponse(302, "Temporary Redirect");
originResponse.setHeader("Location", "http://foo.example.com/other");
originResponse.removeHeaders("Expires");
@@ -840,24 +840,24 @@ public class TestProtocolRequirements {
}
@Test
- public void testDoesNotModifyContentLocationHeaderFromOrigin() throws Exception {
+ void testDoesNotModifyContentLocationHeaderFromOrigin() throws Exception {
final String url = "http://foo.example.com/other";
testDoesNotModifyHeaderFromOrigin("Content-Location", url);
}
@Test
- public void testDoesNotModifyContentMD5HeaderFromOrigin() throws Exception {
+ void testDoesNotModifyContentMD5HeaderFromOrigin() throws Exception {
testDoesNotModifyHeaderFromOrigin("Content-MD5", "Q2hlY2sgSW50ZWdyaXR5IQ==");
}
@Test
- public void testDoesNotModifyEtagHeaderFromOrigin() throws Exception {
+ void testDoesNotModifyEtagHeaderFromOrigin() throws Exception {
testDoesNotModifyHeaderFromOrigin("Etag", "\"the-etag\"");
}
@Test
- public void testDoesNotModifyLastModifiedHeaderFromOrigin() throws Exception {
+ void testDoesNotModifyLastModifiedHeaderFromOrigin() throws Exception {
final String lm = DateUtils.formatStandardDate(Instant.now());
testDoesNotModifyHeaderFromOrigin("Last-Modified", lm);
}
@@ -873,22 +873,22 @@ public class TestProtocolRequirements {
}
@Test
- public void testDoesNotAddContentLocationToOriginResponse() throws Exception {
+ void testDoesNotAddContentLocationToOriginResponse() throws Exception {
testDoesNotAddHeaderToOriginResponse("Content-Location");
}
@Test
- public void testDoesNotAddContentMD5ToOriginResponse() throws Exception {
+ void testDoesNotAddContentMD5ToOriginResponse() throws Exception {
testDoesNotAddHeaderToOriginResponse("Content-MD5");
}
@Test
- public void testDoesNotAddEtagToOriginResponse() throws Exception {
+ void testDoesNotAddEtagToOriginResponse() throws Exception {
testDoesNotAddHeaderToOriginResponse("ETag");
}
@Test
- public void testDoesNotAddLastModifiedToOriginResponse() throws Exception {
+ void testDoesNotAddLastModifiedToOriginResponse() throws Exception {
testDoesNotAddHeaderToOriginResponse("Last-Modified");
}
@@ -910,23 +910,23 @@ public class TestProtocolRequirements {
}
@Test
- public void testDoesNotModifyContentLocationFromOriginOnCacheHit() throws Exception {
+ void testDoesNotModifyContentLocationFromOriginOnCacheHit() throws Exception {
final String url = "http://foo.example.com/other";
testDoesNotModifyHeaderFromOriginOnCacheHit("Content-Location", url);
}
@Test
- public void testDoesNotModifyContentMD5FromOriginOnCacheHit() throws Exception {
+ void testDoesNotModifyContentMD5FromOriginOnCacheHit() throws Exception {
testDoesNotModifyHeaderFromOriginOnCacheHit("Content-MD5", "Q2hlY2sgSW50ZWdyaXR5IQ==");
}
@Test
- public void testDoesNotModifyEtagFromOriginOnCacheHit() throws Exception {
+ void testDoesNotModifyEtagFromOriginOnCacheHit() throws Exception {
testDoesNotModifyHeaderFromOriginOnCacheHit("Etag", "\"the-etag\"");
}
@Test
- public void testDoesNotModifyLastModifiedFromOriginOnCacheHit() throws Exception {
+ void testDoesNotModifyLastModifiedFromOriginOnCacheHit() throws Exception {
final Instant tenSecondsAgo = Instant.now().minusSeconds(10);
testDoesNotModifyHeaderFromOriginOnCacheHit("Last-Modified", DateUtils.formatStandardDate(tenSecondsAgo));
}
@@ -948,22 +948,22 @@ public class TestProtocolRequirements {
}
@Test
- public void testDoesNotAddContentLocationHeaderOnCacheHit() throws Exception {
+ void testDoesNotAddContentLocationHeaderOnCacheHit() throws Exception {
testDoesNotAddHeaderOnCacheHit("Content-Location");
}
@Test
- public void testDoesNotAddContentMD5HeaderOnCacheHit() throws Exception {
+ void testDoesNotAddContentMD5HeaderOnCacheHit() throws Exception {
testDoesNotAddHeaderOnCacheHit("Content-MD5");
}
@Test
- public void testDoesNotAddETagHeaderOnCacheHit() throws Exception {
+ void testDoesNotAddETagHeaderOnCacheHit() throws Exception {
testDoesNotAddHeaderOnCacheHit("ETag");
}
@Test
- public void testDoesNotAddLastModifiedHeaderOnCacheHit() throws Exception {
+ void testDoesNotAddLastModifiedHeaderOnCacheHit() throws Exception {
testDoesNotAddHeaderOnCacheHit("Last-Modified");
}
@@ -983,23 +983,23 @@ public class TestProtocolRequirements {
}
@Test
- public void testDoesNotModifyContentLocationHeaderOnRequest() throws Exception {
+ void testDoesNotModifyContentLocationHeaderOnRequest() throws Exception {
final String url = "http://foo.example.com/other";
testDoesNotModifyHeaderOnRequest("Content-Location",url);
}
@Test
- public void testDoesNotModifyContentMD5HeaderOnRequest() throws Exception {
+ void testDoesNotModifyContentMD5HeaderOnRequest() throws Exception {
testDoesNotModifyHeaderOnRequest("Content-MD5", "Q2hlY2sgSW50ZWdyaXR5IQ==");
}
@Test
- public void testDoesNotModifyETagHeaderOnRequest() throws Exception {
+ void testDoesNotModifyETagHeaderOnRequest() throws Exception {
testDoesNotModifyHeaderOnRequest("ETag","\"etag\"");
}
@Test
- public void testDoesNotModifyLastModifiedHeaderOnRequest() throws Exception {
+ void testDoesNotModifyLastModifiedHeaderOnRequest() throws Exception {
final Instant tenSecondsAgo = Instant.now().minusSeconds(10);
testDoesNotModifyHeaderOnRequest("Last-Modified", DateUtils.formatStandardDate(tenSecondsAgo));
}
@@ -1022,39 +1022,39 @@ public class TestProtocolRequirements {
}
@Test
- public void testDoesNotAddContentLocationToRequestIfNotPresent() throws Exception {
+ void testDoesNotAddContentLocationToRequestIfNotPresent() throws Exception {
testDoesNotAddHeaderToRequestIfNotPresent("Content-Location");
}
@Test
- public void testDoesNotAddContentMD5ToRequestIfNotPresent() throws Exception {
+ void testDoesNotAddContentMD5ToRequestIfNotPresent() throws Exception {
testDoesNotAddHeaderToRequestIfNotPresent("Content-MD5");
}
@Test
- public void testDoesNotAddETagToRequestIfNotPresent() throws Exception {
+ void testDoesNotAddETagToRequestIfNotPresent() throws Exception {
testDoesNotAddHeaderToRequestIfNotPresent("ETag");
}
@Test
- public void testDoesNotAddLastModifiedToRequestIfNotPresent() throws Exception {
+ void testDoesNotAddLastModifiedToRequestIfNotPresent() throws Exception {
testDoesNotAddHeaderToRequestIfNotPresent("Last-Modified");
}
@Test
- public void testDoesNotModifyExpiresHeaderFromOrigin() throws Exception {
+ void testDoesNotModifyExpiresHeaderFromOrigin() throws Exception {
final Instant tenSecondsAgo = Instant.now().minusSeconds(10);
testDoesNotModifyHeaderFromOrigin("Expires", DateUtils.formatStandardDate(tenSecondsAgo));
}
@Test
- public void testDoesNotModifyExpiresHeaderFromOriginOnCacheHit() throws Exception {
+ void testDoesNotModifyExpiresHeaderFromOriginOnCacheHit() throws Exception {
final Instant inTenSeconds = Instant.now().plusSeconds(10);
testDoesNotModifyHeaderFromOriginOnCacheHit("Expires", DateUtils.formatStandardDate(inTenSeconds));
}
@Test
- public void testExpiresHeaderMatchesDateIfAddedToOriginResponse() throws Exception {
+ void testExpiresHeaderMatchesDateIfAddedToOriginResponse() throws Exception {
originResponse.removeHeaders("Expires");
Mockito.when(mockExecChain.proceed(Mockito.any(), Mockito.any())).thenReturn(originResponse);
@@ -1080,12 +1080,12 @@ public class TestProtocolRequirements {
}
@Test
- public void testDoesNotModifyContentEncodingHeaderFromOriginResponseWithNoTransform() throws Exception {
+ void testDoesNotModifyContentEncodingHeaderFromOriginResponseWithNoTransform() throws Exception {
testDoesNotModifyHeaderFromOriginResponseWithNoTransform("Content-Encoding","gzip");
}
@Test
- public void testDoesNotModifyContentRangeHeaderFromOriginResponseWithNoTransform() throws Exception {
+ void testDoesNotModifyContentRangeHeaderFromOriginResponseWithNoTransform() throws Exception {
request.setHeader("If-Range","\"etag\"");
request.setHeader("Range","bytes=0-49");
@@ -1095,7 +1095,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testDoesNotModifyContentTypeHeaderFromOriginResponseWithNoTransform() throws Exception {
+ void testDoesNotModifyContentTypeHeaderFromOriginResponseWithNoTransform() throws Exception {
testDoesNotModifyHeaderFromOriginResponseWithNoTransform("Content-Type","text/html;charset=utf-8");
}
@@ -1115,85 +1115,85 @@ public class TestProtocolRequirements {
}
@Test
- public void testDoesNotModifyContentEncodingHeaderOnCachedResponseWithNoTransform() throws Exception {
+ void testDoesNotModifyContentEncodingHeaderOnCachedResponseWithNoTransform() throws Exception {
testDoesNotModifyHeaderOnCachedResponseWithNoTransform("Content-Encoding","gzip");
}
@Test
- public void testDoesNotModifyContentTypeHeaderOnCachedResponseWithNoTransform() throws Exception {
+ void testDoesNotModifyContentTypeHeaderOnCachedResponseWithNoTransform() throws Exception {
testDoesNotModifyHeaderOnCachedResponseWithNoTransform("Content-Type","text/html;charset=utf-8");
}
@Test
- public void testDoesNotAddContentEncodingHeaderToOriginResponseWithNoTransformIfNotPresent() throws Exception {
+ void testDoesNotAddContentEncodingHeaderToOriginResponseWithNoTransformIfNotPresent() throws Exception {
originResponse.addHeader("Cache-Control","no-transform");
testDoesNotAddHeaderToOriginResponse("Content-Encoding");
}
@Test
- public void testDoesNotAddContentRangeHeaderToOriginResponseWithNoTransformIfNotPresent() throws Exception {
+ void testDoesNotAddContentRangeHeaderToOriginResponseWithNoTransformIfNotPresent() throws Exception {
originResponse.addHeader("Cache-Control","no-transform");
testDoesNotAddHeaderToOriginResponse("Content-Range");
}
@Test
- public void testDoesNotAddContentTypeHeaderToOriginResponseWithNoTransformIfNotPresent() throws Exception {
+ void testDoesNotAddContentTypeHeaderToOriginResponseWithNoTransformIfNotPresent() throws Exception {
originResponse.addHeader("Cache-Control","no-transform");
testDoesNotAddHeaderToOriginResponse("Content-Type");
}
/* no add on cache hit with no-transform */
@Test
- public void testDoesNotAddContentEncodingHeaderToCachedResponseWithNoTransformIfNotPresent() throws Exception {
+ void testDoesNotAddContentEncodingHeaderToCachedResponseWithNoTransformIfNotPresent() throws Exception {
originResponse.addHeader("Cache-Control","no-transform");
testDoesNotAddHeaderOnCacheHit("Content-Encoding");
}
@Test
- public void testDoesNotAddContentRangeHeaderToCachedResponseWithNoTransformIfNotPresent() throws Exception {
+ void testDoesNotAddContentRangeHeaderToCachedResponseWithNoTransformIfNotPresent() throws Exception {
originResponse.addHeader("Cache-Control","no-transform");
testDoesNotAddHeaderOnCacheHit("Content-Range");
}
@Test
- public void testDoesNotAddContentTypeHeaderToCachedResponseWithNoTransformIfNotPresent() throws Exception {
+ void testDoesNotAddContentTypeHeaderToCachedResponseWithNoTransformIfNotPresent() throws Exception {
originResponse.addHeader("Cache-Control","no-transform");
testDoesNotAddHeaderOnCacheHit("Content-Type");
}
/* no modify on request */
@Test
- public void testDoesNotAddContentEncodingToRequestIfNotPresent() throws Exception {
+ void testDoesNotAddContentEncodingToRequestIfNotPresent() throws Exception {
testDoesNotAddHeaderToRequestIfNotPresent("Content-Encoding");
}
@Test
- public void testDoesNotAddContentRangeToRequestIfNotPresent() throws Exception {
+ void testDoesNotAddContentRangeToRequestIfNotPresent() throws Exception {
testDoesNotAddHeaderToRequestIfNotPresent("Content-Range");
}
@Test
- public void testDoesNotAddContentTypeToRequestIfNotPresent() throws Exception {
+ void testDoesNotAddContentTypeToRequestIfNotPresent() throws Exception {
testDoesNotAddHeaderToRequestIfNotPresent("Content-Type");
}
@Test
- public void testDoesNotAddContentEncodingHeaderToRequestIfNotPresent() throws Exception {
+ void testDoesNotAddContentEncodingHeaderToRequestIfNotPresent() throws Exception {
testDoesNotAddHeaderToRequestIfNotPresent("Content-Encoding");
}
@Test
- public void testDoesNotAddContentRangeHeaderToRequestIfNotPresent() throws Exception {
+ void testDoesNotAddContentRangeHeaderToRequestIfNotPresent() throws Exception {
testDoesNotAddHeaderToRequestIfNotPresent("Content-Range");
}
@Test
- public void testDoesNotAddContentTypeHeaderToRequestIfNotPresent() throws Exception {
+ void testDoesNotAddContentTypeHeaderToRequestIfNotPresent() throws Exception {
testDoesNotAddHeaderToRequestIfNotPresent("Content-Type");
}
@Test
- public void testCachedEntityBodyIsUsedForResponseAfter304Validation() throws Exception {
+ void testCachedEntityBodyIsUsedForResponseAfter304Validation() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
resp1.setHeader("Cache-Control","max-age=3600");
@@ -1238,7 +1238,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testResponseIncludesCacheEntryEndToEndHeadersForResponseAfter304Validation() throws Exception {
+ void testResponseIncludesCacheEntryEndToEndHeadersForResponseAfter304Validation() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
resp1.setHeader("Cache-Control","max-age=3600");
@@ -1271,7 +1271,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testUpdatedEndToEndHeadersFrom304ArePassedOnResponseAndUpdatedInCacheEntry() throws Exception {
+ void testUpdatedEndToEndHeadersFrom304ArePassedOnResponseAndUpdatedInCacheEntry() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
@@ -1317,7 +1317,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testMultiHeadersAreSuccessfullyReplacedOn304Validation() throws Exception {
+ void testMultiHeadersAreSuccessfullyReplacedOn304Validation() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
resp1.addHeader("Cache-Control","max-age=3600");
@@ -1348,7 +1348,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testCannotUseVariantCacheEntryIfNotAllSelectingRequestHeadersMatch() throws Exception {
+ void testCannotUseVariantCacheEntryIfNotAllSelectingRequestHeadersMatch() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
req1.setHeader("Accept-Encoding","gzip");
@@ -1378,7 +1378,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testCannotServeFromCacheForVaryStar() throws Exception {
+ void testCannotServeFromCacheForVaryStar() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
@@ -1405,7 +1405,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testNonMatchingVariantCannotBeServedFromCacheUnlessConditionallyValidated() throws Exception {
+ void testNonMatchingVariantCannotBeServedFromCacheUnlessConditionallyValidated() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
req1.setHeader("User-Agent","MyBrowser/1.0");
@@ -1473,19 +1473,19 @@ public class TestProtocolRequirements {
}
@Test
- public void testPutToUriInvalidatesCacheForThatUri() throws Exception {
+ void testPutToUriInvalidatesCacheForThatUri() throws Exception {
final ClassicHttpRequest req = makeRequestWithBody("PUT","/");
testUnsafeOperationInvalidatesCacheForThatUri(req);
}
@Test
- public void testDeleteToUriInvalidatesCacheForThatUri() throws Exception {
+ void testDeleteToUriInvalidatesCacheForThatUri() throws Exception {
final ClassicHttpRequest req = new BasicClassicHttpRequest("DELETE","/");
testUnsafeOperationInvalidatesCacheForThatUri(req);
}
@Test
- public void testPostToUriInvalidatesCacheForThatUri() throws Exception {
+ void testPostToUriInvalidatesCacheForThatUri() throws Exception {
final ClassicHttpRequest req = makeRequestWithBody("POST","/");
testUnsafeOperationInvalidatesCacheForThatUri(req);
}
@@ -1535,55 +1535,55 @@ public class TestProtocolRequirements {
}
@Test
- public void testPutInvalidatesCacheForThatUriInContentLocationHeader() throws Exception {
+ void testPutInvalidatesCacheForThatUriInContentLocationHeader() throws Exception {
final ClassicHttpRequest req2 = makeRequestWithBody("PUT","/");
testUnsafeMethodInvalidatesCacheForUriInContentLocationHeader(req2);
}
@Test
- public void testPutInvalidatesCacheForThatUriInLocationHeader() throws Exception {
+ void testPutInvalidatesCacheForThatUriInLocationHeader() throws Exception {
final ClassicHttpRequest req = makeRequestWithBody("PUT","/");
testUnsafeMethodInvalidatesCacheForUriInLocationHeader(req);
}
@Test
- public void testPutInvalidatesCacheForThatUriInRelativeContentLocationHeader() throws Exception {
+ void testPutInvalidatesCacheForThatUriInRelativeContentLocationHeader() throws Exception {
final ClassicHttpRequest req = makeRequestWithBody("PUT","/");
testUnsafeMethodInvalidatesCacheForRelativeUriInContentLocationHeader(req);
}
@Test
- public void testDeleteInvalidatesCacheForThatUriInContentLocationHeader() throws Exception {
+ void testDeleteInvalidatesCacheForThatUriInContentLocationHeader() throws Exception {
final ClassicHttpRequest req = new BasicClassicHttpRequest("DELETE", "/");
testUnsafeMethodInvalidatesCacheForUriInContentLocationHeader(req);
}
@Test
- public void testDeleteInvalidatesCacheForThatUriInRelativeContentLocationHeader() throws Exception {
+ void testDeleteInvalidatesCacheForThatUriInRelativeContentLocationHeader() throws Exception {
final ClassicHttpRequest req = new BasicClassicHttpRequest("DELETE", "/");
testUnsafeMethodInvalidatesCacheForRelativeUriInContentLocationHeader(req);
}
@Test
- public void testDeleteInvalidatesCacheForThatUriInLocationHeader() throws Exception {
+ void testDeleteInvalidatesCacheForThatUriInLocationHeader() throws Exception {
final ClassicHttpRequest req = new BasicClassicHttpRequest("DELETE", "/");
testUnsafeMethodInvalidatesCacheForUriInLocationHeader(req);
}
@Test
- public void testPostInvalidatesCacheForThatUriInContentLocationHeader() throws Exception {
+ void testPostInvalidatesCacheForThatUriInContentLocationHeader() throws Exception {
final ClassicHttpRequest req = makeRequestWithBody("POST","/");
testUnsafeMethodInvalidatesCacheForUriInContentLocationHeader(req);
}
@Test
- public void testPostInvalidatesCacheForThatUriInLocationHeader() throws Exception {
+ void testPostInvalidatesCacheForThatUriInLocationHeader() throws Exception {
final ClassicHttpRequest req = makeRequestWithBody("POST","/");
testUnsafeMethodInvalidatesCacheForUriInLocationHeader(req);
}
@Test
- public void testPostInvalidatesCacheForRelativeUriInContentLocationHeader() throws Exception {
+ void testPostInvalidatesCacheForRelativeUriInContentLocationHeader() throws Exception {
final ClassicHttpRequest req = makeRequestWithBody("POST","/");
testUnsafeMethodInvalidatesCacheForRelativeUriInContentLocationHeader(req);
}
@@ -1597,13 +1597,13 @@ public class TestProtocolRequirements {
}
@Test
- public void testOPTIONSRequestsAreWrittenThroughToOrigin() throws Exception {
+ void testOPTIONSRequestsAreWrittenThroughToOrigin() throws Exception {
final ClassicHttpRequest req = new BasicClassicHttpRequest("OPTIONS","*");
testRequestIsWrittenThroughToOrigin(req);
}
@Test
- public void testPOSTRequestsAreWrittenThroughToOrigin() throws Exception {
+ void testPOSTRequestsAreWrittenThroughToOrigin() throws Exception {
final ClassicHttpRequest req = new BasicClassicHttpRequest("POST","/");
req.setEntity(HttpTestUtils.makeBody(128));
req.setHeader("Content-Length","128");
@@ -1611,7 +1611,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testPUTRequestsAreWrittenThroughToOrigin() throws Exception {
+ void testPUTRequestsAreWrittenThroughToOrigin() throws Exception {
final ClassicHttpRequest req = new BasicClassicHttpRequest("PUT","/");
req.setEntity(HttpTestUtils.makeBody(128));
req.setHeader("Content-Length","128");
@@ -1619,31 +1619,31 @@ public class TestProtocolRequirements {
}
@Test
- public void testDELETERequestsAreWrittenThroughToOrigin() throws Exception {
+ void testDELETERequestsAreWrittenThroughToOrigin() throws Exception {
final ClassicHttpRequest req = new BasicClassicHttpRequest("DELETE", "/");
testRequestIsWrittenThroughToOrigin(req);
}
@Test
- public void testTRACERequestsAreWrittenThroughToOrigin() throws Exception {
+ void testTRACERequestsAreWrittenThroughToOrigin() throws Exception {
final ClassicHttpRequest req = new BasicClassicHttpRequest("TRACE","/");
testRequestIsWrittenThroughToOrigin(req);
}
@Test
- public void testCONNECTRequestsAreWrittenThroughToOrigin() throws Exception {
+ void testCONNECTRequestsAreWrittenThroughToOrigin() throws Exception {
final ClassicHttpRequest req = new BasicClassicHttpRequest("CONNECT","/");
testRequestIsWrittenThroughToOrigin(req);
}
@Test
- public void testUnknownMethodRequestsAreWrittenThroughToOrigin() throws Exception {
+ void testUnknownMethodRequestsAreWrittenThroughToOrigin() throws Exception {
final ClassicHttpRequest req = new BasicClassicHttpRequest("UNKNOWN","/");
testRequestIsWrittenThroughToOrigin(req);
}
@Test
- public void testTransmitsAgeHeaderIfIncomingAgeHeaderTooBig() throws Exception {
+ void testTransmitsAgeHeaderIfIncomingAgeHeaderTooBig() throws Exception {
final String reallyOldAge = "1" + Long.MAX_VALUE;
originResponse.setHeader("Age",reallyOldAge);
@@ -1656,7 +1656,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testDoesNotModifyAllowHeaderWithUnknownMethods() throws Exception {
+ void testDoesNotModifyAllowHeaderWithUnknownMethods() throws Exception {
final String allowHeaderValue = "GET, HEAD, FOOBAR";
originResponse.setHeader("Allow",allowHeaderValue);
Mockito.when(mockExecChain.proceed(Mockito.any(), Mockito.any())).thenReturn(originResponse);
@@ -1690,7 +1690,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testSharedCacheMustNotNormallyCacheAuthorizedResponses() throws Exception {
+ void testSharedCacheMustNotNormallyCacheAuthorizedResponses() throws Exception {
final ClassicHttpResponse resp = HttpTestUtils.make200Response();
resp.setHeader("Cache-Control","max-age=3600");
resp.setHeader("ETag","\"etag\"");
@@ -1698,7 +1698,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testSharedCacheMayCacheAuthorizedResponsesWithSMaxAgeHeader() throws Exception {
+ void testSharedCacheMayCacheAuthorizedResponsesWithSMaxAgeHeader() throws Exception {
final ClassicHttpResponse resp = HttpTestUtils.make200Response();
resp.setHeader("Cache-Control","s-maxage=3600");
resp.setHeader("ETag","\"etag\"");
@@ -1706,7 +1706,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testSharedCacheMustRevalidateAuthorizedResponsesWhenSMaxAgeIsZero() throws Exception {
+ void testSharedCacheMustRevalidateAuthorizedResponsesWhenSMaxAgeIsZero() throws Exception {
final ClassicHttpResponse resp = HttpTestUtils.make200Response();
resp.setHeader("Cache-Control","s-maxage=0");
resp.setHeader("ETag","\"etag\"");
@@ -1714,7 +1714,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testSharedCacheMayCacheAuthorizedResponsesWithMustRevalidate() throws Exception {
+ void testSharedCacheMayCacheAuthorizedResponsesWithMustRevalidate() throws Exception {
final ClassicHttpResponse resp = HttpTestUtils.make200Response();
resp.setHeader("Cache-Control","must-revalidate");
resp.setHeader("ETag","\"etag\"");
@@ -1722,7 +1722,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testSharedCacheMayCacheAuthorizedResponsesWithCacheControlPublic() throws Exception {
+ void testSharedCacheMayCacheAuthorizedResponsesWithCacheControlPublic() throws Exception {
final ClassicHttpResponse resp = HttpTestUtils.make200Response();
resp.setHeader("Cache-Control","public");
testSharedCacheRevalidatesAuthorizedResponse(resp, 0, 1);
@@ -1763,7 +1763,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testSharedCacheMustUseNewRequestHeadersWhenRevalidatingAuthorizedResponsesWithSMaxAge() throws Exception {
+ void testSharedCacheMustUseNewRequestHeadersWhenRevalidatingAuthorizedResponsesWithSMaxAge() throws Exception {
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
@@ -1775,7 +1775,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testSharedCacheMustUseNewRequestHeadersWhenRevalidatingAuthorizedResponsesWithMustRevalidate() throws Exception {
+ void testSharedCacheMustUseNewRequestHeadersWhenRevalidatingAuthorizedResponsesWithMustRevalidate() throws Exception {
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
@@ -1814,7 +1814,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testCacheIsNotUsedWhenRespondingToRequestWithCacheControlNoCache() throws Exception {
+ void testCacheIsNotUsedWhenRespondingToRequestWithCacheControlNoCache() throws Exception {
final ClassicHttpRequest req = new BasicClassicHttpRequest("GET", "/");
req.setHeader("Cache-Control","no-cache");
testCacheIsNotUsedWhenRespondingToRequest(req);
@@ -1856,7 +1856,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testStaleEntryWithMustRevalidateIsNotUsedWithoutRevalidatingWithOrigin() throws Exception {
+ void testStaleEntryWithMustRevalidateIsNotUsedWithoutRevalidatingWithOrigin() throws Exception {
final ClassicHttpResponse response = HttpTestUtils.make200Response();
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
@@ -1886,7 +1886,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testGenerates504IfCannotRevalidateAMustRevalidateEntry() throws Exception {
+ void testGenerates504IfCannotRevalidateAMustRevalidateEntry() throws Exception {
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
@@ -1898,7 +1898,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testStaleEntryWithProxyRevalidateOnSharedCacheIsNotUsedWithoutRevalidatingWithOrigin() throws Exception {
+ void testStaleEntryWithProxyRevalidateOnSharedCacheIsNotUsedWithoutRevalidatingWithOrigin() throws Exception {
if (config.isSharedCache()) {
final ClassicHttpResponse response = HttpTestUtils.make200Response();
final Instant now = Instant.now();
@@ -1912,7 +1912,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testGenerates504IfSharedCacheCannotRevalidateAProxyRevalidateEntry() throws Exception {
+ void testGenerates504IfSharedCacheCannotRevalidateAProxyRevalidateEntry() throws Exception {
if (config.isSharedCache()) {
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
final Instant now = Instant.now();
@@ -1926,7 +1926,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testCacheControlPrivateIsNotCacheableBySharedCache() throws Exception {
+ void testCacheControlPrivateIsNotCacheableBySharedCache() throws Exception {
if (config.isSharedCache()) {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
@@ -1945,7 +1945,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testCacheControlPrivateOnFieldIsNotReturnedBySharedCache() throws Exception {
+ void testCacheControlPrivateOnFieldIsNotReturnedBySharedCache() throws Exception {
if (config.isSharedCache()) {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
@@ -1970,7 +1970,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testNoCacheCannotSatisfyASubsequentRequestWithoutRevalidation() throws Exception {
+ void testNoCacheCannotSatisfyASubsequentRequestWithoutRevalidation() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
resp1.setHeader("ETag","\"etag\"");
@@ -1992,7 +1992,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testNoCacheCannotSatisfyASubsequentRequestWithoutRevalidationEvenWithContraryIndications() throws Exception {
+ void testNoCacheCannotSatisfyASubsequentRequestWithoutRevalidationEvenWithContraryIndications() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
resp1.setHeader("ETag","\"etag\"");
@@ -2013,7 +2013,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testNoCacheOnFieldIsNotReturnedWithoutRevalidation() throws Exception {
+ void testNoCacheOnFieldIsNotReturnedWithoutRevalidation() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
resp1.setHeader("ETag","\"etag\"");
@@ -2044,7 +2044,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testNoStoreOnRequestIsNotStoredInCache() throws Exception {
+ void testNoStoreOnRequestIsNotStoredInCache() throws Exception {
request.setHeader("Cache-Control","no-store");
Mockito.when(mockExecChain.proceed(Mockito.any(), Mockito.any())).thenReturn(originResponse);
@@ -2054,7 +2054,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testNoStoreOnRequestIsNotStoredInCacheEvenIfResponseMarkedCacheable() throws Exception {
+ void testNoStoreOnRequestIsNotStoredInCacheEvenIfResponseMarkedCacheable() throws Exception {
request.setHeader("Cache-Control","no-store");
originResponse.setHeader("Cache-Control","max-age=3600");
Mockito.when(mockExecChain.proceed(Mockito.any(), Mockito.any())).thenReturn(originResponse);
@@ -2065,7 +2065,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testNoStoreOnResponseIsNotStoredInCache() throws Exception {
+ void testNoStoreOnResponseIsNotStoredInCache() throws Exception {
originResponse.setHeader("Cache-Control","no-store");
Mockito.when(mockExecChain.proceed(Mockito.any(), Mockito.any())).thenReturn(originResponse);
@@ -2075,7 +2075,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testNoStoreOnResponseIsNotStoredInCacheEvenWithContraryIndicators() throws Exception {
+ void testNoStoreOnResponseIsNotStoredInCacheEvenWithContraryIndicators() throws Exception {
originResponse.setHeader("Cache-Control","no-store,max-age=3600");
Mockito.when(mockExecChain.proceed(Mockito.any(), Mockito.any())).thenReturn(originResponse);
@@ -2085,7 +2085,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testOrderOfMultipleContentEncodingHeaderValuesIsPreserved() throws Exception {
+ void testOrderOfMultipleContentEncodingHeaderValuesIsPreserved() throws Exception {
originResponse.addHeader("Content-Encoding","gzip");
originResponse.addHeader("Content-Encoding","deflate");
Mockito.when(mockExecChain.proceed(Mockito.any(), Mockito.any())).thenReturn(originResponse);
@@ -2111,7 +2111,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testOrderOfMultipleParametersInContentEncodingHeaderIsPreserved() throws Exception {
+ void testOrderOfMultipleParametersInContentEncodingHeaderIsPreserved() throws Exception {
originResponse.addHeader("Content-Encoding","gzip,deflate");
Mockito.when(mockExecChain.proceed(Mockito.any(), Mockito.any())).thenReturn(originResponse);
@@ -2136,7 +2136,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testCacheDoesNotAssumeContentLocationHeaderIndicatesAnotherCacheableResource() throws Exception {
+ void testCacheDoesNotAssumeContentLocationHeaderIndicatesAnotherCacheableResource() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/foo");
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
resp1.setHeader("Cache-Control","public,max-age=3600");
@@ -2157,7 +2157,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testCachedResponsesWithMissingDateHeadersShouldBeAssignedOne() throws Exception {
+ void testCachedResponsesWithMissingDateHeadersShouldBeAssignedOne() throws Exception {
originResponse.removeHeaders("Date");
originResponse.setHeader("Cache-Control","public");
originResponse.setHeader("ETag","\"etag\"");
@@ -2189,17 +2189,17 @@ public class TestProtocolRequirements {
}
@Test
- public void testMalformedExpiresHeaderIsTreatedAsStale() throws Exception {
+ void testMalformedExpiresHeaderIsTreatedAsStale() throws Exception {
testInvalidExpiresHeaderIsTreatedAsStale("garbage");
}
@Test
- public void testExpiresZeroHeaderIsTreatedAsStale() throws Exception {
+ void testExpiresZeroHeaderIsTreatedAsStale() throws Exception {
testInvalidExpiresHeaderIsTreatedAsStale("0");
}
@Test
- public void testExpiresHeaderEqualToDateHeaderIsTreatedAsStale() throws Exception {
+ void testExpiresHeaderEqualToDateHeaderIsTreatedAsStale() throws Exception {
final ClassicHttpRequest req1 = new BasicClassicHttpRequest("GET", "/");
final ClassicHttpResponse resp1 = HttpTestUtils.make200Response();
resp1.setHeader("Cache-Control","public");
@@ -2219,7 +2219,7 @@ public class TestProtocolRequirements {
}
@Test
- public void testDoesNotModifyServerResponseHeader() throws Exception {
+ void testDoesNotModifyServerResponseHeader() throws Exception {
final String server = "MockServer/1.0";
originResponse.setHeader("Server", server);
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestRFC5861Compliance.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestRFC5861Compliance.java
index 6d7114d16..1d43834ca 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestRFC5861Compliance.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestRFC5861Compliance.java
@@ -61,7 +61,7 @@ import org.mockito.MockitoAnnotations;
* describes the stale-if-error and stale-while-revalidate
* Cache-Control extensions.
*/
-public class TestRFC5861Compliance {
+class TestRFC5861Compliance {
static final int MAX_BYTES = 1024;
static final int MAX_ENTRIES = 100;
@@ -83,7 +83,7 @@ public class TestRFC5861Compliance {
ScheduledExecutorService executorService;
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() throws Exception {
MockitoAnnotations.openMocks(this);
host = new HttpHost("foo.example.com", 80);
@@ -113,7 +113,7 @@ public class TestRFC5861Compliance {
}
@AfterEach
- public void cleanup() {
+ void cleanup() {
executorService.shutdownNow();
}
@@ -125,7 +125,7 @@ public class TestRFC5861Compliance {
}
@Test
- public void testConsumesErrorResponseWhenServingStale()
+ void testConsumesErrorResponseWhenServingStale()
throws Exception{
final Instant tenSecondsAgo = Instant.now().minusSeconds(10);
final ClassicHttpRequest req1 = HttpTestUtils.makeDefaultRequest();
@@ -152,7 +152,7 @@ public class TestRFC5861Compliance {
}
@Test
- public void testStaleIfErrorInResponseYieldsToMustRevalidate()
+ void testStaleIfErrorInResponseYieldsToMustRevalidate()
throws Exception{
final Instant tenSecondsAgo = Instant.now().minusSeconds(10);
final ClassicHttpRequest req1 = HttpTestUtils.makeDefaultRequest();
@@ -174,7 +174,7 @@ public class TestRFC5861Compliance {
}
@Test
- public void testStaleIfErrorInResponseYieldsToProxyRevalidateForSharedCache()
+ void testStaleIfErrorInResponseYieldsToProxyRevalidateForSharedCache()
throws Exception{
assertTrue(config.isSharedCache());
final Instant tenSecondsAgo = Instant.now().minusSeconds(10);
@@ -197,7 +197,7 @@ public class TestRFC5861Compliance {
}
@Test
- public void testStaleIfErrorInResponseYieldsToExplicitFreshnessRequest()
+ void testStaleIfErrorInResponseYieldsToExplicitFreshnessRequest()
throws Exception{
final Instant tenSecondsAgo = Instant.now().minusSeconds(10);
final ClassicHttpRequest req1 = HttpTestUtils.makeDefaultRequest();
@@ -220,7 +220,7 @@ public class TestRFC5861Compliance {
}
@Test
- public void testStaleIfErrorInResponseIsFalseReturnsError()
+ void testStaleIfErrorInResponseIsFalseReturnsError()
throws Exception{
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
@@ -244,7 +244,7 @@ public class TestRFC5861Compliance {
}
@Test
- public void testStaleIfErrorInRequestIsFalseReturnsError()
+ void testStaleIfErrorInRequestIsFalseReturnsError()
throws Exception{
final Instant now = Instant.now();
final Instant tenSecondsAgo = now.minusSeconds(10);
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestResponseCacheConformance.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestResponseCacheConformance.java
index c35247898..df347b7b8 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestResponseCacheConformance.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestResponseCacheConformance.java
@@ -37,12 +37,12 @@ import org.apache.hc.core5.http.support.BasicResponseBuilder;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class TestResponseCacheConformance {
+class TestResponseCacheConformance {
private ResponseCacheConformance impl;
@BeforeEach
- public void setUp() {
+ void setUp() {
impl = ResponseCacheConformance.INSTANCE;
}
@@ -58,31 +58,31 @@ public class TestResponseCacheConformance {
}
@Test
- public void shouldStripContentEncodingFromOrigin304ResponseToStrongValidation() throws Exception {
+ void shouldStripContentEncodingFromOrigin304ResponseToStrongValidation() throws Exception {
shouldStripEntityHeaderFromOrigin304ResponseToStrongValidation(
"Content-Encoding", "gzip");
}
@Test
- public void shouldStripContentLanguageFromOrigin304ResponseToStrongValidation() throws Exception {
+ void shouldStripContentLanguageFromOrigin304ResponseToStrongValidation() throws Exception {
shouldStripEntityHeaderFromOrigin304ResponseToStrongValidation(
"Content-Language", "en");
}
@Test
- public void shouldStripContentLengthFromOrigin304ResponseToStrongValidation() throws Exception {
+ void shouldStripContentLengthFromOrigin304ResponseToStrongValidation() throws Exception {
shouldStripEntityHeaderFromOrigin304ResponseToStrongValidation(
"Content-Length", "128");
}
@Test
- public void shouldStripContentMD5FromOrigin304ResponseToStrongValidation() throws Exception {
+ void shouldStripContentMD5FromOrigin304ResponseToStrongValidation() throws Exception {
shouldStripEntityHeaderFromOrigin304ResponseToStrongValidation(
"Content-MD5", "Q2hlY2sgSW50ZWdyaXR5IQ==");
}
@Test
- public void shouldStripContentTypeFromOrigin304ResponseToStrongValidation() throws Exception {
+ void shouldStripContentTypeFromOrigin304ResponseToStrongValidation() throws Exception {
shouldStripEntityHeaderFromOrigin304ResponseToStrongValidation(
"Content-Type", "text/html;charset=utf-8");
}
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestResponseCachingPolicy.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestResponseCachingPolicy.java
index c2c5cb53d..d87debe50 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestResponseCachingPolicy.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestResponseCachingPolicy.java
@@ -50,7 +50,7 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class TestResponseCachingPolicy {
+class TestResponseCachingPolicy {
private ResponseCachingPolicy policy;
private HttpResponse response;
@@ -64,7 +64,7 @@ public class TestResponseCachingPolicy {
private ResponseCacheControl responseCacheControl;
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() {
now = Instant.now();
sixSecondsAgo = now.minusSeconds(6);
tenSecondsFromNow = now.plusSeconds(10);
@@ -78,21 +78,21 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testGetCacheable() {
+ void testGetCacheable() {
policy = new ResponseCachingPolicy(true, false, false);
request = new BasicHttpRequest(Method.GET, "/");
Assertions.assertTrue(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void testHeadCacheable() {
+ void testHeadCacheable() {
policy = new ResponseCachingPolicy(true, false, false);
request = new BasicHttpRequest(Method.HEAD, "/");
Assertions.assertTrue(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void testArbitraryMethodNotCacheable() {
+ void testArbitraryMethodNotCacheable() {
request = new BasicHttpRequest("PUT", "/");
Assertions.assertFalse(policy.isResponseCacheable(responseCacheControl, request, response));
@@ -101,14 +101,14 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testResponsesToRequestsWithAuthorizationHeadersAreNotCacheableBySharedCache() {
+ void testResponsesToRequestsWithAuthorizationHeadersAreNotCacheableBySharedCache() {
request = new BasicHttpRequest("GET","/");
request.setHeader("Authorization", StandardAuthScheme.BASIC + " dXNlcjpwYXNzd2Q=");
Assertions.assertFalse(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void testResponsesToRequestsWithAuthorizationHeadersAreCacheableByNonSharedCache() {
+ void testResponsesToRequestsWithAuthorizationHeadersAreCacheableByNonSharedCache() {
policy = new ResponseCachingPolicy(false, false, false);
request = new BasicHttpRequest("GET","/");
request.setHeader("Authorization", StandardAuthScheme.BASIC + " dXNlcjpwYXNzd2Q=");
@@ -116,7 +116,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testAuthorizedResponsesWithSMaxAgeAreCacheable() {
+ void testAuthorizedResponsesWithSMaxAgeAreCacheable() {
request = new BasicHttpRequest("GET","/");
request.setHeader("Authorization", StandardAuthScheme.BASIC + " dXNlcjpwYXNzd2Q=");
responseCacheControl = ResponseCacheControl.builder()
@@ -127,7 +127,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testAuthorizedResponsesWithCacheControlPublicAreCacheable() {
+ void testAuthorizedResponsesWithCacheControlPublicAreCacheable() {
request = new BasicHttpRequest("GET","/");
request.setHeader("Authorization", StandardAuthScheme.BASIC + " dXNlcjpwYXNzd2Q=");
responseCacheControl = ResponseCacheControl.builder()
@@ -137,7 +137,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testAuthorizedResponsesWithCacheControlMaxAgeAreNotCacheable() {
+ void testAuthorizedResponsesWithCacheControlMaxAgeAreNotCacheable() {
request = new BasicHttpRequest("GET","/");
request.setHeader("Authorization", StandardAuthScheme.BASIC + " dXNlcjpwYXNzd2Q=");
responseCacheControl = ResponseCacheControl.builder()
@@ -147,51 +147,51 @@ public class TestResponseCachingPolicy {
}
@Test
- public void test203ResponseCodeIsCacheable() {
+ void test203ResponseCodeIsCacheable() {
response.setCode(HttpStatus.SC_NON_AUTHORITATIVE_INFORMATION);
Assertions.assertTrue(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void test206ResponseCodeIsNotCacheable() {
+ void test206ResponseCodeIsNotCacheable() {
response.setCode(HttpStatus.SC_PARTIAL_CONTENT);
Assertions.assertFalse(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void test300ResponseCodeIsCacheable() {
+ void test300ResponseCodeIsCacheable() {
response.setCode(HttpStatus.SC_MULTIPLE_CHOICES);
Assertions.assertTrue(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void test301ResponseCodeIsCacheable() {
+ void test301ResponseCodeIsCacheable() {
response.setCode(HttpStatus.SC_MOVED_PERMANENTLY);
Assertions.assertTrue(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void test410ResponseCodeIsCacheable() {
+ void test410ResponseCodeIsCacheable() {
response.setCode(HttpStatus.SC_GONE);
Assertions.assertTrue(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void testPlain302ResponseCodeIsNotCacheable() {
+ void testPlain302ResponseCodeIsNotCacheable() {
response.setCode(HttpStatus.SC_MOVED_TEMPORARILY);
response.removeHeaders("Expires");
Assertions.assertFalse(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void testPlain303ResponseCodeIsNotCacheableUnderDefaultBehavior() {
+ void testPlain303ResponseCodeIsNotCacheableUnderDefaultBehavior() {
response.setCode(HttpStatus.SC_SEE_OTHER);
response.removeHeaders("Expires");
Assertions.assertFalse(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void testPlain303ResponseCodeIsNotCacheableEvenIf303CachingEnabled() {
+ void testPlain303ResponseCodeIsNotCacheableEvenIf303CachingEnabled() {
policy = new ResponseCachingPolicy(true, false, true);
response.setCode(HttpStatus.SC_SEE_OTHER);
response.removeHeaders("Expires");
@@ -200,14 +200,14 @@ public class TestResponseCachingPolicy {
@Test
- public void testPlain307ResponseCodeIsNotCacheable() {
+ void testPlain307ResponseCodeIsNotCacheable() {
response.setCode(HttpStatus.SC_TEMPORARY_REDIRECT);
response.removeHeaders("Expires");
Assertions.assertFalse(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void testNon206WithExplicitExpiresIsCacheable() {
+ void testNon206WithExplicitExpiresIsCacheable() {
final int status = getRandomStatus();
response.setCode(status);
response.setHeader("Expires", DateUtils.formatStandardDate(Instant.now().plus(1, ChronoUnit.HOURS)));
@@ -215,7 +215,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testNon206WithMaxAgeIsCacheable() {
+ void testNon206WithMaxAgeIsCacheable() {
final int status = getRandomStatus();
response.setCode(status);
responseCacheControl = ResponseCacheControl.builder()
@@ -225,7 +225,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testMissingCacheControlHeader() {
+ void testMissingCacheControlHeader() {
final int status = getRandomStatus();
response.setCode(status);
response.removeHeaders(HttpHeaders.CACHE_CONTROL);
@@ -233,7 +233,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testNon206WithSMaxAgeIsCacheable() {
+ void testNon206WithSMaxAgeIsCacheable() {
final int status = getRandomStatus();
response.setCode(status);
responseCacheControl = ResponseCacheControl.builder()
@@ -243,7 +243,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testNon206WithMustRevalidateIsCacheable() {
+ void testNon206WithMustRevalidateIsCacheable() {
final int status = getRandomStatus();
response.setCode(status);
responseCacheControl = ResponseCacheControl.builder()
@@ -253,7 +253,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testNon206WithProxyRevalidateIsCacheable() {
+ void testNon206WithProxyRevalidateIsCacheable() {
final int status = getRandomStatus();
response.setCode(status);
responseCacheControl = ResponseCacheControl.builder()
@@ -263,7 +263,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testNon206WithPublicCacheControlIsCacheable() {
+ void testNon206WithPublicCacheControlIsCacheable() {
final int status = getRandomStatus();
response.setCode(status);
responseCacheControl = ResponseCacheControl.builder()
@@ -273,7 +273,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testNon206WithPrivateCacheControlIsNotCacheableBySharedCache() {
+ void testNon206WithPrivateCacheControlIsNotCacheableBySharedCache() {
final int status = getRandomStatus();
response.setCode(status);
responseCacheControl = ResponseCacheControl.builder()
@@ -283,7 +283,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void test200ResponseWithPrivateCacheControlIsCacheableByNonSharedCache() {
+ void test200ResponseWithPrivateCacheControlIsCacheableByNonSharedCache() {
policy = new ResponseCachingPolicy(false, false, false);
response.setCode(HttpStatus.SC_OK);
responseCacheControl = ResponseCacheControl.builder()
@@ -293,7 +293,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testControlNoCacheCacheable() {
+ void testControlNoCacheCacheable() {
responseCacheControl = ResponseCacheControl.builder()
.setNoCache(true)
.build();
@@ -302,7 +302,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testControlNoStoreNotCacheable() {
+ void testControlNoStoreNotCacheable() {
responseCacheControl = ResponseCacheControl.builder()
.setNoStore(true)
.build();
@@ -311,7 +311,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testControlNoStoreEmbeddedInListCacheable() {
+ void testControlNoStoreEmbeddedInListCacheable() {
responseCacheControl = ResponseCacheControl.builder()
.setCachePublic(true)
.setNoStore(true)
@@ -321,7 +321,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testControlNoCacheEmbeddedInListCacheable() {
+ void testControlNoCacheEmbeddedInListCacheable() {
responseCacheControl = ResponseCacheControl.builder()
.setCachePublic(true)
.setNoCache(true)
@@ -331,7 +331,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testControlNoCacheEmbeddedInListAfterFirstHeaderCacheable() {
+ void testControlNoCacheEmbeddedInListAfterFirstHeaderCacheable() {
responseCacheControl = ResponseCacheControl.builder()
.setMaxAge(20)
.setCachePublic(true)
@@ -342,7 +342,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testControlNoStoreEmbeddedInListAfterFirstHeaderCacheable() {
+ void testControlNoStoreEmbeddedInListAfterFirstHeaderCacheable() {
responseCacheControl = ResponseCacheControl.builder()
.setMaxAge(20)
.setCachePublic(true)
@@ -353,7 +353,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testControlAnyCacheControlCacheable() {
+ void testControlAnyCacheControlCacheable() {
responseCacheControl = ResponseCacheControl.builder()
.setMaxAge(10)
.build();
@@ -370,7 +370,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testControlWithout200Cacheable() {
+ void testControlWithout200Cacheable() {
HttpResponse response404 = new BasicHttpResponse(HttpStatus.SC_NOT_FOUND, "");
Assertions.assertFalse(policy.isResponseCacheable(responseCacheControl, request, response404));
@@ -381,13 +381,13 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testVaryStarIsNotCacheable() {
+ void testVaryStarIsNotCacheable() {
response.setHeader("Vary", "*");
Assertions.assertFalse(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void testVaryStarIsNotCacheableUsingSharedPublicCache() {
+ void testVaryStarIsNotCacheableUsingSharedPublicCache() {
policy = new ResponseCachingPolicy(true, false, false);
request.setHeader("Authorization", StandardAuthScheme.BASIC + " QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
@@ -399,13 +399,13 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testRequestWithVaryHeaderCacheable() {
+ void testRequestWithVaryHeaderCacheable() {
response.addHeader("Vary", "Accept-Encoding");
Assertions.assertTrue(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void testIsArbitraryMethodCacheableUsingSharedPublicCache() {
+ void testIsArbitraryMethodCacheableUsingSharedPublicCache() {
policy = new ResponseCachingPolicy(true, false, false);
request = new HttpOptions("http://foo.example.com/");
@@ -419,14 +419,14 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testResponsesWithMultipleAgeHeadersAreCacheable() {
+ void testResponsesWithMultipleAgeHeadersAreCacheable() {
response.addHeader("Age", "3");
response.addHeader("Age", "5");
Assertions.assertTrue(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void testResponsesWithMultipleAgeHeadersAreNotCacheableUsingSharedPublicCache() {
+ void testResponsesWithMultipleAgeHeadersAreNotCacheableUsingSharedPublicCache() {
policy = new ResponseCachingPolicy(true, false, false);
request.setHeader("Authorization", StandardAuthScheme.BASIC + " QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
@@ -439,14 +439,14 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testResponsesWithMultipleDateHeadersAreNotCacheable() {
+ void testResponsesWithMultipleDateHeadersAreNotCacheable() {
response.addHeader("Date", DateUtils.formatStandardDate(now));
response.addHeader("Date", DateUtils.formatStandardDate(sixSecondsAgo));
Assertions.assertFalse(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void testResponsesWithMultipleDateHeadersAreNotCacheableUsingSharedPublicCache() {
+ void testResponsesWithMultipleDateHeadersAreNotCacheableUsingSharedPublicCache() {
policy = new ResponseCachingPolicy(true, false, false);
request.setHeader("Authorization", StandardAuthScheme.BASIC + " QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
@@ -459,13 +459,13 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testResponsesWithMalformedDateHeadersAreNotCacheable() {
+ void testResponsesWithMalformedDateHeadersAreNotCacheable() {
response.addHeader("Date", "garbage");
Assertions.assertFalse(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void testResponsesWithMalformedDateHeadersAreNotCacheableUsingSharedPublicCache() {
+ void testResponsesWithMalformedDateHeadersAreNotCacheableUsingSharedPublicCache() {
policy = new ResponseCachingPolicy(true, false, false);
request.setHeader("Authorization", StandardAuthScheme.BASIC + " QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
@@ -477,14 +477,14 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testResponsesWithMultipleExpiresHeadersAreNotCacheable() {
+ void testResponsesWithMultipleExpiresHeadersAreNotCacheable() {
response.addHeader("Expires", DateUtils.formatStandardDate(now));
response.addHeader("Expires", DateUtils.formatStandardDate(sixSecondsAgo));
Assertions.assertFalse(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void testResponsesWithMultipleExpiresHeadersAreNotCacheableUsingSharedPublicCache() {
+ void testResponsesWithMultipleExpiresHeadersAreNotCacheableUsingSharedPublicCache() {
policy = new ResponseCachingPolicy(true, false, false);
request.setHeader("Authorization", StandardAuthScheme.BASIC + " QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
@@ -497,39 +497,39 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testResponsesThatAreSmallEnoughAreCacheable() {
+ void testResponsesThatAreSmallEnoughAreCacheable() {
response.setHeader("Content-Length", "0");
Assertions.assertTrue(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void testResponsesToGETWithQueryParamsButNoExplicitCachingAreNotCacheable() {
+ void testResponsesToGETWithQueryParamsButNoExplicitCachingAreNotCacheable() {
request = new BasicHttpRequest("GET", "/foo?s=bar");
Assertions.assertFalse(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void testResponsesToHEADWithQueryParamsButNoExplicitCachingAreNotCacheable() {
+ void testResponsesToHEADWithQueryParamsButNoExplicitCachingAreNotCacheable() {
request = new BasicHttpRequest("HEAD", "/foo?s=bar");
Assertions.assertFalse(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void testResponsesToGETWithQueryParamsButNoExplicitCachingAreNotCacheableEvenWhen1_0QueryCachingDisabled() {
+ void testResponsesToGETWithQueryParamsButNoExplicitCachingAreNotCacheableEvenWhen1_0QueryCachingDisabled() {
policy = new ResponseCachingPolicy(true, true, false);
request = new BasicHttpRequest("GET", "/foo?s=bar");
Assertions.assertFalse(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void testResponsesToHEADWithQueryParamsButNoExplicitCachingAreNotCacheableEvenWhen1_0QueryCachingDisabled() {
+ void testResponsesToHEADWithQueryParamsButNoExplicitCachingAreNotCacheableEvenWhen1_0QueryCachingDisabled() {
policy = new ResponseCachingPolicy(true, true, false);
request = new BasicHttpRequest("HEAD", "/foo?s=bar");
Assertions.assertFalse(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void testResponsesToGETWithQueryParamsAndExplicitCachingAreCacheable() {
+ void testResponsesToGETWithQueryParamsAndExplicitCachingAreCacheable() {
request = new BasicHttpRequest("GET", "/foo?s=bar");
response.setHeader("Date", DateUtils.formatStandardDate(now));
response.setHeader("Expires", DateUtils.formatStandardDate(tenSecondsFromNow));
@@ -537,7 +537,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testResponsesToHEADWithQueryParamsAndExplicitCachingAreCacheable() {
+ void testResponsesToHEADWithQueryParamsAndExplicitCachingAreCacheable() {
policy = new ResponseCachingPolicy(true, false, false);
request = new BasicHttpRequest("HEAD", "/foo?s=bar");
response.setHeader("Date", DateUtils.formatStandardDate(now));
@@ -546,7 +546,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testResponsesToGETWithQueryParamsAndExplicitCachingAreCacheableEvenWhen1_0QueryCachingDisabled() {
+ void testResponsesToGETWithQueryParamsAndExplicitCachingAreCacheableEvenWhen1_0QueryCachingDisabled() {
policy = new ResponseCachingPolicy(true, true, false);
request = new BasicHttpRequest("GET", "/foo?s=bar");
response.setHeader("Date", DateUtils.formatStandardDate(now));
@@ -555,7 +555,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testResponsesToHEADWithQueryParamsAndExplicitCachingAreCacheableEvenWhen1_0QueryCachingDisabled() {
+ void testResponsesToHEADWithQueryParamsAndExplicitCachingAreCacheableEvenWhen1_0QueryCachingDisabled() {
policy = new ResponseCachingPolicy(true, true, false);
request = new BasicHttpRequest("HEAD", "/foo?s=bar");
response.setHeader("Date", DateUtils.formatStandardDate(now));
@@ -564,7 +564,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void getsWithQueryParametersDirectlyFrom1_0OriginsAreNotCacheable() {
+ void getsWithQueryParametersDirectlyFrom1_0OriginsAreNotCacheable() {
request = new BasicHttpRequest("GET", "/foo?s=bar");
response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
response.setVersion(HttpVersion.HTTP_1_0);
@@ -572,7 +572,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void headsWithQueryParametersDirectlyFrom1_0OriginsAreNotCacheable() {
+ void headsWithQueryParametersDirectlyFrom1_0OriginsAreNotCacheable() {
request = new BasicHttpRequest("HEAD", "/foo?s=bar");
response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
response.setVersion(HttpVersion.HTTP_1_0);
@@ -580,7 +580,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void getsWithQueryParametersDirectlyFrom1_0OriginsAreNotCacheableEvenWithSetting() {
+ void getsWithQueryParametersDirectlyFrom1_0OriginsAreNotCacheableEvenWithSetting() {
policy = new ResponseCachingPolicy(true, true, false);
request = new BasicHttpRequest("GET", "/foo?s=bar");
response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
@@ -589,7 +589,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void headsWithQueryParametersDirectlyFrom1_0OriginsAreNotCacheableEvenWithSetting() {
+ void headsWithQueryParametersDirectlyFrom1_0OriginsAreNotCacheableEvenWithSetting() {
policy = new ResponseCachingPolicy(true, true, false);
request = new BasicHttpRequest("HEAD", "/foo?s=bar");
response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
@@ -598,7 +598,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void getsWithQueryParametersDirectlyFrom1_0OriginsAreCacheableWithExpires() {
+ void getsWithQueryParametersDirectlyFrom1_0OriginsAreCacheableWithExpires() {
request = new BasicHttpRequest("GET", "/foo?s=bar");
response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
response.setVersion(HttpVersion.HTTP_1_0);
@@ -608,7 +608,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void headsWithQueryParametersDirectlyFrom1_0OriginsAreCacheableWithExpires() {
+ void headsWithQueryParametersDirectlyFrom1_0OriginsAreCacheableWithExpires() {
policy = new ResponseCachingPolicy(true, false, false);
request = new BasicHttpRequest("HEAD", "/foo?s=bar");
response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
@@ -619,7 +619,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void getsWithQueryParametersDirectlyFrom1_0OriginsCanBeNotCacheableEvenWithExpires() {
+ void getsWithQueryParametersDirectlyFrom1_0OriginsCanBeNotCacheableEvenWithExpires() {
policy = new ResponseCachingPolicy(true, true, false);
request = new BasicHttpRequest("GET", "/foo?s=bar");
response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
@@ -630,7 +630,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void headsWithQueryParametersDirectlyFrom1_0OriginsCanBeNotCacheableEvenWithExpires() {
+ void headsWithQueryParametersDirectlyFrom1_0OriginsCanBeNotCacheableEvenWithExpires() {
policy = new ResponseCachingPolicy(true, true, false);
request = new BasicHttpRequest("HEAD", "/foo?s=bar");
response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
@@ -641,21 +641,21 @@ public class TestResponseCachingPolicy {
}
@Test
- public void getsWithQueryParametersFrom1_0OriginsViaProxiesAreNotCacheable() {
+ void getsWithQueryParametersFrom1_0OriginsViaProxiesAreNotCacheable() {
request = new BasicHttpRequest("GET", "/foo?s=bar");
response.setHeader(HttpHeaders.VIA, "1.0 someproxy");
Assertions.assertFalse(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void headsWithQueryParametersFrom1_0OriginsViaProxiesAreNotCacheable() {
+ void headsWithQueryParametersFrom1_0OriginsViaProxiesAreNotCacheable() {
request = new BasicHttpRequest("HEAD", "/foo?s=bar");
response.setHeader(HttpHeaders.VIA, "1.0 someproxy");
Assertions.assertFalse(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void getsWithQueryParametersFrom1_0OriginsViaProxiesAreCacheableWithExpires() {
+ void getsWithQueryParametersFrom1_0OriginsViaProxiesAreCacheableWithExpires() {
request = new BasicHttpRequest("GET", "/foo?s=bar");
response.setHeader("Date", DateUtils.formatStandardDate(now));
response.setHeader("Expires", DateUtils.formatStandardDate(tenSecondsFromNow));
@@ -664,7 +664,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void headsWithQueryParametersFrom1_0OriginsViaProxiesAreCacheableWithExpires() {
+ void headsWithQueryParametersFrom1_0OriginsViaProxiesAreCacheableWithExpires() {
policy = new ResponseCachingPolicy(true, false, false);
request = new BasicHttpRequest("HEAD", "/foo?s=bar");
response.setHeader("Date", DateUtils.formatStandardDate(now));
@@ -674,7 +674,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void getsWithQueryParametersFrom1_0OriginsViaProxiesCanNotBeCacheableEvenWithExpires() {
+ void getsWithQueryParametersFrom1_0OriginsViaProxiesCanNotBeCacheableEvenWithExpires() {
policy = new ResponseCachingPolicy(true, true, true);
request = new BasicHttpRequest("GET", "/foo?s=bar");
response.setHeader("Date", DateUtils.formatStandardDate(now));
@@ -684,7 +684,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void headsWithQueryParametersFrom1_0OriginsViaProxiesCanNotBeCacheableEvenWithExpires() {
+ void headsWithQueryParametersFrom1_0OriginsViaProxiesCanNotBeCacheableEvenWithExpires() {
policy = new ResponseCachingPolicy(true, true, true);
request = new BasicHttpRequest("HEAD", "/foo?s=bar");
response.setHeader("Date", DateUtils.formatStandardDate(now));
@@ -694,7 +694,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void getsWithQueryParametersFrom1_0OriginsViaExplicitProxiesAreCacheableWithExpires() {
+ void getsWithQueryParametersFrom1_0OriginsViaExplicitProxiesAreCacheableWithExpires() {
request = new BasicHttpRequest("GET", "/foo?s=bar");
response.setHeader("Date", DateUtils.formatStandardDate(now));
response.setHeader("Expires", DateUtils.formatStandardDate(tenSecondsFromNow));
@@ -703,7 +703,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void headsWithQueryParametersFrom1_0OriginsViaExplicitProxiesAreCacheableWithExpires() {
+ void headsWithQueryParametersFrom1_0OriginsViaExplicitProxiesAreCacheableWithExpires() {
policy = new ResponseCachingPolicy(true, false, false);
request = new BasicHttpRequest("HEAD", "/foo?s=bar");
response.setHeader("Date", DateUtils.formatStandardDate(now));
@@ -713,7 +713,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void getsWithQueryParametersFrom1_0OriginsViaExplicitProxiesCanNotBeCacheableEvenWithExpires() {
+ void getsWithQueryParametersFrom1_0OriginsViaExplicitProxiesCanNotBeCacheableEvenWithExpires() {
policy = new ResponseCachingPolicy(true, true, true);
request = new BasicHttpRequest("GET", "/foo?s=bar");
response.setHeader("Date", DateUtils.formatStandardDate(now));
@@ -723,7 +723,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void headsWithQueryParametersFrom1_0OriginsViaExplicitProxiesCanNotBeCacheableEvenWithExpires() {
+ void headsWithQueryParametersFrom1_0OriginsViaExplicitProxiesCanNotBeCacheableEvenWithExpires() {
policy = new ResponseCachingPolicy(true, true, true);
request = new BasicHttpRequest("HEAD", "/foo?s=bar");
response.setHeader("Date", DateUtils.formatStandardDate(now));
@@ -733,7 +733,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void getsWithQueryParametersFrom1_1OriginsVia1_0ProxiesAreCacheableWithExpires() {
+ void getsWithQueryParametersFrom1_1OriginsVia1_0ProxiesAreCacheableWithExpires() {
request = new BasicHttpRequest("GET", "/foo?s=bar");
response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
response.setVersion(HttpVersion.HTTP_1_0);
@@ -744,7 +744,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void headsWithQueryParametersFrom1_1OriginsVia1_0ProxiesAreCacheableWithExpires() {
+ void headsWithQueryParametersFrom1_1OriginsVia1_0ProxiesAreCacheableWithExpires() {
policy = new ResponseCachingPolicy(true, false, false);
request = new BasicHttpRequest("HEAD", "/foo?s=bar");
response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
@@ -757,21 +757,21 @@ public class TestResponseCachingPolicy {
}
@Test
- public void notCacheableIfExpiresEqualsDateAndNoCacheControl() {
+ void notCacheableIfExpiresEqualsDateAndNoCacheControl() {
response.setHeader("Date", DateUtils.formatStandardDate(now));
response.setHeader("Expires", DateUtils.formatStandardDate(now));
Assertions.assertFalse(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void notCacheableIfExpiresPrecedesDateAndNoCacheControl() {
+ void notCacheableIfExpiresPrecedesDateAndNoCacheControl() {
response.setHeader("Date", DateUtils.formatStandardDate(now));
response.setHeader("Expires", DateUtils.formatStandardDate(sixSecondsAgo));
Assertions.assertFalse(policy.isResponseCacheable(responseCacheControl, request, response));
}
@Test
- public void test302WithExplicitCachingHeaders() {
+ void test302WithExplicitCachingHeaders() {
response.setCode(HttpStatus.SC_MOVED_TEMPORARILY);
response.setHeader("Date", DateUtils.formatStandardDate(now));
responseCacheControl = ResponseCacheControl.builder()
@@ -781,7 +781,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void test303WithExplicitCachingHeadersWhenPermittedByConfig() {
+ void test303WithExplicitCachingHeadersWhenPermittedByConfig() {
// HTTPbis working group says ok if explicitly indicated by
// response headers
policy = new ResponseCachingPolicy(true, false, true);
@@ -794,7 +794,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void test307WithExplicitCachingHeaders() {
+ void test307WithExplicitCachingHeaders() {
response.setCode(HttpStatus.SC_TEMPORARY_REDIRECT);
response.setHeader("Date", DateUtils.formatStandardDate(now));
responseCacheControl = ResponseCacheControl.builder()
@@ -804,7 +804,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void otherStatusCodesAreCacheableWithExplicitCachingHeaders() {
+ void otherStatusCodesAreCacheableWithExplicitCachingHeaders() {
response.setCode(HttpStatus.SC_NOT_FOUND);
response.setHeader("Date", DateUtils.formatStandardDate(now));
responseCacheControl = ResponseCacheControl.builder()
@@ -895,7 +895,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testIsResponseCacheable() {
+ void testIsResponseCacheable() {
request = new BasicHttpRequest("GET","/foo?s=bar");
// HTTPbis working group says ok if explicitly indicated by
// response headers
@@ -936,7 +936,7 @@ public class TestResponseCachingPolicy {
}
@Test
- public void testImmutableAndFreshResponseIsCacheable() {
+ void testImmutableAndFreshResponseIsCacheable() {
responseCacheControl = ResponseCacheControl.builder()
.setImmutable(true)
.setMaxAge(3600) // set this to a value that ensures the response is still fresh
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestViaCacheGenerator.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestViaCacheGenerator.java
index 83fff1a65..ffc62841b 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestViaCacheGenerator.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/TestViaCacheGenerator.java
@@ -34,17 +34,17 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class TestViaCacheGenerator {
+class TestViaCacheGenerator {
private ViaCacheGenerator impl;
@BeforeEach
- public void setUp() {
+ void setUp() {
impl = new ViaCacheGenerator();
}
@Test
- public void testViaValueGeneration() {
+ void testViaValueGeneration() {
Assertions.assertEquals("1.1 localhost (Apache-HttpClient/UNAVAILABLE (cache))",
impl.generateViaHeader(null, HttpVersion.DEFAULT));
Assertions.assertEquals("2.0 localhost (Apache-HttpClient/UNAVAILABLE (cache))",
@@ -52,7 +52,7 @@ public class TestViaCacheGenerator {
}
@Test
- public void testViaValueLookup() {
+ void testViaValueLookup() {
MatcherAssert.assertThat(impl.lookup(HttpVersion.DEFAULT),
Matchers.startsWith("1.1 localhost (Apache-HttpClient/"));
MatcherAssert.assertThat(impl.lookup(HttpVersion.HTTP_1_0),
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/memcached/TestPrefixKeyHashingScheme.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/memcached/TestPrefixKeyHashingScheme.java
index aeb0627fa..a15b43872 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/memcached/TestPrefixKeyHashingScheme.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/memcached/TestPrefixKeyHashingScheme.java
@@ -33,7 +33,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class TestPrefixKeyHashingScheme {
+class TestPrefixKeyHashingScheme {
private static final String KEY = "key";
private static final String PREFIX = "prefix";
@@ -41,7 +41,7 @@ public class TestPrefixKeyHashingScheme {
private KeyHashingScheme scheme;
@BeforeEach
- public void setUp() {
+ void setUp() {
scheme = storageKey -> {
assertEquals(KEY, storageKey);
return "hash";
@@ -50,7 +50,7 @@ public class TestPrefixKeyHashingScheme {
}
@Test
- public void addsPrefixToBackingScheme() {
+ void addsPrefixToBackingScheme() {
assertEquals("prefixhash", impl.hash(KEY));
}
}
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/memcached/TestSHA256HashingScheme.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/memcached/TestSHA256HashingScheme.java
index 3d5a47bdd..6f6334b24 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/memcached/TestSHA256HashingScheme.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/memcached/TestSHA256HashingScheme.java
@@ -32,10 +32,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
-public class TestSHA256HashingScheme {
+class TestSHA256HashingScheme {
@Test
- public void canHash() {
+ void canHash() {
final SHA256KeyHashingScheme impl = new SHA256KeyHashingScheme();
final String result = impl.hash("hello, hashing world");
assertTrue(result != null && !result.isEmpty());
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/schedule/TestExponentialBackingOffSchedulingStrategy.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/schedule/TestExponentialBackingOffSchedulingStrategy.java
index 4b9ffe973..1b8375339 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/schedule/TestExponentialBackingOffSchedulingStrategy.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/schedule/TestExponentialBackingOffSchedulingStrategy.java
@@ -31,12 +31,12 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class TestExponentialBackingOffSchedulingStrategy {
+class TestExponentialBackingOffSchedulingStrategy {
private ExponentialBackOffSchedulingStrategy impl;
@BeforeEach
- public void setUp() {
+ void setUp() {
impl = new ExponentialBackOffSchedulingStrategy(
ExponentialBackOffSchedulingStrategy.DEFAULT_BACK_OFF_RATE,
ExponentialBackOffSchedulingStrategy.DEFAULT_INITIAL_EXPIRY,
@@ -45,7 +45,7 @@ public class TestExponentialBackingOffSchedulingStrategy {
}
@Test
- public void testSchedule() {
+ void testSchedule() {
Assertions.assertEquals(TimeValue.ofMilliseconds(0), impl.schedule(0));
Assertions.assertEquals(TimeValue.ofMilliseconds(6000), impl.schedule(1));
Assertions.assertEquals(TimeValue.ofMilliseconds(60000), impl.schedule(2));
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/schedule/TestImmediateSchedulingStrategy.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/schedule/TestImmediateSchedulingStrategy.java
index 9bbb6e1aa..2afac1230 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/schedule/TestImmediateSchedulingStrategy.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/schedule/TestImmediateSchedulingStrategy.java
@@ -32,17 +32,17 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class TestImmediateSchedulingStrategy {
+class TestImmediateSchedulingStrategy {
private SchedulingStrategy impl;
@BeforeEach
- public void setUp() {
+ void setUp() {
impl = new ImmediateSchedulingStrategy();
}
@Test
- public void testSchedule() {
+ void testSchedule() {
Assertions.assertEquals(TimeValue.ZERO_MILLISECONDS, impl.schedule(0));
Assertions.assertEquals(TimeValue.ZERO_MILLISECONDS, impl.schedule(1));
Assertions.assertEquals(TimeValue.ZERO_MILLISECONDS, impl.schedule(Integer.MAX_VALUE));
diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/schedule/TestConcurrentCountMap.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/schedule/TestConcurrentCountMap.java
index 9d65423e8..175867d1a 100644
--- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/schedule/TestConcurrentCountMap.java
+++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/schedule/TestConcurrentCountMap.java
@@ -31,7 +31,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import org.hamcrest.CoreMatchers;
import org.junit.jupiter.api.Test;
-public class TestConcurrentCountMap
+class TestConcurrentCountMap
{
private static final String IDENTIFIER = "some-identifier";
@@ -39,7 +39,7 @@ public class TestConcurrentCountMap
private final ConcurrentCountMap<String> map = new ConcurrentCountMap<>();
@Test
- public void testBasics() {
+ void testBasics() {
map.increaseCount(IDENTIFIER);
map.increaseCount(IDENTIFIER);
assertThat(map.getCount(IDENTIFIER), CoreMatchers.equalTo(2));
diff --git a/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/fluent/TestRequest.java b/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/fluent/TestRequest.java
index 6e030ca03..96693e664 100644
--- a/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/fluent/TestRequest.java
+++ b/httpclient5-fluent/src/test/java/org/apache/hc/client5/http/fluent/TestRequest.java
@@ -37,12 +37,12 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
-public class TestRequest {
+class TestRequest {
private static final String URI_STRING_FIXTURE = "http://localhost";
private static final URI URI_FIXTURE = URI.create(URI_STRING_FIXTURE);
- public static Stream<Arguments> data() {
+ static Stream<Arguments> data() {
return Stream.of(
Arguments.of("delete", "DELETE"),
Arguments.of("get", "GET"),
@@ -57,7 +57,7 @@ public class TestRequest {
@ParameterizedTest(name = "{index}: {0} => {1}")
@MethodSource("data")
- public void testCreateFromString(final String methodName, final String expectedMethod) throws Exception {
+ void testCreateFromString(final String methodName, final String expectedMethod) throws Exception {
final Method method = Request.class.getMethod(methodName, String.class);
final Request request = (Request) method.invoke(null, URI_STRING_FIXTURE);
final ClassicHttpRequest classicHttpRequest = request.getRequest();
@@ -66,7 +66,7 @@ public class TestRequest {
@ParameterizedTest(name = "{index}: {0} => {1}")
@MethodSource("data")
- public void testCreateFromURI(final String methodName, final String expectedMethod) throws Exception {
+ void testCreateFromURI(final String methodName, final String expectedMethod) throws Exception {
final Method method = Request.class.getMethod(methodName, URI.class);
final Request request = (Request) method.invoke(null, URI_FIXTURE);
final ClassicHttpRequest classicHttpRequest = request.getRequest();
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncClientAuthenticationTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncClientAuthenticationTest.java
index db433d369..543ef5a1f 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncClientAuthenticationTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncClientAuthenticationTest.java
@@ -76,14 +76,14 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
-public abstract class AbstractHttpAsyncClientAuthenticationTest extends AbstractIntegrationTestBase {
+abstract class AbstractHttpAsyncClientAuthenticationTest extends AbstractIntegrationTestBase {
public AbstractHttpAsyncClientAuthenticationTest(final URIScheme scheme, final ClientProtocolLevel clientProtocolLevel, final ServerProtocolLevel serverProtocolLevel) {
super(scheme, clientProtocolLevel, serverProtocolLevel);
}
@Test
- public void testBasicAuthenticationNoCreds() throws Exception {
+ void testBasicAuthenticationNoCreds() throws Exception {
final HttpHost target = startServer();
configureServer(bootstrap -> bootstrap.register("*", AsyncEchoHandler::new));
@@ -106,7 +106,7 @@ public abstract class AbstractHttpAsyncClientAuthenticationTest extends Abstract
}
@Test
- public void testBasicAuthenticationFailure() throws Exception {
+ void testBasicAuthenticationFailure() throws Exception {
final HttpHost target = startServer();
configureServer(bootstrap -> bootstrap.register("*", AsyncEchoHandler::new));
@@ -131,7 +131,7 @@ public abstract class AbstractHttpAsyncClientAuthenticationTest extends Abstract
}
@Test
- public void testBasicAuthenticationSuccess() throws Exception {
+ void testBasicAuthenticationSuccess() throws Exception {
final HttpHost target = startServer();
configureServer(bootstrap -> bootstrap.register("*", AsyncEchoHandler::new));
@@ -157,7 +157,7 @@ public abstract class AbstractHttpAsyncClientAuthenticationTest extends Abstract
}
@Test
- public void testBasicAuthenticationWithEntitySuccess() throws Exception {
+ void testBasicAuthenticationWithEntitySuccess() throws Exception {
final HttpHost target = startServer();
configureServer(bootstrap -> bootstrap.register("*", AsyncEchoHandler::new));
@@ -183,7 +183,7 @@ public abstract class AbstractHttpAsyncClientAuthenticationTest extends Abstract
}
@Test
- public void testBasicAuthenticationExpectationFailure() throws Exception {
+ void testBasicAuthenticationExpectationFailure() throws Exception {
final HttpHost target = startServer();
configureServer(bootstrap -> bootstrap.register("*", AsyncEchoHandler::new));
@@ -208,7 +208,7 @@ public abstract class AbstractHttpAsyncClientAuthenticationTest extends Abstract
}
@Test
- public void testBasicAuthenticationExpectationSuccess() throws Exception {
+ void testBasicAuthenticationExpectationSuccess() throws Exception {
final HttpHost target = startServer();
configureServer(bootstrap -> bootstrap.register("*", AsyncEchoHandler::new));
@@ -235,7 +235,7 @@ public abstract class AbstractHttpAsyncClientAuthenticationTest extends Abstract
}
@Test
- public void testBasicAuthenticationCredentialsCaching() throws Exception {
+ void testBasicAuthenticationCredentialsCaching() throws Exception {
final HttpHost target = startServer();
configureServer(bootstrap -> bootstrap.register("*", AsyncEchoHandler::new));
@@ -262,7 +262,7 @@ public abstract class AbstractHttpAsyncClientAuthenticationTest extends Abstract
}
@Test
- public void testBasicAuthenticationCredentialsCachingByPathPrefix() throws Exception {
+ void testBasicAuthenticationCredentialsCachingByPathPrefix() throws Exception {
final HttpHost target = startServer();
configureServer(bootstrap -> bootstrap.register("*", AsyncEchoHandler::new));
@@ -327,7 +327,7 @@ public abstract class AbstractHttpAsyncClientAuthenticationTest extends Abstract
}
@Test
- public void testAuthenticationUserinfoInRequestFailure() throws Exception {
+ void testAuthenticationUserinfoInRequestFailure() throws Exception {
final HttpHost target = startServer();
configureServer(bootstrap -> bootstrap.register("*", AsyncEchoHandler::new));
@@ -344,7 +344,7 @@ public abstract class AbstractHttpAsyncClientAuthenticationTest extends Abstract
}
@Test
- public void testReauthentication() throws Exception {
+ void testReauthentication() throws Exception {
final Authenticator authenticator = new BasicTestAuthenticator("test:test", "test realm") {
private final AtomicLong count = new AtomicLong(0);
@@ -413,7 +413,7 @@ public abstract class AbstractHttpAsyncClientAuthenticationTest extends Abstract
}
@Test
- public void testAuthenticationFallback() throws Exception {
+ void testAuthenticationFallback() throws Exception {
final HttpHost target = startServer();
configureServer(bootstrap -> bootstrap
.register("*", AsyncEchoHandler::new)
@@ -448,7 +448,7 @@ public abstract class AbstractHttpAsyncClientAuthenticationTest extends Abstract
private final static String CHARS = "0123456789abcdef";
@Test
- public void testBearerTokenAuthentication() throws Exception {
+ void testBearerTokenAuthentication() throws Exception {
final SecureRandom secureRandom = SecureRandom.getInstanceStrong();
secureRandom.setSeed(System.currentTimeMillis());
final StringBuilder buf = new StringBuilder();
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
index f8488b24f..1f38c166c 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
@@ -58,14 +58,14 @@ import org.apache.hc.core5.http.nio.support.BasicResponseConsumer;
import org.hamcrest.CoreMatchers;
import org.junit.jupiter.api.Test;
-public abstract class AbstractHttpAsyncFundamentalsTest extends AbstractIntegrationTestBase {
+abstract class AbstractHttpAsyncFundamentalsTest extends AbstractIntegrationTestBase {
protected AbstractHttpAsyncFundamentalsTest(final URIScheme scheme, final ClientProtocolLevel clientProtocolLevel, final ServerProtocolLevel serverProtocolLevel) {
super(scheme, clientProtocolLevel, serverProtocolLevel);
}
@Test
- public void testSequentialGetRequests() throws Exception {
+ void testSequentialGetRequests() throws Exception {
configureServer(bootstrap -> bootstrap.register("/random/*", AsyncRandomHandler::new));
final HttpHost target = startServer();
@@ -87,7 +87,7 @@ public abstract class AbstractHttpAsyncFundamentalsTest extends AbstractIntegrat
}
@Test
- public void testSequentialHeadRequests() throws Exception {
+ void testSequentialHeadRequests() throws Exception {
configureServer(bootstrap -> bootstrap.register("/random/*", AsyncRandomHandler::new));
final HttpHost target = startServer();
final TestAsyncClient client = startClient();
@@ -106,7 +106,7 @@ public abstract class AbstractHttpAsyncFundamentalsTest extends AbstractIntegrat
}
@Test
- public void testSequentialPostRequests() throws Exception {
+ void testSequentialPostRequests() throws Exception {
configureServer(bootstrap -> bootstrap.register("/echo/*", AsyncEchoHandler::new));
final HttpHost target = startServer();
final TestAsyncClient client = startClient();
@@ -128,7 +128,7 @@ public abstract class AbstractHttpAsyncFundamentalsTest extends AbstractIntegrat
}
@Test
- public void testConcurrentPostRequests() throws Exception {
+ void testConcurrentPostRequests() throws Exception {
configureServer(bootstrap -> bootstrap.register("/echo/*", AsyncEchoHandler::new));
final HttpHost target = startServer();
final TestAsyncClient client = startClient();
@@ -159,7 +159,7 @@ public abstract class AbstractHttpAsyncFundamentalsTest extends AbstractIntegrat
}
@Test
- public void testRequestExecutionFromCallback() throws Exception {
+ void testRequestExecutionFromCallback() throws Exception {
configureServer(bootstrap -> bootstrap.register("/random/*", AsyncRandomHandler::new));
final HttpHost target = startServer();
final TestAsyncClient client = startClient();
@@ -226,7 +226,7 @@ public abstract class AbstractHttpAsyncFundamentalsTest extends AbstractIntegrat
}
@Test
- public void testBadRequest() throws Exception {
+ void testBadRequest() throws Exception {
configureServer(bootstrap -> bootstrap.register("/random/*", AsyncRandomHandler::new));
final HttpHost target = startServer();
final TestAsyncClient client = startClient();
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java
index 5cb0a4699..77e42504a 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncRedirectsTest.java
@@ -66,14 +66,14 @@ import org.hamcrest.CoreMatchers;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public abstract class AbstractHttpAsyncRedirectsTest extends AbstractIntegrationTestBase {
+abstract class AbstractHttpAsyncRedirectsTest extends AbstractIntegrationTestBase {
public AbstractHttpAsyncRedirectsTest(final URIScheme scheme, final ClientProtocolLevel clientProtocolLevel, final ServerProtocolLevel serverProtocolLevel) {
super(scheme, clientProtocolLevel, serverProtocolLevel);
}
@Test
- public void testBasicRedirect300() throws Exception {
+ void testBasicRedirect300() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", AsyncRandomHandler::new)
.setExchangeHandlerDecorator(exchangeHandler -> new RedirectingAsyncDecorator(
@@ -99,7 +99,7 @@ public abstract class AbstractHttpAsyncRedirectsTest extends AbstractIntegration
}
@Test
- public void testBasicRedirect301() throws Exception {
+ void testBasicRedirect301() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", AsyncRandomHandler::new)
.setExchangeHandlerDecorator(exchangeHandler -> new RedirectingAsyncDecorator(
@@ -126,7 +126,7 @@ public abstract class AbstractHttpAsyncRedirectsTest extends AbstractIntegration
}
@Test
- public void testBasicRedirect302() throws Exception {
+ void testBasicRedirect302() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", AsyncRandomHandler::new)
.setExchangeHandlerDecorator(exchangeHandler -> new RedirectingAsyncDecorator(
@@ -153,7 +153,7 @@ public abstract class AbstractHttpAsyncRedirectsTest extends AbstractIntegration
}
@Test
- public void testBasicRedirect302NoLocation() throws Exception {
+ void testBasicRedirect302NoLocation() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", AsyncRandomHandler::new)
.setExchangeHandlerDecorator(exchangeHandler -> new RedirectingAsyncDecorator(
@@ -185,7 +185,7 @@ public abstract class AbstractHttpAsyncRedirectsTest extends AbstractIntegration
}
@Test
- public void testBasicRedirect303() throws Exception {
+ void testBasicRedirect303() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", AsyncRandomHandler::new)
.setExchangeHandlerDecorator(exchangeHandler -> new RedirectingAsyncDecorator(
@@ -213,14 +213,14 @@ public abstract class AbstractHttpAsyncRedirectsTest extends AbstractIntegration
}
@Test
- public void testBasicRedirect304() throws Exception {
+ void testBasicRedirect304() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", AsyncRandomHandler::new)
.register("/oldlocation/*", () -> new AbstractSimpleServerExchangeHandler() {
@Override
protected SimpleHttpResponse handle(final SimpleHttpRequest request,
- final HttpCoreContext context) throws HttpException {
+ final HttpCoreContext context) {
return SimpleHttpResponse.create(HttpStatus.SC_NOT_MODIFIED, (String) null);
}
}));
@@ -244,14 +244,14 @@ public abstract class AbstractHttpAsyncRedirectsTest extends AbstractIntegration
}
@Test
- public void testBasicRedirect305() throws Exception {
+ void testBasicRedirect305() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", AsyncRandomHandler::new)
.register("/oldlocation/*", () -> new AbstractSimpleServerExchangeHandler() {
@Override
protected SimpleHttpResponse handle(final SimpleHttpRequest request,
- final HttpCoreContext context) throws HttpException {
+ final HttpCoreContext context) {
return SimpleHttpResponse.create(HttpStatus.SC_USE_PROXY, (String) null);
}
}));
@@ -275,7 +275,7 @@ public abstract class AbstractHttpAsyncRedirectsTest extends AbstractIntegration
}
@Test
- public void testBasicRedirect307() throws Exception {
+ void testBasicRedirect307() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", AsyncRandomHandler::new)
.setExchangeHandlerDecorator(exchangeHandler -> new RedirectingAsyncDecorator(
@@ -302,7 +302,7 @@ public abstract class AbstractHttpAsyncRedirectsTest extends AbstractIntegration
}
@Test
- public void testMaxRedirectCheck() throws Exception {
+ void testMaxRedirectCheck() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", AsyncRandomHandler::new)
.setExchangeHandlerDecorator(exchangeHandler -> new RedirectingAsyncDecorator(
@@ -328,7 +328,7 @@ public abstract class AbstractHttpAsyncRedirectsTest extends AbstractIntegration
}
@Test
- public void testCircularRedirect() throws Exception {
+ void testCircularRedirect() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", AsyncRandomHandler::new)
.setExchangeHandlerDecorator(exchangeHandler -> new RedirectingAsyncDecorator(
@@ -355,7 +355,7 @@ public abstract class AbstractHttpAsyncRedirectsTest extends AbstractIntegration
}
@Test
- public void testPostRedirect() throws Exception {
+ void testPostRedirect() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/echo/*", AsyncEchoHandler::new)
.setExchangeHandlerDecorator(exchangeHandler -> new RedirectingAsyncDecorator(
@@ -383,7 +383,7 @@ public abstract class AbstractHttpAsyncRedirectsTest extends AbstractIntegration
}
@Test
- public void testPostRedirectSeeOther() throws Exception {
+ void testPostRedirectSeeOther() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/echo/*", AsyncEchoHandler::new)
.setExchangeHandlerDecorator(exchangeHandler -> new RedirectingAsyncDecorator(
@@ -411,7 +411,7 @@ public abstract class AbstractHttpAsyncRedirectsTest extends AbstractIntegration
}
@Test
- public void testRelativeRedirect() throws Exception {
+ void testRelativeRedirect() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", AsyncRandomHandler::new)
.setExchangeHandlerDecorator(exchangeHandler -> new RedirectingAsyncDecorator(
@@ -446,7 +446,7 @@ public abstract class AbstractHttpAsyncRedirectsTest extends AbstractIntegration
}
@Test
- public void testRelativeRedirect2() throws Exception {
+ void testRelativeRedirect2() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", AsyncRandomHandler::new)
.setExchangeHandlerDecorator(exchangeHandler -> new RedirectingAsyncDecorator(
@@ -481,7 +481,7 @@ public abstract class AbstractHttpAsyncRedirectsTest extends AbstractIntegration
}
@Test
- public void testRejectBogusRedirectLocation() throws Exception {
+ void testRejectBogusRedirectLocation() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", AsyncRandomHandler::new)
.setExchangeHandlerDecorator(exchangeHandler -> new RedirectingAsyncDecorator(
@@ -510,7 +510,7 @@ public abstract class AbstractHttpAsyncRedirectsTest extends AbstractIntegration
}
@Test
- public void testRejectInvalidRedirectLocation() throws Exception {
+ void testRejectInvalidRedirectLocation() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", AsyncRandomHandler::new)
.setExchangeHandlerDecorator(exchangeHandler -> new RedirectingAsyncDecorator(
@@ -538,7 +538,7 @@ public abstract class AbstractHttpAsyncRedirectsTest extends AbstractIntegration
}
@Test
- public void testRedirectWithCookie() throws Exception {
+ void testRedirectWithCookie() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", AsyncRandomHandler::new)
.setExchangeHandlerDecorator(exchangeHandler -> new RedirectingAsyncDecorator(
@@ -576,7 +576,7 @@ public abstract class AbstractHttpAsyncRedirectsTest extends AbstractIntegration
}
@Test
- public void testCrossSiteRedirect() throws Exception {
+ void testCrossSiteRedirect() throws Exception {
final URIScheme scheme = scheme();
final TestAsyncServer secondServer = new TestAsyncServerBootstrap(scheme(), getServerProtocolLevel())
.register("/random/*", AsyncRandomHandler::new)
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpReactiveFundamentalsTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpReactiveFundamentalsTest.java
index 58fd9e0eb..1ff6f97cc 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpReactiveFundamentalsTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpReactiveFundamentalsTest.java
@@ -77,7 +77,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.reactivestreams.Publisher;
-public abstract class AbstractHttpReactiveFundamentalsTest extends AbstractIntegrationTestBase {
+abstract class AbstractHttpReactiveFundamentalsTest extends AbstractIntegrationTestBase {
public AbstractHttpReactiveFundamentalsTest(final URIScheme scheme, final ClientProtocolLevel clientProtocolLevel, final ServerProtocolLevel serverProtocolLevel) {
super(scheme, clientProtocolLevel, serverProtocolLevel);
@@ -271,7 +271,7 @@ public abstract class AbstractHttpReactiveFundamentalsTest extends AbstractInteg
}
@Test
- public void testBadRequest() throws Exception {
+ void testBadRequest() throws Exception {
configureServer(bootstrap -> bootstrap.register("/random/*", () ->
new ReactiveServerExchangeHandler(new ReactiveRandomProcessor())));
final HttpHost target = startServer();
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java
index 0dc5ca4cc..8df05f111 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractIntegrationTestBase.java
@@ -42,7 +42,7 @@ import org.apache.hc.core5.http.URIScheme;
import org.apache.hc.core5.util.Timeout;
import org.junit.jupiter.api.extension.RegisterExtension;
-public abstract class AbstractIntegrationTestBase {
+abstract class AbstractIntegrationTestBase {
public static final Timeout TIMEOUT = Timeout.ofMinutes(1);
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/HttpIntegrationTests.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/HttpIntegrationTests.java
index df5da9203..d5dfc1324 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/HttpIntegrationTests.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/HttpIntegrationTests.java
@@ -31,13 +31,13 @@ import org.apache.hc.core5.http.URIScheme;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
-public class HttpIntegrationTests {
+class HttpIntegrationTests {
@Nested
@DisplayName("Fundamentals (HTTP/1.1)")
- public class Http1 extends TestHttp1Async {
+ class Http1 extends TestHttp1Async {
- public Http1() throws Exception {
+ public Http1() {
super(URIScheme.HTTP);
}
@@ -45,9 +45,9 @@ public class HttpIntegrationTests {
@Nested
@DisplayName("Fundamentals (HTTP/1.1, TLS)")
- public class Http1Tls extends TestHttp1Async {
+ class Http1Tls extends TestHttp1Async {
- public Http1Tls() throws Exception {
+ public Http1Tls() {
super(URIScheme.HTTPS);
}
@@ -55,9 +55,9 @@ public class HttpIntegrationTests {
@Nested
@DisplayName("Fundamentals (HTTP/2)")
- public class H2 extends TestH2Async {
+ class H2 extends TestH2Async {
- public H2() throws Exception {
+ public H2() {
super(URIScheme.HTTP);
}
@@ -65,9 +65,9 @@ public class HttpIntegrationTests {
@Nested
@DisplayName("Fundamentals (HTTP/2, TLS)")
- public class H2Tls extends TestH2Async {
+ class H2Tls extends TestH2Async {
- public H2Tls() throws Exception {
+ public H2Tls() {
super(URIScheme.HTTPS);
}
@@ -75,9 +75,9 @@ public class HttpIntegrationTests {
@Nested
@DisplayName("Request re-execution (HTTP/1.1)")
- public class Http1RequestReExecution extends TestHttp1RequestReExecution {
+ class Http1RequestReExecution extends TestHttp1RequestReExecution {
- public Http1RequestReExecution() throws Exception {
+ public Http1RequestReExecution() {
super(URIScheme.HTTP);
}
@@ -85,9 +85,9 @@ public class HttpIntegrationTests {
@Nested
@DisplayName("Request re-execution (HTTP/1.1, TLS)")
- public class Http1RequestReExecutionTls extends TestHttp1RequestReExecution {
+ class Http1RequestReExecutionTls extends TestHttp1RequestReExecution {
- public Http1RequestReExecutionTls() throws Exception {
+ public Http1RequestReExecutionTls() {
super(URIScheme.HTTPS);
}
@@ -95,9 +95,9 @@ public class HttpIntegrationTests {
@Nested
@DisplayName("HTTP protocol policy (HTTP/1.1)")
- public class Http1ProtocolPolicy extends TestHttpAsyncProtocolPolicy {
+ class Http1ProtocolPolicy extends TestHttpAsyncProtocolPolicy {
- public Http1ProtocolPolicy() throws Exception {
+ public Http1ProtocolPolicy() {
super(URIScheme.HTTP, HttpVersion.HTTP_1_1);
}
@@ -105,9 +105,9 @@ public class HttpIntegrationTests {
@Nested
@DisplayName("HTTP protocol policy (HTTP/1.1, TLS)")
- public class Http1ProtocolPolicyTls extends TestHttpAsyncProtocolPolicy {
+ class Http1ProtocolPolicyTls extends TestHttpAsyncProtocolPolicy {
- public Http1ProtocolPolicyTls() throws Exception {
+ public Http1ProtocolPolicyTls() {
super(URIScheme.HTTPS, HttpVersion.HTTP_1_1);
}
@@ -115,9 +115,9 @@ public class HttpIntegrationTests {
@Nested
@DisplayName("HTTP protocol policy (HTTP/2)")
- public class H2ProtocolPolicy extends TestHttpAsyncProtocolPolicy {
+ class H2ProtocolPolicy extends TestHttpAsyncProtocolPolicy {
- public H2ProtocolPolicy() throws Exception {
+ public H2ProtocolPolicy() {
super(URIScheme.HTTP, HttpVersion.HTTP_2);
}
@@ -125,9 +125,9 @@ public class HttpIntegrationTests {
@Nested
@DisplayName("HTTP protocol policy (HTTP/2, TLS)")
- public class H2ProtocolPolicyTls extends TestHttpAsyncProtocolPolicy {
+ class H2ProtocolPolicyTls extends TestHttpAsyncProtocolPolicy {
- public H2ProtocolPolicyTls() throws Exception {
+ public H2ProtocolPolicyTls() {
super(URIScheme.HTTPS, HttpVersion.HTTP_2);
}
@@ -135,9 +135,9 @@ public class HttpIntegrationTests {
@Nested
@DisplayName("Redirects (HTTP/1.1)")
- public class RedirectsHttp1 extends TestHttp1AsyncRedirects {
+ class RedirectsHttp1 extends TestHttp1AsyncRedirects {
- public RedirectsHttp1() throws Exception {
+ public RedirectsHttp1() {
super(URIScheme.HTTP);
}
@@ -145,9 +145,9 @@ public class HttpIntegrationTests {
@Nested
@DisplayName("Redirects (HTTP/1.1, TLS)")
- public class RedirectsHttp1Tls extends TestHttp1AsyncRedirects {
+ class RedirectsHttp1Tls extends TestHttp1AsyncRedirects {
- public RedirectsHttp1Tls() throws Exception {
+ public RedirectsHttp1Tls() {
super(URIScheme.HTTPS);
}
@@ -155,9 +155,9 @@ public class HttpIntegrationTests {
@Nested
@DisplayName("Redirects (HTTP/2)")
- public class RedirectsH2 extends TestH2AsyncRedirect {
+ class RedirectsH2 extends TestH2AsyncRedirect {
- public RedirectsH2() throws Exception {
+ public RedirectsH2() {
super(URIScheme.HTTP);
}
@@ -165,9 +165,9 @@ public class HttpIntegrationTests {
@Nested
@DisplayName("Redirects (HTTP/2, TLS)")
- public class RedirectsH2Tls extends TestH2AsyncRedirect {
+ class RedirectsH2Tls extends TestH2AsyncRedirect {
- public RedirectsH2Tls() throws Exception {
+ public RedirectsH2Tls() {
super(URIScheme.HTTPS);
}
@@ -175,7 +175,7 @@ public class HttpIntegrationTests {
// @Nested
// @DisplayName("Client authentication (HTTP/1.1)")
-// public class AuthenticationHttp1 extends TestHttp1ClientAuthentication {
+// class AuthenticationHttp1 extends TestHttp1ClientAuthentication {
//
// public AuthenticationHttp1() throws Exception {
// super(URIScheme.HTTP);
@@ -185,7 +185,7 @@ public class HttpIntegrationTests {
//
// @Nested
// @DisplayName("Client authentication (HTTP/1.1, TLS)")
-// public class AuthenticationHttp1Tls extends TestHttp1ClientAuthentication {
+// class AuthenticationHttp1Tls extends TestHttp1ClientAuthentication {
//
// public AuthenticationHttp1Tls() throws Exception {
// super(URIScheme.HTTPS);
@@ -195,7 +195,7 @@ public class HttpIntegrationTests {
// @Nested
// @DisplayName("Client authentication (HTTP/2)")
-// public class AuthenticationH2 extends TestH2ClientAuthentication {
+// class AuthenticationH2 extends TestH2ClientAuthentication {
//
// public AuthenticationH2() throws Exception {
// super(URIScheme.HTTP);
@@ -205,7 +205,7 @@ public class HttpIntegrationTests {
//
// @Nested
// @DisplayName("Client authentication (HTTP/2, TLS)")
-// public class AuthenticationH2Tls extends TestH2ClientAuthentication {
+// class AuthenticationH2Tls extends TestH2ClientAuthentication {
//
// public AuthenticationH2Tls() throws Exception {
// super(URIScheme.HTTPS);
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/HttpMinimalIntegrationTests.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/HttpMinimalIntegrationTests.java
index fc0169e64..5ba83aa30 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/HttpMinimalIntegrationTests.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/HttpMinimalIntegrationTests.java
@@ -30,13 +30,13 @@ import org.apache.hc.core5.http.URIScheme;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
-public class HttpMinimalIntegrationTests {
+class HttpMinimalIntegrationTests {
@Nested
@DisplayName("Fundamentals (HTTP/1.1)")
- public class Http1 extends TestHttp1AsyncMinimal {
+ class Http1 extends TestHttp1AsyncMinimal {
- public Http1() throws Exception {
+ public Http1() {
super(URIScheme.HTTP);
}
@@ -44,9 +44,9 @@ public class HttpMinimalIntegrationTests {
@Nested
@DisplayName("Fundamentals (HTTP/1.1, TLS)")
- public class Http1Tls extends TestHttp1AsyncMinimal {
+ class Http1Tls extends TestHttp1AsyncMinimal {
- public Http1Tls() throws Exception {
+ public Http1Tls() {
super(URIScheme.HTTPS);
}
@@ -54,9 +54,9 @@ public class HttpMinimalIntegrationTests {
@Nested
@DisplayName("Fundamentals (HTTP/2)")
- public class H2 extends TestH2AsyncMinimal {
+ class H2 extends TestH2AsyncMinimal {
- public H2() throws Exception {
+ public H2() {
super(URIScheme.HTTP);
}
@@ -64,9 +64,9 @@ public class HttpMinimalIntegrationTests {
@Nested
@DisplayName("Fundamentals (HTTP/2, TLS)")
- public class H2Tls extends TestH2AsyncMinimal {
+ class H2Tls extends TestH2AsyncMinimal {
- public H2Tls() throws Exception {
+ public H2Tls() {
super(URIScheme.HTTPS);
}
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/ReactiveIntegrationTests.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/ReactiveIntegrationTests.java
index 81e49b544..91795772d 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/ReactiveIntegrationTests.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/ReactiveIntegrationTests.java
@@ -30,13 +30,13 @@ import org.apache.hc.core5.http.URIScheme;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
-public class ReactiveIntegrationTests {
+class ReactiveIntegrationTests {
@Nested
@DisplayName("Fundamentals (HTTP/1.1)")
- public class Http1 extends TestHttp1Reactive {
+ class Http1 extends TestHttp1Reactive {
- public Http1() throws Exception {
+ public Http1() {
super(URIScheme.HTTP);
}
@@ -44,9 +44,9 @@ public class ReactiveIntegrationTests {
@Nested
@DisplayName("Fundamentals (HTTP/1.1, TLS)")
- public class Http1Tls extends TestHttp1Reactive {
+ class Http1Tls extends TestHttp1Reactive {
- public Http1Tls() throws Exception {
+ public Http1Tls() {
super(URIScheme.HTTPS);
}
@@ -54,9 +54,9 @@ public class ReactiveIntegrationTests {
@Nested
@DisplayName("Fundamentals (HTTP/2)")
- public class H2 extends TestH2Reactive {
+ class H2 extends TestH2Reactive {
- public H2() throws Exception {
+ public H2() {
super(URIScheme.HTTP);
}
@@ -64,9 +64,9 @@ public class ReactiveIntegrationTests {
@Nested
@DisplayName("Fundamentals (HTTP/2, TLS)")
- public class H2Tls extends TestH2Reactive {
+ class H2Tls extends TestH2Reactive {
- public H2Tls() throws Exception {
+ public H2Tls() {
super(URIScheme.HTTPS);
}
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/ReactiveMinimalIntegrationTests.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/ReactiveMinimalIntegrationTests.java
index 27a7da833..149a81ca9 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/ReactiveMinimalIntegrationTests.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/ReactiveMinimalIntegrationTests.java
@@ -30,13 +30,13 @@ import org.apache.hc.core5.http.URIScheme;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
-public class ReactiveMinimalIntegrationTests {
+class ReactiveMinimalIntegrationTests {
@Nested
@DisplayName("Fundamentals (HTTP/1.1)")
- public class Http1 extends TestHttp1ReactiveMinimal {
+ class Http1 extends TestHttp1ReactiveMinimal {
- public Http1() throws Exception {
+ public Http1() {
super(URIScheme.HTTP);
}
@@ -44,9 +44,9 @@ public class ReactiveMinimalIntegrationTests {
@Nested
@DisplayName("Fundamentals (HTTP/1.1, TLS)")
- public class Http1Tls extends TestHttp1ReactiveMinimal {
+ class Http1Tls extends TestHttp1ReactiveMinimal {
- public Http1Tls() throws Exception {
+ public Http1Tls() {
super(URIScheme.HTTPS);
}
@@ -54,9 +54,9 @@ public class ReactiveMinimalIntegrationTests {
@Nested
@DisplayName("Fundamentals (HTTP/2)")
- public class H2 extends TestH2ReactiveMinimal {
+ class H2 extends TestH2ReactiveMinimal {
- public H2() throws Exception {
+ public H2() {
super(URIScheme.HTTP);
}
@@ -64,9 +64,9 @@ public class ReactiveMinimalIntegrationTests {
@Nested
@DisplayName("Fundamentals (HTTP/2, TLS)")
- public class H2Tls extends TestH2ReactiveMinimal {
+ class H2Tls extends TestH2ReactiveMinimal {
- public H2Tls() throws Exception {
+ public H2Tls() {
super(URIScheme.HTTPS);
}
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2Async.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2Async.java
index 2774b1d08..e661e060c 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2Async.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2Async.java
@@ -30,7 +30,7 @@ import org.apache.hc.client5.testing.extension.async.ClientProtocolLevel;
import org.apache.hc.client5.testing.extension.async.ServerProtocolLevel;
import org.apache.hc.core5.http.URIScheme;
-public abstract class TestH2Async extends AbstractHttpAsyncFundamentalsTest {
+abstract class TestH2Async extends AbstractHttpAsyncFundamentalsTest {
public TestH2Async(final URIScheme scheme) {
super(scheme, ClientProtocolLevel.H2_ONLY, ServerProtocolLevel.H2_ONLY);
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2AsyncMinimal.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2AsyncMinimal.java
index c4045cf18..bb6e204c5 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2AsyncMinimal.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2AsyncMinimal.java
@@ -30,7 +30,7 @@ import org.apache.hc.client5.testing.extension.async.ClientProtocolLevel;
import org.apache.hc.client5.testing.extension.async.ServerProtocolLevel;
import org.apache.hc.core5.http.URIScheme;
-public abstract class TestH2AsyncMinimal extends AbstractHttpAsyncFundamentalsTest {
+abstract class TestH2AsyncMinimal extends AbstractHttpAsyncFundamentalsTest {
public TestH2AsyncMinimal(final URIScheme scheme) {
super(scheme, ClientProtocolLevel.MINIMAL_H2_ONLY, ServerProtocolLevel.H2_ONLY);
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2AsyncRedirect.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2AsyncRedirect.java
index b3d93c769..0eede8e15 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2AsyncRedirect.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2AsyncRedirect.java
@@ -30,7 +30,7 @@ import org.apache.hc.client5.testing.extension.async.ClientProtocolLevel;
import org.apache.hc.client5.testing.extension.async.ServerProtocolLevel;
import org.apache.hc.core5.http.URIScheme;
-public abstract class TestH2AsyncRedirect extends AbstractHttpAsyncRedirectsTest {
+abstract class TestH2AsyncRedirect extends AbstractHttpAsyncRedirectsTest {
public TestH2AsyncRedirect(final URIScheme scheme) {
super(scheme, ClientProtocolLevel.H2_ONLY, ServerProtocolLevel.H2_ONLY);
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2ClientAuthentication.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2ClientAuthentication.java
index 178030bf8..7f929e691 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2ClientAuthentication.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2ClientAuthentication.java
@@ -30,7 +30,7 @@ import org.apache.hc.client5.testing.extension.async.ClientProtocolLevel;
import org.apache.hc.client5.testing.extension.async.ServerProtocolLevel;
import org.apache.hc.core5.http.URIScheme;
-public abstract class TestH2ClientAuthentication extends AbstractHttpAsyncClientAuthenticationTest {
+abstract class TestH2ClientAuthentication extends AbstractHttpAsyncClientAuthenticationTest {
public TestH2ClientAuthentication(final URIScheme scheme) {
super(scheme, ClientProtocolLevel.H2_ONLY, ServerProtocolLevel.H2_ONLY);
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2Reactive.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2Reactive.java
index 7d4cb7d0d..24152bada 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2Reactive.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2Reactive.java
@@ -30,7 +30,7 @@ import org.apache.hc.client5.testing.extension.async.ClientProtocolLevel;
import org.apache.hc.client5.testing.extension.async.ServerProtocolLevel;
import org.apache.hc.core5.http.URIScheme;
-public abstract class TestH2Reactive extends AbstractHttpReactiveFundamentalsTest {
+abstract class TestH2Reactive extends AbstractHttpReactiveFundamentalsTest {
public TestH2Reactive(final URIScheme scheme) {
super(scheme, ClientProtocolLevel.H2_ONLY, ServerProtocolLevel.H2_ONLY);
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2ReactiveMinimal.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2ReactiveMinimal.java
index 56da02d9f..310cf4c1f 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2ReactiveMinimal.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestH2ReactiveMinimal.java
@@ -30,7 +30,7 @@ import org.apache.hc.client5.testing.extension.async.ClientProtocolLevel;
import org.apache.hc.client5.testing.extension.async.ServerProtocolLevel;
import org.apache.hc.core5.http.URIScheme;
-public abstract class TestH2ReactiveMinimal extends AbstractHttpReactiveFundamentalsTest {
+abstract class TestH2ReactiveMinimal extends AbstractHttpReactiveFundamentalsTest {
public TestH2ReactiveMinimal(final URIScheme scheme) {
super(scheme, ClientProtocolLevel.MINIMAL_H2_ONLY, ServerProtocolLevel.H2_ONLY);
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Async.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Async.java
index 9e4b52566..15f93b597 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Async.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Async.java
@@ -52,7 +52,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
-public abstract class TestHttp1Async extends AbstractHttpAsyncFundamentalsTest {
+abstract class TestHttp1Async extends AbstractHttpAsyncFundamentalsTest {
public TestHttp1Async(final URIScheme scheme) {
super(scheme, ClientProtocolLevel.STANDARD, ServerProtocolLevel.STANDARD);
@@ -86,7 +86,7 @@ public abstract class TestHttp1Async extends AbstractHttpAsyncFundamentalsTest {
}
@Test
- public void testSharedPool() throws Exception {
+ void testSharedPool() throws Exception {
configureServer(bootstrap -> bootstrap.register("/random/*", AsyncRandomHandler::new));
final HttpHost target = startServer();
@@ -138,7 +138,7 @@ public abstract class TestHttp1Async extends AbstractHttpAsyncFundamentalsTest {
}
@Test
- public void testRequestCancellation() throws Exception {
+ void testRequestCancellation() throws Exception {
configureServer(bootstrap -> bootstrap.register("/random/*", AsyncRandomHandler::new));
final HttpHost target = startServer();
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncMinimal.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncMinimal.java
index 081f97b3e..e4a08c0cc 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncMinimal.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncMinimal.java
@@ -52,14 +52,14 @@ import org.apache.hc.core5.http.nio.support.BasicResponseConsumer;
import org.hamcrest.CoreMatchers;
import org.junit.jupiter.api.Test;
-public abstract class TestHttp1AsyncMinimal extends AbstractHttpAsyncFundamentalsTest {
+abstract class TestHttp1AsyncMinimal extends AbstractHttpAsyncFundamentalsTest {
public TestHttp1AsyncMinimal(final URIScheme scheme) {
super(scheme, ClientProtocolLevel.MINIMAL, ServerProtocolLevel.STANDARD);
}
@Test
- public void testConcurrentPostRequestsSameEndpoint() throws Exception {
+ void testConcurrentPostRequestsSameEndpoint() throws Exception {
configureServer(bootstrap -> bootstrap.register("/echo/*", AsyncEchoHandler::new));
final HttpHost target = startServer();
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncRedirects.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncRedirects.java
index 597dcacda..9dc9c59a5 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncRedirects.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncRedirects.java
@@ -52,14 +52,14 @@ import org.junit.jupiter.api.Test;
/**
* Redirection test cases.
*/
-public abstract class TestHttp1AsyncRedirects extends AbstractHttpAsyncRedirectsTest {
+abstract class TestHttp1AsyncRedirects extends AbstractHttpAsyncRedirectsTest {
public TestHttp1AsyncRedirects(final URIScheme scheme) {
super(scheme, ClientProtocolLevel.STANDARD, ServerProtocolLevel.STANDARD);
}
@Test
- public void testBasicRedirect300NoKeepAlive() throws Exception {
+ void testBasicRedirect300NoKeepAlive() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", AsyncRandomHandler::new)
.setExchangeHandlerDecorator(exchangeHandler -> new RedirectingAsyncDecorator(
@@ -85,7 +85,7 @@ public abstract class TestHttp1AsyncRedirects extends AbstractHttpAsyncRedirects
}
@Test
- public void testBasicRedirect301NoKeepAlive() throws Exception {
+ void testBasicRedirect301NoKeepAlive() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", AsyncRandomHandler::new)
.setExchangeHandlerDecorator(exchangeHandler -> new RedirectingAsyncDecorator(
@@ -112,7 +112,7 @@ public abstract class TestHttp1AsyncRedirects extends AbstractHttpAsyncRedirects
}
@Test
- public void testDefaultHeadersRedirect() throws Exception {
+ void testDefaultHeadersRedirect() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", AsyncRandomHandler::new)
.setExchangeHandlerDecorator(exchangeHandler -> new RedirectingAsyncDecorator(
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncStatefulConnManagement.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncStatefulConnManagement.java
index fa3292969..651539ff3 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncStatefulConnManagement.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1AsyncStatefulConnManagement.java
@@ -50,20 +50,20 @@ import org.apache.hc.core5.net.URIAuthority;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class TestHttp1AsyncStatefulConnManagement extends AbstractIntegrationTestBase {
+class TestHttp1AsyncStatefulConnManagement extends AbstractIntegrationTestBase {
public TestHttp1AsyncStatefulConnManagement() {
super(URIScheme.HTTP, ClientProtocolLevel.STANDARD, ServerProtocolLevel.STANDARD);
}
@Test
- public void testStatefulConnections() throws Exception {
+ void testStatefulConnections() throws Exception {
configureServer(bootstrap -> bootstrap.register("*", () -> new AbstractSimpleServerExchangeHandler() {
@Override
protected SimpleHttpResponse handle(
final SimpleHttpRequest request,
- final HttpCoreContext context) throws HttpException {
+ final HttpCoreContext context) {
final SimpleHttpResponse response = new SimpleHttpResponse(HttpStatus.SC_OK);
response.setBody("Whatever", ContentType.TEXT_PLAIN);
return response;
@@ -173,13 +173,13 @@ public class TestHttp1AsyncStatefulConnManagement extends AbstractIntegrationTes
}
@Test
- public void testRouteSpecificPoolRecylcing() throws Exception {
+ void testRouteSpecificPoolRecylcing() throws Exception {
configureServer(bootstrap -> bootstrap.register("*", () -> new AbstractSimpleServerExchangeHandler() {
@Override
protected SimpleHttpResponse handle(
final SimpleHttpRequest request,
- final HttpCoreContext context) throws HttpException {
+ final HttpCoreContext context) {
final SimpleHttpResponse response = new SimpleHttpResponse(HttpStatus.SC_OK);
response.setBody("Whatever", ContentType.TEXT_PLAIN);
return response;
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1ClientAuthentication.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1ClientAuthentication.java
index 0d5a72fbb..11a4e9fe7 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1ClientAuthentication.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1ClientAuthentication.java
@@ -49,14 +49,14 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
-public abstract class TestHttp1ClientAuthentication extends AbstractHttpAsyncClientAuthenticationTest {
+abstract class TestHttp1ClientAuthentication extends AbstractHttpAsyncClientAuthenticationTest {
public TestHttp1ClientAuthentication(final URIScheme scheme) {
super(scheme, ClientProtocolLevel.STANDARD, ServerProtocolLevel.STANDARD);
}
@Test
- public void testBasicAuthenticationSuccessNonPersistentConnection() throws Exception {
+ void testBasicAuthenticationSuccessNonPersistentConnection() throws Exception {
final HttpHost target = startServer();
configureServer(bootstrap -> bootstrap
.register("*", AsyncEchoHandler::new)
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Reactive.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Reactive.java
index 460ab77bc..9de0a3456 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Reactive.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Reactive.java
@@ -57,7 +57,7 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.reactivestreams.Publisher;
-public abstract class TestHttp1Reactive extends AbstractHttpReactiveFundamentalsTest {
+abstract class TestHttp1Reactive extends AbstractHttpReactiveFundamentalsTest {
public TestHttp1Reactive(final URIScheme scheme) {
super(scheme, ClientProtocolLevel.STANDARD, ServerProtocolLevel.STANDARD);
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1ReactiveMinimal.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1ReactiveMinimal.java
index 07f490b28..6d0c1cdbf 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1ReactiveMinimal.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1ReactiveMinimal.java
@@ -54,14 +54,14 @@ import org.apache.hc.core5.testing.reactive.ReactiveEchoProcessor;
import org.hamcrest.CoreMatchers;
import org.junit.jupiter.api.Test;
-public abstract class TestHttp1ReactiveMinimal extends AbstractHttpReactiveFundamentalsTest {
+abstract class TestHttp1ReactiveMinimal extends AbstractHttpReactiveFundamentalsTest {
public TestHttp1ReactiveMinimal(final URIScheme scheme) {
super(scheme, ClientProtocolLevel.MINIMAL, ServerProtocolLevel.STANDARD);
}
@Test
- public void testConcurrentPostRequestsSameEndpoint() throws Exception {
+ void testConcurrentPostRequestsSameEndpoint() throws Exception {
configureServer(bootstrap -> bootstrap.register("/echo/*", () ->
new ReactiveServerExchangeHandler(new ReactiveEchoProcessor())));
final HttpHost target = startServer();
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1RequestReExecution.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1RequestReExecution.java
index 8a59b9d99..f743871da 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1RequestReExecution.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1RequestReExecution.java
@@ -47,14 +47,14 @@ import org.hamcrest.CoreMatchers;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public abstract class TestHttp1RequestReExecution extends AbstractIntegrationTestBase {
+abstract class TestHttp1RequestReExecution extends AbstractIntegrationTestBase {
public TestHttp1RequestReExecution(final URIScheme scheme) {
super(scheme, ClientProtocolLevel.STANDARD, ServerProtocolLevel.STANDARD);
}
@BeforeEach
- public void setup() {
+ void setup() {
final Resolver<HttpRequest, TimeValue> serviceAvailabilityResolver = new Resolver<HttpRequest, TimeValue>() {
private final AtomicInteger count = new AtomicInteger(0);
@@ -72,7 +72,7 @@ public abstract class TestHttp1RequestReExecution extends AbstractIntegrationTes
}
@Test
- public void testGiveUpAfterOneRetry() throws Exception {
+ void testGiveUpAfterOneRetry() throws Exception {
configureServer(bootstrap -> bootstrap.register("/random/*", AsyncRandomHandler::new));
final HttpHost target = startServer();
@@ -91,7 +91,7 @@ public abstract class TestHttp1RequestReExecution extends AbstractIntegrationTes
}
@Test
- public void testDoNotGiveUpEasily() throws Exception {
+ void testDoNotGiveUpEasily() throws Exception {
configureServer(bootstrap -> bootstrap.register("/random/*", AsyncRandomHandler::new));
final HttpHost target = startServer();
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttpAsyncMinimalTlsHandshake.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttpAsyncMinimalTlsHandshake.java
index 91bb36d82..50c7cfb57 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttpAsyncMinimalTlsHandshake.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttpAsyncMinimalTlsHandshake.java
@@ -44,14 +44,14 @@ import org.apache.hc.core5.ssl.SSLContexts;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class TestHttpAsyncMinimalTlsHandshake extends AbstractIntegrationTestBase {
+class TestHttpAsyncMinimalTlsHandshake extends AbstractIntegrationTestBase {
public TestHttpAsyncMinimalTlsHandshake() {
super(URIScheme.HTTPS, ClientProtocolLevel.MINIMAL, ServerProtocolLevel.STANDARD);
}
@Test
- public void testSuccessfulTlsHandshake() throws Exception {
+ void testSuccessfulTlsHandshake() throws Exception {
final HttpHost target = startServer();
final int maxConnNo = 2;
@@ -69,7 +69,7 @@ public class TestHttpAsyncMinimalTlsHandshake extends AbstractIntegrationTestBas
}
@Test
- public void testTlsHandshakeFailure() throws Exception {
+ void testTlsHandshakeFailure() throws Exception {
final HttpHost target = startServer();
configureClient(builder ->
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttpAsyncProtocolPolicy.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttpAsyncProtocolPolicy.java
index d9f631223..cfefde58e 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttpAsyncProtocolPolicy.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttpAsyncProtocolPolicy.java
@@ -45,7 +45,7 @@ import org.apache.hc.core5.http2.HttpVersionPolicy;
import org.hamcrest.CoreMatchers;
import org.junit.jupiter.api.Test;
-public abstract class TestHttpAsyncProtocolPolicy extends AbstractIntegrationTestBase {
+abstract class TestHttpAsyncProtocolPolicy extends AbstractIntegrationTestBase {
private final HttpVersion version;
@@ -55,7 +55,7 @@ public abstract class TestHttpAsyncProtocolPolicy extends AbstractIntegrationTes
}
@Test
- public void testRequestContext() throws Exception {
+ void testRequestContext() throws Exception {
configureServer(bootstrap -> bootstrap.register("/random/*", AsyncRandomHandler::new));
final HttpHost target = startServer();
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/extension/async/TestAsyncResources.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/extension/async/TestAsyncResources.java
index 86ee12467..0c470fbdf 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/extension/async/TestAsyncResources.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/extension/async/TestAsyncResources.java
@@ -79,7 +79,7 @@ public class TestAsyncResources implements AfterEachCallback {
}
@Override
- public void afterEach(final ExtensionContext extensionContext) throws Exception {
+ public void afterEach(final ExtensionContext extensionContext) {
LOG.debug("Shutting down test server");
if (client != null) {
client.close(CloseMode.GRACEFUL);
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/extension/sync/TestClientResources.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/extension/sync/TestClientResources.java
index 2a32ad148..c38c7fba1 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/extension/sync/TestClientResources.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/extension/sync/TestClientResources.java
@@ -70,7 +70,7 @@ public class TestClientResources implements AfterEachCallback {
}
@Override
- public void afterEach(final ExtensionContext extensionContext) throws Exception {
+ public void afterEach(final ExtensionContext extensionContext) {
LOG.debug("Shutting down test server");
if (client != null) {
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/fluent/TestFluent.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/fluent/TestFluent.java
index 9eefe100c..047178743 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/fluent/TestFluent.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/fluent/TestFluent.java
@@ -51,7 +51,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
-public class TestFluent {
+class TestFluent {
public static final Timeout TIMEOUT = Timeout.ofMinutes(1);
@@ -59,7 +59,7 @@ public class TestFluent {
private TestClientResources testResources = new TestClientResources(URIScheme.HTTP, ClientProtocolLevel.STANDARD, TIMEOUT);
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() {
testResources.configureServer(bootstrap -> bootstrap
.register("/", (request, response, context) ->
response.setEntity(new StringEntity("All is well", ContentType.TEXT_PLAIN)))
@@ -99,7 +99,7 @@ public class TestFluent {
}
@Test
- public void testGetRequest() throws Exception {
+ void testGetRequest() throws Exception {
final HttpHost target = startServer();
final String baseURL = "http://localhost:" + target.getPort();
final String message = Request.get(baseURL + "/").execute().returnContent().asString();
@@ -107,7 +107,7 @@ public class TestFluent {
}
@Test
- public void testGetRequestByName() throws Exception {
+ void testGetRequestByName() throws Exception {
final HttpHost target = startServer();
final String baseURL = "http://localhost:" + target.getPort();
final String message = Request.create("GET", baseURL + "/").execute().returnContent().asString();
@@ -115,7 +115,7 @@ public class TestFluent {
}
@Test
- public void testGetRequestByNameWithURI() throws Exception {
+ void testGetRequestByNameWithURI() throws Exception {
final HttpHost target = startServer();
final String baseURL = "http://localhost:" + target.getPort();
final String message = Request.create("GET", new URI(baseURL + "/")).execute().returnContent().asString();
@@ -123,7 +123,7 @@ public class TestFluent {
}
@Test
- public void testGetRequestFailure() throws Exception {
+ void testGetRequestFailure() throws Exception {
final HttpHost target = startServer();
final String baseURL = "http://localhost:" + target.getPort();
Assertions.assertThrows(ClientProtocolException.class, () ->
@@ -131,7 +131,7 @@ public class TestFluent {
}
@Test
- public void testPostRequest() throws Exception {
+ void testPostRequest() throws Exception {
final HttpHost target = startServer();
final String baseURL = "http://localhost:" + target.getPort();
final String message1 = Request.post(baseURL + "/echo")
@@ -145,7 +145,7 @@ public class TestFluent {
}
@Test
- public void testContentAsStringWithCharset() throws Exception {
+ void testContentAsStringWithCharset() throws Exception {
final HttpHost target = startServer();
final String baseURL = "http://localhost:" + target.getPort();
final Content content = Request.post(baseURL + "/echo").bodyByteArray("Ü".getBytes(StandardCharsets.UTF_8)).execute()
@@ -156,7 +156,7 @@ public class TestFluent {
}
@Test
- public void testConnectionRelease() throws Exception {
+ void testConnectionRelease() throws Exception {
final HttpHost target = startServer();
final String baseURL = "http://localhost:" + target.getPort();
for (int i = 0; i < 20; i++) {
@@ -182,7 +182,7 @@ public class TestFluent {
}
@Test
- public void testLargeResponse() throws Exception {
+ void testLargeResponse() throws Exception {
final HttpHost target = startServer();
final String baseURL = "http://localhost:" + target.getPort();
@@ -192,7 +192,7 @@ public class TestFluent {
}
@Test
- public void testLargeResponseError() throws Exception {
+ void testLargeResponseError() throws Exception {
final HttpHost target = startServer();
final String baseURL = "http://localhost:" + target.getPort();
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/AbstractIntegrationTestBase.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/AbstractIntegrationTestBase.java
index 72d21b442..bf31dbf4c 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/AbstractIntegrationTestBase.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/AbstractIntegrationTestBase.java
@@ -41,7 +41,7 @@ import org.apache.hc.core5.http.URIScheme;
import org.apache.hc.core5.util.Timeout;
import org.junit.jupiter.api.extension.RegisterExtension;
-public abstract class AbstractIntegrationTestBase {
+abstract class AbstractIntegrationTestBase {
public static final Timeout TIMEOUT = Timeout.ofMinutes(1);
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/HttpIntegrationTests.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/HttpIntegrationTests.java
index 639b0c063..f162795f6 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/HttpIntegrationTests.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/HttpIntegrationTests.java
@@ -30,13 +30,13 @@ import org.apache.hc.core5.http.URIScheme;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
-public class HttpIntegrationTests {
+class HttpIntegrationTests {
@Nested
@DisplayName("Request execution (HTTP/1.1)")
- public class RequestExecution extends TestClientRequestExecution {
+ class RequestExecution extends TestClientRequestExecution {
- public RequestExecution() throws Exception {
+ public RequestExecution() {
super(URIScheme.HTTP);
}
@@ -44,9 +44,9 @@ public class HttpIntegrationTests {
@Nested
@DisplayName("Request execution (HTTP/1.1, TLS)")
- public class RequestExecutionTls extends TestClientRequestExecution {
+ class RequestExecutionTls extends TestClientRequestExecution {
- public RequestExecutionTls() throws Exception {
+ public RequestExecutionTls() {
super(URIScheme.HTTPS);
}
@@ -54,9 +54,9 @@ public class HttpIntegrationTests {
@Nested
@DisplayName("Authentication (HTTP/1.1)")
- public class Authentication extends TestClientAuthentication {
+ class Authentication extends TestClientAuthentication {
- public Authentication() throws Exception {
+ public Authentication() {
super(URIScheme.HTTP);
}
@@ -64,9 +64,9 @@ public class HttpIntegrationTests {
@Nested
@DisplayName("Authentication (HTTP/1.1, TLS)")
- public class AuthenticationTls extends TestClientAuthentication {
+ class AuthenticationTls extends TestClientAuthentication {
- public AuthenticationTls() throws Exception {
+ public AuthenticationTls() {
super(URIScheme.HTTPS);
}
@@ -74,9 +74,9 @@ public class HttpIntegrationTests {
@Nested
@DisplayName("Content coding (HTTP/1.1)")
- public class ContentCoding extends TestContentCodings {
+ class ContentCoding extends TestContentCodings {
- public ContentCoding() throws Exception {
+ public ContentCoding() {
super(URIScheme.HTTP);
}
@@ -84,9 +84,9 @@ public class HttpIntegrationTests {
@Nested
@DisplayName("Content coding (HTTP/1.1, TLS)")
- public class ContentCodingTls extends TestContentCodings {
+ class ContentCodingTls extends TestContentCodings {
- public ContentCodingTls() throws Exception {
+ public ContentCodingTls() {
super(URIScheme.HTTPS);
}
@@ -94,9 +94,9 @@ public class HttpIntegrationTests {
@Nested
@DisplayName("Redirects (HTTP/1.1)")
- public class Redirects extends TestRedirects {
+ class Redirects extends TestRedirects {
- public Redirects() throws Exception {
+ public Redirects() {
super(URIScheme.HTTP);
}
@@ -104,9 +104,9 @@ public class HttpIntegrationTests {
@Nested
@DisplayName("Redirects (HTTP/1.1, TLS)")
- public class RedirectsTls extends TestRedirects {
+ class RedirectsTls extends TestRedirects {
- public RedirectsTls() throws Exception {
+ public RedirectsTls() {
super(URIScheme.HTTPS);
}
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/HttpMinimalIntegrationTests.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/HttpMinimalIntegrationTests.java
index 6ba2fdac6..e7a480142 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/HttpMinimalIntegrationTests.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/HttpMinimalIntegrationTests.java
@@ -30,13 +30,13 @@ import org.apache.hc.core5.http.URIScheme;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
-public class HttpMinimalIntegrationTests {
+class HttpMinimalIntegrationTests {
@Nested
@DisplayName("Request execution (HTTP/1.1)")
- public class RequestExecution extends TestMinimalClientRequestExecution {
+ class RequestExecution extends TestMinimalClientRequestExecution {
- public RequestExecution() throws Exception {
+ public RequestExecution() {
super(URIScheme.HTTP);
}
@@ -44,9 +44,9 @@ public class HttpMinimalIntegrationTests {
@Nested
@DisplayName("Request execution (HTTP/1.1, TLS)")
- public class RequestExecutionTls extends TestMinimalClientRequestExecution {
+ class RequestExecutionTls extends TestMinimalClientRequestExecution {
- public RequestExecutionTls() throws Exception {
+ public RequestExecutionTls() {
super(URIScheme.HTTPS);
}
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestBasicConnectionManager.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestBasicConnectionManager.java
index 18c1eeaef..374b86654 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestBasicConnectionManager.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestBasicConnectionManager.java
@@ -37,14 +37,14 @@ import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class TestBasicConnectionManager extends AbstractIntegrationTestBase {
+class TestBasicConnectionManager extends AbstractIntegrationTestBase {
public TestBasicConnectionManager() {
super(URIScheme.HTTP, ClientProtocolLevel.STANDARD);
}
@Test
- public void testBasics() throws Exception {
+ void testBasics() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", new RandomHandler()));
final HttpHost target = startServer();
@@ -62,7 +62,7 @@ public class TestBasicConnectionManager extends AbstractIntegrationTestBase {
}
@Test
- public void testConnectionStillInUse() throws Exception {
+ void testConnectionStillInUse() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", new RandomHandler()));
final HttpHost target = startServer();
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestClientAuthentication.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestClientAuthentication.java
index e49c25f0f..d54f25223 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestClientAuthentication.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestClientAuthentication.java
@@ -94,14 +94,14 @@ import org.mockito.Mockito;
/**
* Unit tests for automatic client authentication.
*/
-public abstract class TestClientAuthentication extends AbstractIntegrationTestBase {
+abstract class TestClientAuthentication extends AbstractIntegrationTestBase {
protected TestClientAuthentication(final URIScheme scheme) {
super(scheme, ClientProtocolLevel.STANDARD);
}
public void configureServerWithBasicAuth(final Authenticator authenticator,
- final Consumer<TestServerBootstrap> serverCustomizer) throws IOException {
+ final Consumer<TestServerBootstrap> serverCustomizer) {
configureServer(bootstrap -> {
bootstrap.setExchangeHandlerDecorator(requestHandler ->
new AuthenticatingDecorator(requestHandler, authenticator));
@@ -109,14 +109,14 @@ public abstract class TestClientAuthentication extends AbstractIntegrationTestBa
});
}
- public void configureServerWithBasicAuth(final Consumer<TestServerBootstrap> serverCustomizer) throws IOException {
+ public void configureServerWithBasicAuth(final Consumer<TestServerBootstrap> serverCustomizer) {
configureServerWithBasicAuth(
new BasicTestAuthenticator("test:test", "test realm"),
serverCustomizer);
}
@Test
- public void testBasicAuthenticationNoCreds() throws Exception {
+ void testBasicAuthenticationNoCreds() throws Exception {
configureServerWithBasicAuth(bootstrap -> bootstrap
.register("*", new EchoHandler()));
final HttpHost target = startServer();
@@ -140,7 +140,7 @@ public abstract class TestClientAuthentication extends AbstractIntegrationTestBa
}
@Test
- public void testBasicAuthenticationFailure() throws Exception {
+ void testBasicAuthenticationFailure() throws Exception {
configureServerWithBasicAuth(bootstrap -> bootstrap
.register("*", new EchoHandler()));
final HttpHost target = startServer();
@@ -166,7 +166,7 @@ public abstract class TestClientAuthentication extends AbstractIntegrationTestBa
}
@Test
- public void testBasicAuthenticationSuccess() throws Exception {
+ void testBasicAuthenticationSuccess() throws Exception {
configureServerWithBasicAuth(bootstrap -> bootstrap
.register("*", new EchoHandler()));
final HttpHost target = startServer();
@@ -191,7 +191,7 @@ public abstract class TestClientAuthentication extends AbstractIntegrationTestBa
}
@Test
- public void testBasicAuthenticationSuccessOnNonRepeatablePutExpectContinue() throws Exception {
+ void testBasicAuthenticationSuccessOnNonRepeatablePutExpectContinue() throws Exception {
configureServer(bootstrap -> bootstrap
.register("*", new EchoHandler()));
final HttpHost target = startServer();
@@ -222,7 +222,7 @@ public abstract class TestClientAuthentication extends AbstractIntegrationTestBa
}
@Test
- public void testBasicAuthenticationFailureOnNonRepeatablePutDontExpectContinue() throws Exception {
+ void testBasicAuthenticationFailureOnNonRepeatablePutDontExpectContinue() throws Exception {
configureServerWithBasicAuth(bootstrap -> bootstrap
.register("*", new EchoHandler()));
final HttpHost target = startServer();
@@ -253,7 +253,7 @@ public abstract class TestClientAuthentication extends AbstractIntegrationTestBa
}
@Test
- public void testBasicAuthenticationSuccessOnRepeatablePost() throws Exception {
+ void testBasicAuthenticationSuccessOnRepeatablePost() throws Exception {
configureServerWithBasicAuth(bootstrap -> bootstrap
.register("*", new EchoHandler()));
final HttpHost target = startServer();
@@ -281,7 +281,7 @@ public abstract class TestClientAuthentication extends AbstractIntegrationTestBa
}
@Test
- public void testBasicAuthenticationFailureOnNonRepeatablePost() throws Exception {
+ void testBasicAuthenticationFailureOnNonRepeatablePost() throws Exception {
configureServerWithBasicAuth(bootstrap -> bootstrap
.register("*", new EchoHandler()));
final HttpHost target = startServer();
@@ -312,7 +312,7 @@ public abstract class TestClientAuthentication extends AbstractIntegrationTestBa
}
@Test
- public void testBasicAuthenticationCredentialsCaching() throws Exception {
+ void testBasicAuthenticationCredentialsCaching() throws Exception {
configureServerWithBasicAuth(bootstrap -> bootstrap
.register("*", new EchoHandler()));
final HttpHost target = startServer();
@@ -350,7 +350,7 @@ public abstract class TestClientAuthentication extends AbstractIntegrationTestBa
}
@Test
- public void testBasicAuthenticationCredentialsCachingByPathPrefix() throws Exception {
+ void testBasicAuthenticationCredentialsCachingByPathPrefix() throws Exception {
configureServerWithBasicAuth(bootstrap -> bootstrap
.register("*", new EchoHandler()));
final HttpHost target = startServer();
@@ -415,7 +415,7 @@ public abstract class TestClientAuthentication extends AbstractIntegrationTestBa
}
@Test
- public void testAuthenticationCredentialsCachingReAuthenticationOnDifferentRealm() throws Exception {
+ void testAuthenticationCredentialsCachingReAuthenticationOnDifferentRealm() throws Exception {
configureServerWithBasicAuth(new Authenticator() {
@Override
@@ -492,7 +492,7 @@ public abstract class TestClientAuthentication extends AbstractIntegrationTestBa
}
@Test
- public void testAuthenticationUserinfoInRequest() throws Exception {
+ void testAuthenticationUserinfoInRequest() throws Exception {
configureServer(bootstrap -> bootstrap
.register("*", new EchoHandler()));
final HttpHost target = startServer();
@@ -505,7 +505,7 @@ public abstract class TestClientAuthentication extends AbstractIntegrationTestBa
}
@Test
- public void testPreemptiveAuthentication() throws Exception {
+ void testPreemptiveAuthentication() throws Exception {
final Authenticator authenticator = Mockito.spy(new BasicTestAuthenticator("test:test", "test realm"));
configureServerWithBasicAuth(authenticator,
bootstrap -> bootstrap
@@ -534,7 +534,7 @@ public abstract class TestClientAuthentication extends AbstractIntegrationTestBa
}
@Test
- public void testPreemptiveAuthenticationFailure() throws Exception {
+ void testPreemptiveAuthenticationFailure() throws Exception {
final Authenticator authenticator = Mockito.spy(new BasicTestAuthenticator("test:test", "test realm"));
configureServerWithBasicAuth(authenticator,
bootstrap -> bootstrap
@@ -569,7 +569,7 @@ public abstract class TestClientAuthentication extends AbstractIntegrationTestBa
public void handle(
final ClassicHttpRequest request,
final ClassicHttpResponse response,
- final HttpContext context) throws HttpException, IOException {
+ final HttpContext context) {
final String creds = (String) context.getAttribute("creds");
if (creds == null || !creds.equals("test:test")) {
response.setCode(HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED);
@@ -583,7 +583,7 @@ public abstract class TestClientAuthentication extends AbstractIntegrationTestBa
}
@Test
- public void testAuthenticationTargetAsProxy() throws Exception {
+ void testAuthenticationTargetAsProxy() throws Exception {
configureServer(bootstrap -> bootstrap
.register("*", new ProxyAuthHandler()));
final HttpHost target = startServer();
@@ -604,7 +604,7 @@ public abstract class TestClientAuthentication extends AbstractIntegrationTestBa
}
@Test
- public void testConnectionCloseAfterAuthenticationSuccess() throws Exception {
+ void testConnectionCloseAfterAuthenticationSuccess() throws Exception {
configureServer(bootstrap -> bootstrap
.setExchangeHandlerDecorator(requestHandler ->
new AuthenticatingDecorator(requestHandler, new BasicTestAuthenticator("test:test", "test realm")) {
@@ -640,7 +640,7 @@ public abstract class TestClientAuthentication extends AbstractIntegrationTestBa
}
@Test
- public void testReauthentication() throws Exception {
+ void testReauthentication() throws Exception {
final BasicSchemeFactory myBasicAuthSchemeFactory = new BasicSchemeFactory() {
@Override
@@ -720,7 +720,7 @@ public abstract class TestClientAuthentication extends AbstractIntegrationTestBa
}
@Test
- public void testAuthenticationFallback() throws Exception {
+ void testAuthenticationFallback() throws Exception {
configureServer(bootstrap -> bootstrap
.setExchangeHandlerDecorator(requestHandler ->
new AuthenticatingDecorator(requestHandler, new BasicTestAuthenticator("test:test", "test realm")) {
@@ -759,7 +759,7 @@ public abstract class TestClientAuthentication extends AbstractIntegrationTestBa
private final static String CHARS = "0123456789abcdef";
@Test
- public void testBearerTokenAuthentication() throws Exception {
+ void testBearerTokenAuthentication() throws Exception {
final SecureRandom secureRandom = SecureRandom.getInstanceStrong();
secureRandom.setSeed(System.currentTimeMillis());
final StringBuilder buf = new StringBuilder();
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestClientRequestExecution.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestClientRequestExecution.java
index a797d9114..fc850e92e 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestClientRequestExecution.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestClientRequestExecution.java
@@ -71,7 +71,7 @@ import org.junit.jupiter.api.Test;
/**
* Client protocol handling tests.
*/
-public abstract class TestClientRequestExecution extends AbstractIntegrationTestBase {
+abstract class TestClientRequestExecution extends AbstractIntegrationTestBase {
public TestClientRequestExecution(final URIScheme scheme) {
super(scheme, ClientProtocolLevel.STANDARD);
@@ -87,7 +87,7 @@ public abstract class TestClientRequestExecution extends AbstractIntegrationTest
public void handle(
final ClassicHttpRequest request,
final ClassicHttpResponse response,
- final HttpContext context) throws HttpException, IOException {
+ final HttpContext context) {
response.setCode(HttpStatus.SC_OK);
final StringEntity entity = new StringEntity("Whatever");
response.setEntity(entity);
@@ -131,7 +131,7 @@ public abstract class TestClientRequestExecution extends AbstractIntegrationTest
}
@Test
- public void testAutoGeneratedHeaders() throws Exception {
+ void testAutoGeneratedHeaders() throws Exception {
configureServer(bootstrap -> bootstrap.register("*", new SimpleService()));
final HttpHost target = startServer();
@@ -191,7 +191,7 @@ public abstract class TestClientRequestExecution extends AbstractIntegrationTest
}
@Test
- public void testNonRepeatableEntity() throws Exception {
+ void testNonRepeatableEntity() throws Exception {
configureServer(bootstrap -> bootstrap.register("*", new SimpleService()));
final HttpHost target = startServer();
@@ -242,7 +242,7 @@ public abstract class TestClientRequestExecution extends AbstractIntegrationTest
}
@Test
- public void testNonCompliantURI() throws Exception {
+ void testNonCompliantURI() throws Exception {
configureServer(bootstrap -> bootstrap.register("*", new SimpleService()));
final HttpHost target = startServer();
@@ -262,7 +262,7 @@ public abstract class TestClientRequestExecution extends AbstractIntegrationTest
}
@Test
- public void testRelativeRequestURIWithFragment() throws Exception {
+ void testRelativeRequestURIWithFragment() throws Exception {
configureServer(bootstrap -> bootstrap.register("*", new SimpleService()));
final HttpHost target = startServer();
@@ -282,7 +282,7 @@ public abstract class TestClientRequestExecution extends AbstractIntegrationTest
}
@Test
- public void testAbsoluteRequestURIWithFragment() throws Exception {
+ void testAbsoluteRequestURIWithFragment() throws Exception {
configureServer(bootstrap -> bootstrap.register("*", new SimpleService()));
final HttpHost target = startServer();
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestConnectionManagement.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestConnectionManagement.java
index 028d8e473..8c215b2a8 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestConnectionManagement.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestConnectionManagement.java
@@ -67,7 +67,7 @@ import org.junit.jupiter.api.Test;
* Tests for {@code PoolingHttpClientConnectionManager} that do require a server
* to communicate with.
*/
-public class TestConnectionManagement extends AbstractIntegrationTestBase {
+class TestConnectionManagement extends AbstractIntegrationTestBase {
public TestConnectionManagement() {
super(URIScheme.HTTP, ClientProtocolLevel.STANDARD);
@@ -76,7 +76,7 @@ public class TestConnectionManagement extends AbstractIntegrationTestBase {
ConnectionEndpoint.RequestExecutor exec;
@BeforeEach
- public void setup() {
+ void setup() {
exec = new ConnectionEndpoint.RequestExecutor() {
final HttpRequestExecutor requestExecutor = new HttpRequestExecutor();
@@ -99,7 +99,7 @@ public class TestConnectionManagement extends AbstractIntegrationTestBase {
* Tests releasing and re-using a connection after a response is read.
*/
@Test
- public void testReleaseConnection() throws Exception {
+ void testReleaseConnection() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", new RandomHandler()));
final HttpHost target = startServer();
@@ -162,7 +162,7 @@ public class TestConnectionManagement extends AbstractIntegrationTestBase {
* Tests releasing with time limits.
*/
@Test
- public void testReleaseConnectionWithTimeLimits() throws Exception {
+ void testReleaseConnectionWithTimeLimits() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", new RandomHandler()));
final HttpHost target = startServer();
@@ -233,7 +233,7 @@ public class TestConnectionManagement extends AbstractIntegrationTestBase {
}
@Test
- public void testCloseExpiredIdleConnections() throws Exception {
+ void testCloseExpiredIdleConnections() throws Exception {
final HttpHost target = startServer();
final TestClient client = client();
final PoolingHttpClientConnectionManager connManager = client.getConnectionManager();
@@ -273,7 +273,7 @@ public class TestConnectionManagement extends AbstractIntegrationTestBase {
}
@Test
- public void testCloseExpiredTTLConnections() throws Exception {
+ void testCloseExpiredTTLConnections() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", new RandomHandler()));
final HttpHost target = startServer();
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestConnectionReuse.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestConnectionReuse.java
index d056e10a9..3b11dd0d3 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestConnectionReuse.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestConnectionReuse.java
@@ -59,14 +59,14 @@ import org.apache.hc.core5.http.protocol.HttpContext;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class TestConnectionReuse extends AbstractIntegrationTestBase {
+class TestConnectionReuse extends AbstractIntegrationTestBase {
public TestConnectionReuse() {
super(URIScheme.HTTP, ClientProtocolLevel.STANDARD);
}
@Test
- public void testReuseOfPersistentConnections() throws Exception {
+ void testReuseOfPersistentConnections() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", new RandomHandler()));
final HttpHost target = startServer();
@@ -103,7 +103,7 @@ public class TestConnectionReuse extends AbstractIntegrationTestBase {
}
@Test
- public void testReuseOfPersistentConnectionsWithStreamedRequestAndResponse() throws Exception {
+ void testReuseOfPersistentConnectionsWithStreamedRequestAndResponse() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", new RandomHandler()));
final HttpHost target = startServer();
@@ -150,14 +150,14 @@ public class TestConnectionReuse extends AbstractIntegrationTestBase {
public void process(
final HttpResponse response,
final EntityDetails entityDetails,
- final HttpContext context) throws HttpException, IOException {
+ final HttpContext context) {
response.setHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE);
}
}
@Test
- public void testReuseOfClosedConnections() throws Exception {
+ void testReuseOfClosedConnections() throws Exception {
configureServer(bootstrap -> bootstrap
.setHttpProcessor(HttpProcessors.customServer(null)
.add(new AlwaysCloseConn())
@@ -196,7 +196,7 @@ public class TestConnectionReuse extends AbstractIntegrationTestBase {
}
@Test
- public void testReuseOfAbortedConnections() throws Exception {
+ void testReuseOfAbortedConnections() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", new RandomHandler()));
final HttpHost target = startServer();
@@ -233,7 +233,7 @@ public class TestConnectionReuse extends AbstractIntegrationTestBase {
}
@Test
- public void testKeepAliveHeaderRespected() throws Exception {
+ void testKeepAliveHeaderRespected() throws Exception {
configureServer(bootstrap -> bootstrap
.setHttpProcessor(HttpProcessors.customServer(null)
.add(new ResponseKeepAlive())
@@ -350,7 +350,7 @@ public class TestConnectionReuse extends AbstractIntegrationTestBase {
public void process(
final HttpResponse response,
final EntityDetails entityDetails,
- final HttpContext context) throws HttpException, IOException {
+ final HttpContext context) {
final Header connection = response.getFirstHeader(HttpHeaders.CONNECTION);
if(connection != null) {
if(!connection.getValue().equalsIgnoreCase("Close")) {
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestContentCodings.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestContentCodings.java
index 2e179ca9c..8a5e4c1c1 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestContentCodings.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestContentCodings.java
@@ -68,7 +68,7 @@ import org.junit.jupiter.api.Test;
* require no intervention from the user of HttpClient, but we still want to let clients do their
* own thing if they so wish.
*/
-public abstract class TestContentCodings extends AbstractIntegrationTestBase {
+abstract class TestContentCodings extends AbstractIntegrationTestBase {
protected TestContentCodings(final URIScheme scheme) {
super(scheme, ClientProtocolLevel.STANDARD);
@@ -82,7 +82,7 @@ public abstract class TestContentCodings extends AbstractIntegrationTestBase {
* if there was a problem
*/
@Test
- public void testResponseWithNoContent() throws Exception {
+ void testResponseWithNoContent() throws Exception {
configureServer(bootstrap -> bootstrap
.register("*", new HttpRequestHandler() {
@@ -93,7 +93,7 @@ public abstract class TestContentCodings extends AbstractIntegrationTestBase {
public void handle(
final ClassicHttpRequest request,
final ClassicHttpResponse response,
- final HttpContext context) throws HttpException, IOException {
+ final HttpContext context) {
response.setCode(HttpStatus.SC_NO_CONTENT);
}
}));
@@ -117,7 +117,7 @@ public abstract class TestContentCodings extends AbstractIntegrationTestBase {
* @throws Exception
*/
@Test
- public void testDeflateSupportForServerReturningRfc1950Stream() throws Exception {
+ void testDeflateSupportForServerReturningRfc1950Stream() throws Exception {
final String entityText = "Hello, this is some plain text coming back.";
configureServer(bootstrap -> bootstrap
@@ -142,7 +142,7 @@ public abstract class TestContentCodings extends AbstractIntegrationTestBase {
* @throws Exception
*/
@Test
- public void testDeflateSupportForServerReturningRfc1951Stream() throws Exception {
+ void testDeflateSupportForServerReturningRfc1951Stream() throws Exception {
final String entityText = "Hello, this is some plain text coming back.";
configureServer(bootstrap -> bootstrap
@@ -166,7 +166,7 @@ public abstract class TestContentCodings extends AbstractIntegrationTestBase {
* @throws Exception
*/
@Test
- public void testGzipSupport() throws Exception {
+ void testGzipSupport() throws Exception {
final String entityText = "Hello, this is some plain text coming back.";
configureServer(bootstrap -> bootstrap
@@ -191,7 +191,7 @@ public abstract class TestContentCodings extends AbstractIntegrationTestBase {
* if there was a problem
*/
@Test
- public void testThreadSafetyOfContentCodings() throws Exception {
+ void testThreadSafetyOfContentCodings() throws Exception {
final String entityText = "Hello, this is some plain text coming back.";
configureServer(bootstrap -> bootstrap
@@ -241,7 +241,7 @@ public abstract class TestContentCodings extends AbstractIntegrationTestBase {
}
@Test
- public void testHttpEntityWriteToForGzip() throws Exception {
+ void testHttpEntityWriteToForGzip() throws Exception {
final String entityText = "Hello, this is some plain text coming back.";
configureServer(bootstrap -> bootstrap
@@ -262,7 +262,7 @@ public abstract class TestContentCodings extends AbstractIntegrationTestBase {
}
@Test
- public void testHttpEntityWriteToForDeflate() throws Exception {
+ void testHttpEntityWriteToForDeflate() throws Exception {
final String entityText = "Hello, this is some plain text coming back.";
configureServer(bootstrap -> bootstrap
@@ -282,7 +282,7 @@ public abstract class TestContentCodings extends AbstractIntegrationTestBase {
}
@Test
- public void gzipResponsesWorkWithBasicResponseHandler() throws Exception {
+ void gzipResponsesWorkWithBasicResponseHandler() throws Exception {
final String entityText = "Hello, this is some plain text coming back.";
configureServer(bootstrap -> bootstrap
@@ -298,7 +298,7 @@ public abstract class TestContentCodings extends AbstractIntegrationTestBase {
}
@Test
- public void deflateResponsesWorkWithBasicResponseHandler() throws Exception {
+ void deflateResponsesWorkWithBasicResponseHandler() throws Exception {
final String entityText = "Hello, this is some plain text coming back.";
configureServer(bootstrap -> bootstrap
@@ -336,7 +336,7 @@ public abstract class TestContentCodings extends AbstractIntegrationTestBase {
public void handle(
final ClassicHttpRequest request,
final ClassicHttpResponse response,
- final HttpContext context) throws HttpException, IOException {
+ final HttpContext context) {
response.setEntity(new StringEntity(entityText));
response.addHeader("Content-Type", "text/plain");
final Iterator<HeaderElement> it = MessageSupport.iterate(request, "Accept-Encoding");
@@ -384,7 +384,7 @@ public abstract class TestContentCodings extends AbstractIntegrationTestBase {
public void handle(
final ClassicHttpRequest request,
final ClassicHttpResponse response,
- final HttpContext context) throws HttpException, IOException {
+ final HttpContext context) throws IOException {
response.setEntity(new StringEntity(entityText));
response.addHeader("Content-Type", "text/plain");
response.addHeader("Content-Type", "text/plain");
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestCookieVirtualHost.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestCookieVirtualHost.java
index 6eea853d3..8e5eced0a 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestCookieVirtualHost.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestCookieVirtualHost.java
@@ -50,19 +50,19 @@ import org.junit.jupiter.api.Test;
/**
* This class tests cookie matching when using Virtual Host.
*/
-public class TestCookieVirtualHost {
+class TestCookieVirtualHost {
private HttpServer server;
@AfterEach
- public void shutDown() throws Exception {
+ void shutDown() {
if (this.server != null) {
this.server.close(CloseMode.GRACEFUL);
}
}
@Test
- public void testCookieMatchingWithVirtualHosts() throws Exception {
+ void testCookieMatchingWithVirtualHosts() throws Exception {
server = ServerBootstrap.bootstrap()
.register("app.mydomain.fr", "*", (request, response, context) -> {
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestDefaultClientTlsStrategy.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestDefaultClientTlsStrategy.java
index 0242a9cc3..736e21f6d 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestDefaultClientTlsStrategy.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestDefaultClientTlsStrategy.java
@@ -68,12 +68,12 @@ import org.junit.jupiter.api.Test;
/**
* Unit tests for {@link DefaultClientTlsStrategy}.
*/
-public class TestDefaultClientTlsStrategy {
+class TestDefaultClientTlsStrategy {
private HttpServer server;
@AfterEach
- public void shutDown() throws Exception {
+ void shutDown() {
if (this.server != null) {
this.server.close(CloseMode.GRACEFUL);
}
@@ -96,7 +96,7 @@ public class TestDefaultClientTlsStrategy {
}
@Test
- public void testBasicSSL() throws Exception {
+ void testBasicSSL() throws Exception {
// @formatter:off
this.server = ServerBootstrap.bootstrap()
.setSslContext(SSLTestContexts.createServerSSLContext())
@@ -126,7 +126,7 @@ public class TestDefaultClientTlsStrategy {
}
@Test
- public void testBasicDefaultHostnameVerifier() throws Exception {
+ void testBasicDefaultHostnameVerifier() throws Exception {
// @formatter:off
this.server = ServerBootstrap.bootstrap()
.setSslContext(SSLTestContexts.createServerSSLContext())
@@ -153,7 +153,7 @@ public class TestDefaultClientTlsStrategy {
}
@Test
- public void testClientAuthSSL() throws Exception {
+ void testClientAuthSSL() throws Exception {
// @formatter:off
this.server = ServerBootstrap.bootstrap()
.setSslContext(SSLTestContexts.createServerSSLContext())
@@ -183,7 +183,7 @@ public class TestDefaultClientTlsStrategy {
}
@Test
- public void testClientAuthSSLFailure() throws Exception {
+ void testClientAuthSSLFailure() throws Exception {
// @formatter:off
this.server = ServerBootstrap.bootstrap()
.setSslContext(SSLTestContexts.createServerSSLContext())
@@ -217,7 +217,7 @@ public class TestDefaultClientTlsStrategy {
}
@Test
- public void testSSLTrustVerification() throws Exception {
+ void testSSLTrustVerification() throws Exception {
// @formatter:off
this.server = ServerBootstrap.bootstrap()
.setSslContext(SSLTestContexts.createServerSSLContext())
@@ -245,13 +245,13 @@ public class TestDefaultClientTlsStrategy {
}
@Test
- public void testSSLTrustVerificationOverrideWithCustom() throws Exception {
+ void testSSLTrustVerificationOverrideWithCustom() throws Exception {
final TrustStrategy trustStrategy = (chain, authType) -> chain.length == 1;
testSSLTrustVerificationOverride(trustStrategy);
}
private void testSSLTrustVerificationOverride(final TrustStrategy trustStrategy)
- throws Exception, IOException, NoSuchAlgorithmException, KeyManagementException, KeyStoreException {
+ throws Exception {
// @formatter:off
this.server = ServerBootstrap.bootstrap()
.setSslContext(SSLTestContexts.createServerSSLContext())
@@ -284,7 +284,7 @@ public class TestDefaultClientTlsStrategy {
}
@Test
- public void testSSLDisabledByDefault() throws Exception {
+ void testSSLDisabledByDefault() throws Exception {
// @formatter:off
this.server = ServerBootstrap.bootstrap()
.setSslContext(SSLTestContexts.createServerSSLContext())
@@ -310,7 +310,7 @@ public class TestDefaultClientTlsStrategy {
}
@Test
- public void testWeakCiphersDisabledByDefault() {
+ void testWeakCiphersDisabledByDefault() {
final String[] weakCiphersSuites = {
"SSL_RSA_WITH_RC4_128_SHA",
"SSL_RSA_WITH_3DES_EDE_CBC_SHA",
@@ -362,7 +362,7 @@ public class TestDefaultClientTlsStrategy {
}
@Test
- public void testHostnameVerificationClient() throws Exception {
+ void testHostnameVerificationClient() throws Exception {
// @formatter:off
this.server = ServerBootstrap.bootstrap()
.setSslContext(SSLTestContexts.createServerSSLContext())
@@ -424,7 +424,7 @@ public class TestDefaultClientTlsStrategy {
}
@Test
- public void testHostnameVerificationBuiltIn() throws Exception {
+ void testHostnameVerificationBuiltIn() throws Exception {
// @formatter:off
this.server = ServerBootstrap.bootstrap()
.setSslContext(SSLTestContexts.createServerSSLContext())
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestFutureRequestExecutionService.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestFutureRequestExecutionService.java
index b4008b20b..3a366ca12 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestFutureRequestExecutionService.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestFutureRequestExecutionService.java
@@ -61,7 +61,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@SuppressWarnings("boxing") // test code
-public class TestFutureRequestExecutionService {
+class TestFutureRequestExecutionService {
private HttpServer localServer;
private String uri;
@@ -70,7 +70,7 @@ public class TestFutureRequestExecutionService {
private final AtomicBoolean blocked = new AtomicBoolean(false);
@BeforeEach
- public void before() throws Exception {
+ void before() throws Exception {
this.localServer = ServerBootstrap.bootstrap()
.setCanonicalHostName("localhost")
.register("/wait", (request, response, context) -> {
@@ -97,21 +97,21 @@ public class TestFutureRequestExecutionService {
}
@AfterEach
- public void after() throws Exception {
+ void after() throws Exception {
blocked.set(false); // any remaining requests should unblock
this.localServer.stop();
httpAsyncClientWithFuture.close();
}
@Test
- public void shouldExecuteSingleCall() throws InterruptedException, ExecutionException {
+ void shouldExecuteSingleCall() throws InterruptedException, ExecutionException {
final FutureTask<Boolean> task = httpAsyncClientWithFuture.execute(
new HttpGet(uri), HttpClientContext.create(), new OkidokiHandler());
Assertions.assertTrue(task.get(), "request should have returned OK");
}
@Test
- public void shouldCancel() throws InterruptedException, ExecutionException {
+ void shouldCancel() {
final FutureTask<Boolean> task = httpAsyncClientWithFuture.execute(
new HttpGet(uri), HttpClientContext.create(), new OkidokiHandler());
task.cancel(true);
@@ -122,7 +122,7 @@ public class TestFutureRequestExecutionService {
}
@Test
- public void shouldTimeout() throws InterruptedException, ExecutionException, TimeoutException {
+ void shouldTimeout() {
blocked.set(true);
final FutureTask<Boolean> task = httpAsyncClientWithFuture.execute(
new HttpGet(uri), HttpClientContext.create(), new OkidokiHandler());
@@ -131,7 +131,7 @@ public class TestFutureRequestExecutionService {
}
@Test
- public void shouldExecuteMultipleCalls() throws Exception {
+ void shouldExecuteMultipleCalls() throws Exception {
final int reqNo = 100;
final Queue<Future<Boolean>> tasks = new LinkedList<>();
for(int i = 0; i < reqNo; i++) {
@@ -147,7 +147,7 @@ public class TestFutureRequestExecutionService {
}
@Test
- public void shouldExecuteMultipleCallsAndCallback() throws Exception {
+ void shouldExecuteMultipleCallsAndCallback() throws Exception {
final int reqNo = 100;
final Queue<Future<Boolean>> tasks = new LinkedList<>();
final CountDownLatch latch = new CountDownLatch(reqNo);
@@ -194,7 +194,7 @@ public class TestFutureRequestExecutionService {
private final class OkidokiHandler implements HttpClientResponseHandler<Boolean> {
@Override
public Boolean handleResponse(
- final ClassicHttpResponse response) throws IOException {
+ final ClassicHttpResponse response) {
return response.getCode() == 200;
}
}
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestHttpClientBuilderInterceptors.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestHttpClientBuilderInterceptors.java
index 160616e2d..621a45f38 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestHttpClientBuilderInterceptors.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestHttpClientBuilderInterceptors.java
@@ -40,14 +40,14 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@SuppressWarnings("boxing") // test code
-public class TestHttpClientBuilderInterceptors extends AbstractIntegrationTestBase {
+class TestHttpClientBuilderInterceptors extends AbstractIntegrationTestBase {
public TestHttpClientBuilderInterceptors() {
super(URIScheme.HTTP, ClientProtocolLevel.STANDARD);
}
@BeforeEach
- public void before() throws Exception {
+ void before() {
configureServer(bootstrap -> bootstrap
.register("/test", (request, response, context) -> {
final Header testInterceptorHeader = request.getHeader("X-Test-Interceptor");
@@ -64,7 +64,7 @@ public class TestHttpClientBuilderInterceptors extends AbstractIntegrationTestBa
}
@Test
- public void testAddExecInterceptorLastShouldBeExecuted() throws Exception {
+ void testAddExecInterceptorLastShouldBeExecuted() throws Exception {
final HttpHost httpHost = startServer();
final TestClient client = client();
final ClassicHttpRequest request = new HttpPost("/test");
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestIdleConnectionEviction.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestIdleConnectionEviction.java
index 0bf8777f3..24fe2bf76 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestIdleConnectionEviction.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestIdleConnectionEviction.java
@@ -43,14 +43,14 @@ import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.apache.hc.core5.util.TimeValue;
import org.junit.jupiter.api.Test;
-public class TestIdleConnectionEviction extends AbstractIntegrationTestBase {
+class TestIdleConnectionEviction extends AbstractIntegrationTestBase {
public TestIdleConnectionEviction() {
super(URIScheme.HTTP, ClientProtocolLevel.STANDARD);
}
@Test
- public void testIdleConnectionEviction() throws Exception {
+ void testIdleConnectionEviction() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/random/*", new RandomHandler()));
final HttpHost target = startServer();
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestMalformedServerResponse.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestMalformedServerResponse.java
index d3e118e67..21b034bde 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestMalformedServerResponse.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestMalformedServerResponse.java
@@ -48,12 +48,12 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class TestMalformedServerResponse {
+class TestMalformedServerResponse {
private HttpServer server;
@AfterEach
- public void shutDown() throws Exception {
+ void shutDown() {
if (this.server != null) {
this.server.close(CloseMode.GRACEFUL);
}
@@ -95,7 +95,7 @@ public class TestMalformedServerResponse {
}
@Test
- public void testNoContentResponseWithGarbage() throws Exception {
+ void testNoContentResponseWithGarbage() throws Exception {
server = ServerBootstrap.bootstrap()
.setCanonicalHostName("localhost")
.setConnectionFactory(new BrokenServerConnectionFactory())
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestMinimalClientRequestExecution.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestMinimalClientRequestExecution.java
index 0ab13d15f..ad213718e 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestMinimalClientRequestExecution.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestMinimalClientRequestExecution.java
@@ -53,7 +53,7 @@ import org.junit.jupiter.api.Test;
/**
* Client protocol handling tests.
*/
-public abstract class TestMinimalClientRequestExecution extends AbstractIntegrationTestBase {
+abstract class TestMinimalClientRequestExecution extends AbstractIntegrationTestBase {
protected TestMinimalClientRequestExecution(final URIScheme scheme) {
super(scheme, ClientProtocolLevel.MINIMAL);
@@ -69,7 +69,7 @@ public abstract class TestMinimalClientRequestExecution extends AbstractIntegrat
public void handle(
final ClassicHttpRequest request,
final ClassicHttpResponse response,
- final HttpContext context) throws HttpException, IOException {
+ final HttpContext context) {
response.setCode(HttpStatus.SC_OK);
final StringEntity entity = new StringEntity("Whatever");
response.setEntity(entity);
@@ -77,7 +77,7 @@ public abstract class TestMinimalClientRequestExecution extends AbstractIntegrat
}
@Test
- public void testNonCompliantURIWithContext() throws Exception {
+ void testNonCompliantURIWithContext() throws Exception {
configureServer(bootstrap -> bootstrap.register("*", new SimpleService()));
final HttpHost target = startServer();
@@ -108,7 +108,7 @@ public abstract class TestMinimalClientRequestExecution extends AbstractIntegrat
}
@Test
- public void testNonCompliantURIWithoutContext() throws Exception {
+ void testNonCompliantURIWithoutContext() throws Exception {
configureServer(bootstrap -> bootstrap.register("*", new SimpleService()));
final HttpHost target = startServer();
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestRedirects.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestRedirects.java
index 9545835ff..3f1b30a76 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestRedirects.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestRedirects.java
@@ -75,14 +75,14 @@ import org.junit.jupiter.api.Test;
/**
* Redirection test cases.
*/
-public abstract class TestRedirects extends AbstractIntegrationTestBase {
+abstract class TestRedirects extends AbstractIntegrationTestBase {
protected TestRedirects(final URIScheme scheme) {
super(scheme, ClientProtocolLevel.STANDARD);
}
@Test
- public void testBasicRedirect300() throws Exception {
+ void testBasicRedirect300() throws Exception {
configureServer(bootstrap -> bootstrap
.setExchangeHandlerDecorator(requestHandler -> new RedirectingDecorator(
requestHandler,
@@ -110,7 +110,7 @@ public abstract class TestRedirects extends AbstractIntegrationTestBase {
}
@Test
- public void testBasicRedirect300NoKeepAlive() throws Exception {
+ void testBasicRedirect300NoKeepAlive() throws Exception {
configureServer(bootstrap -> bootstrap
.setExchangeHandlerDecorator(requestHandler -> new RedirectingDecorator(
requestHandler,
@@ -140,7 +140,7 @@ public abstract class TestRedirects extends AbstractIntegrationTestBase {
}
@Test
- public void testBasicRedirect301() throws Exception {
+ void testBasicRedirect301() throws Exception {
configureServer(bootstrap -> bootstrap
.setExchangeHandlerDecorator(requestHandler -> new RedirectingDecorator(
requestHandler,
@@ -172,7 +172,7 @@ public abstract class TestRedirects extends AbstractIntegrationTestBase {
}
@Test
- public void testBasicRedirect302() throws Exception {
+ void testBasicRedirect302() throws Exception {
configureServer(bootstrap -> bootstrap
.setExchangeHandlerDecorator(requestHandler -> new RedirectingDecorator(
requestHandler,
@@ -198,7 +198,7 @@ public abstract class TestRedirects extends AbstractIntegrationTestBase {
}
@Test
- public void testBasicRedirect302NoLocation() throws Exception {
+ void testBasicRedirect302NoLocation() throws Exception {
configureServer(bootstrap -> bootstrap
.setExchangeHandlerDecorator(requestHandler -> new RedirectingDecorator(
requestHandler,
@@ -229,7 +229,7 @@ public abstract class TestRedirects extends AbstractIntegrationTestBase {
}
@Test
- public void testBasicRedirect303() throws Exception {
+ void testBasicRedirect303() throws Exception {
configureServer(bootstrap -> bootstrap
.setExchangeHandlerDecorator(requestHandler -> new RedirectingDecorator(
requestHandler,
@@ -254,7 +254,7 @@ public abstract class TestRedirects extends AbstractIntegrationTestBase {
}
@Test
- public void testBasicRedirect304() throws Exception {
+ void testBasicRedirect304() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/oldlocation/*", (request, response, context) -> {
response.setCode(HttpStatus.SC_NOT_MODIFIED);
@@ -284,7 +284,7 @@ public abstract class TestRedirects extends AbstractIntegrationTestBase {
}
@Test
- public void testBasicRedirect305() throws Exception {
+ void testBasicRedirect305() throws Exception {
configureServer(bootstrap -> bootstrap
.register("/oldlocation/*", (request, response, context) -> {
response.setCode(HttpStatus.SC_USE_PROXY);
@@ -314,7 +314,7 @@ public abstract class TestRedirects extends AbstractIntegrationTestBase {
}
@Test
- public void testBasicRedirect307() throws Exception {
+ void testBasicRedirect307() throws Exception {
configureServer(bootstrap -> bootstrap
.setExchangeHandlerDecorator(requestHandler -> new RedirectingDecorator(
requestHandler,
@@ -339,7 +339,7 @@ public abstract class TestRedirects extends AbstractIntegrationTestBase {
}
@Test
- public void testMaxRedirectCheck() throws Exception {
+ void testMaxRedirectCheck() throws Exception {
configureServer(bootstrap -> bootstrap
.setExchangeHandlerDecorator(requestHandler -> new RedirectingDecorator(
requestHandler,
@@ -362,7 +362,7 @@ public abstract class TestRedirects extends AbstractIntegrationTestBase {
}
@Test
- public void testCircularRedirect() throws Exception {
+ void testCircularRedirect() throws Exception {
configureServer(bootstrap -> bootstrap
.setExchangeHandlerDecorator(requestHandler -> new RedirectingDecorator(
requestHandler,
@@ -385,7 +385,7 @@ public abstract class TestRedirects extends AbstractIntegrationTestBase {
}
@Test
- public void testPostRedirectSeeOther() throws Exception {
+ void testPostRedirectSeeOther() throws Exception {
configureServer(bootstrap -> bootstrap
.setExchangeHandlerDecorator(requestHandler -> new RedirectingDecorator(
requestHandler,
@@ -412,7 +412,7 @@ public abstract class TestRedirects extends AbstractIntegrationTestBase {
}
@Test
- public void testRelativeRedirect() throws Exception {
+ void testRelativeRedirect() throws Exception {
configureServer(bootstrap -> bootstrap
.setExchangeHandlerDecorator(requestHandler -> new RedirectingDecorator(
requestHandler,
@@ -444,7 +444,7 @@ public abstract class TestRedirects extends AbstractIntegrationTestBase {
}
@Test
- public void testRelativeRedirect2() throws Exception {
+ void testRelativeRedirect2() throws Exception {
configureServer(bootstrap -> bootstrap
.setExchangeHandlerDecorator(requestHandler -> new RedirectingDecorator(
requestHandler,
@@ -476,7 +476,7 @@ public abstract class TestRedirects extends AbstractIntegrationTestBase {
}
@Test
- public void testRejectBogusRedirectLocation() throws Exception {
+ void testRejectBogusRedirectLocation() throws Exception {
configureServer(bootstrap -> bootstrap
.setExchangeHandlerDecorator(requestHandler -> new RedirectingDecorator(
requestHandler,
@@ -500,7 +500,7 @@ public abstract class TestRedirects extends AbstractIntegrationTestBase {
}
@Test
- public void testRejectInvalidRedirectLocation() throws Exception {
+ void testRejectInvalidRedirectLocation() throws Exception {
configureServer(bootstrap -> bootstrap
.setExchangeHandlerDecorator(requestHandler -> new RedirectingDecorator(
requestHandler,
@@ -524,7 +524,7 @@ public abstract class TestRedirects extends AbstractIntegrationTestBase {
}
@Test
- public void testRedirectWithCookie() throws Exception {
+ void testRedirectWithCookie() throws Exception {
configureServer(bootstrap -> bootstrap
.setExchangeHandlerDecorator(requestHandler -> new RedirectingDecorator(
requestHandler,
@@ -561,7 +561,7 @@ public abstract class TestRedirects extends AbstractIntegrationTestBase {
}
@Test
- public void testDefaultHeadersRedirect() throws Exception {
+ void testDefaultHeadersRedirect() throws Exception {
configureClient(builder -> builder
.setDefaultHeaders(Collections.singletonList(new BasicHeader(HttpHeaders.USER_AGENT, "my-test-client")))
);
@@ -593,7 +593,7 @@ public abstract class TestRedirects extends AbstractIntegrationTestBase {
}
@Test
- public void testCompressionHeaderRedirect() throws Exception {
+ void testCompressionHeaderRedirect() throws Exception {
final Queue<String> values = new ConcurrentLinkedQueue<>();
configureServer(bootstrap -> bootstrap
.setExchangeHandlerDecorator(new Decorator<HttpServerRequestHandler>() {
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestStatefulConnManagement.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestStatefulConnManagement.java
index cc8efd213..b0d631f77 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestStatefulConnManagement.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestStatefulConnManagement.java
@@ -53,7 +53,7 @@ import org.junit.jupiter.api.Test;
/**
* Test cases for state-ful connections.
*/
-public class TestStatefulConnManagement extends AbstractIntegrationTestBase {
+class TestStatefulConnManagement extends AbstractIntegrationTestBase {
public static final Timeout LONG_TIMEOUT = Timeout.ofMinutes(3);
@@ -71,7 +71,7 @@ public class TestStatefulConnManagement extends AbstractIntegrationTestBase {
public void handle(
final ClassicHttpRequest request,
final ClassicHttpResponse response,
- final HttpContext context) throws HttpException, IOException {
+ final HttpContext context) {
response.setCode(HttpStatus.SC_OK);
final StringEntity entity = new StringEntity("Whatever");
response.setEntity(entity);
@@ -79,7 +79,7 @@ public class TestStatefulConnManagement extends AbstractIntegrationTestBase {
}
@Test
- public void testStatefulConnections() throws Exception {
+ void testStatefulConnections() throws Exception {
configureServer(bootstrap -> bootstrap
.register("*", new SimpleService()));
final HttpHost target = startServer();
@@ -193,7 +193,7 @@ public class TestStatefulConnManagement extends AbstractIntegrationTestBase {
}
@Test
- public void testRouteSpecificPoolRecylcing() throws Exception {
+ void testRouteSpecificPoolRecylcing() throws Exception {
configureServer(bootstrap -> bootstrap.register("*", new SimpleService()));
final HttpHost target = startServer();
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/ConnectExceptionSupportTest.java b/httpclient5/src/test/java/org/apache/hc/client5/http/ConnectExceptionSupportTest.java
index 0a2020ec2..0f1904511 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/ConnectExceptionSupportTest.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/ConnectExceptionSupportTest.java
@@ -38,23 +38,23 @@ import org.junit.jupiter.api.Test;
* Unit tests for exceptions.
* Trivial, but it looks better in the Clover reports.
*/
-public class ConnectExceptionSupportTest {
+class ConnectExceptionSupportTest {
@Test
- public void testConnectTimeoutExceptionFromNullMessageAndHost() {
+ void testConnectTimeoutExceptionFromNullMessageAndHost() {
final ConnectTimeoutException ctx = ConnectExceptionSupport.createConnectTimeoutException(null, null);
Assertions.assertEquals("Connect to remote endpoint timed out", ctx.getMessage());
}
@Test
- public void testConnectTimeoutExceptionFromCause() {
+ void testConnectTimeoutExceptionFromCause() {
final IOException cause = new IOException("something awful");
final ConnectTimeoutException ctx = ConnectExceptionSupport.createConnectTimeoutException(cause, null);
Assertions.assertEquals("Connect to remote endpoint failed: something awful", ctx.getMessage());
}
@Test
- public void testConnectTimeoutExceptionFromCauseAndHost() {
+ void testConnectTimeoutExceptionFromCauseAndHost() {
final HttpHost target = new HttpHost("localhost");
final IOException cause = new IOException();
final ConnectTimeoutException ctx = ConnectExceptionSupport.createConnectTimeoutException(cause, target);
@@ -62,7 +62,7 @@ public class ConnectExceptionSupportTest {
}
@Test
- public void testConnectTimeoutExceptionFromCauseHostAndRemoteAddress() throws Exception {
+ void testConnectTimeoutExceptionFromCauseHostAndRemoteAddress() throws Exception {
final HttpHost target = new HttpHost("localhost");
final InetAddress remoteAddress = InetAddress.getByAddress(new byte[] {1,2,3,4});
final IOException cause = new IOException();
@@ -71,21 +71,21 @@ public class ConnectExceptionSupportTest {
}
@Test
- public void testHttpHostConnectExceptionFromNullCause() {
+ void testHttpHostConnectExceptionFromNullCause() {
final HttpHostConnectException ctx = ConnectExceptionSupport.createHttpHostConnectException(null, null,
(InetAddress [])null);
Assertions.assertEquals("Connect to remote endpoint refused", ctx.getMessage());
}
@Test
- public void testHttpHostConnectExceptionFromCause() {
+ void testHttpHostConnectExceptionFromCause() {
final IOException cause = new IOException("something awful");
final HttpHostConnectException ctx = ConnectExceptionSupport.createHttpHostConnectException(cause, null);
Assertions.assertEquals("Connect to remote endpoint failed: something awful", ctx.getMessage());
}
@Test
- public void testHttpHostConnectExceptionFromCauseAndHost() {
+ void testHttpHostConnectExceptionFromCauseAndHost() {
final HttpHost target = new HttpHost("localhost");
final IOException cause = new IOException();
final HttpHostConnectException ctx = ConnectExceptionSupport.createHttpHostConnectException(cause, target);
@@ -93,7 +93,7 @@ public class ConnectExceptionSupportTest {
}
@Test
- public void testHttpHostConnectExceptionFromCauseHostAndRemoteAddress() throws Exception {
+ void testHttpHostConnectExceptionFromCauseHostAndRemoteAddress() throws Exception {
final HttpHost target = new HttpHost("localhost");
final InetAddress remoteAddress1 = InetAddress.getByAddress(new byte[] {1,2,3,4});
final InetAddress remoteAddress2 = InetAddress.getByAddress(new byte[] {5,6,7,8});
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/SystemDefaultDnsResolverTest.java b/httpclient5/src/test/java/org/apache/hc/client5/http/SystemDefaultDnsResolverTest.java
index 58304dca8..d99817e05 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/SystemDefaultDnsResolverTest.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/SystemDefaultDnsResolverTest.java
@@ -34,7 +34,7 @@ import java.net.UnknownHostException;
import org.junit.jupiter.api.Test;
-public class SystemDefaultDnsResolverTest {
+class SystemDefaultDnsResolverTest {
@Test
void resolve() throws UnknownHostException {
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/TestHttpRoute.java b/httpclient5/src/test/java/org/apache/hc/client5/http/TestHttpRoute.java
index 87f06f24d..c1ba0b5eb 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/TestHttpRoute.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/TestHttpRoute.java
@@ -41,7 +41,7 @@ import org.junit.jupiter.api.Test;
/**
* Tests for {@link HttpRoute}.
*/
-public class TestHttpRoute {
+class TestHttpRoute {
// a selection of constants for generating routes
public final static
@@ -83,7 +83,7 @@ public class TestHttpRoute {
}
@Test
- public void testCstrFullRoute() {
+ void testCstrFullRoute() {
// create a route with all arguments and check the details
final HttpHost[] chain3 = { PROXY1, PROXY2, PROXY3 };
@@ -110,7 +110,7 @@ public class TestHttpRoute {
}
@Test
- public void testCstrFullFlags() {
+ void testCstrFullFlags() {
// tests the flag parameters in the full-blown constructor
final HttpHost[] chain3 = { PROXY1, PROXY2, PROXY3 };
@@ -174,7 +174,7 @@ public class TestHttpRoute {
}
@Test
- public void testInvalidArguments() {
+ void testInvalidArguments() {
final HttpHost[] chain1 = { PROXY1 };
// for reference: this one should succeed
@@ -189,7 +189,7 @@ public class TestHttpRoute {
}
@Test
- public void testNullEnums() {
+ void testNullEnums() {
// tests the default values for the enum parameters
// also covers the accessors for the enum attributes
@@ -205,7 +205,7 @@ public class TestHttpRoute {
}
@Test
- public void testEqualsHashcodeClone() throws CloneNotSupportedException {
+ void testEqualsHashcodeClone() throws CloneNotSupportedException {
final HttpHost[] chain0 = { };
final HttpHost[] chain1 = { PROXY1 };
final HttpHost[] chain3 = { PROXY1, PROXY2, PROXY3 };
@@ -337,7 +337,7 @@ public class TestHttpRoute {
}
@Test
- public void testHopping() {
+ void testHopping() {
// test getHopCount() and getHopTarget() with different proxy chains
final HttpHost[] proxies = null;
final HttpRoute route = new HttpRoute(TARGET1, null, proxies, true,
@@ -369,7 +369,7 @@ public class TestHttpRoute {
}
@Test
- public void testCstr1() {
+ void testCstr1() {
final HttpRoute route = new HttpRoute(TARGET2);
final HttpRoute should = new HttpRoute
(TARGET2, null, (HttpHost[]) null, false,
@@ -378,7 +378,7 @@ public class TestHttpRoute {
}
@Test
- public void testCstr3() {
+ void testCstr3() {
// test convenience constructor with 3 arguments
HttpRoute route = new HttpRoute(TARGET2, LOCAL61, false);
HttpRoute should = new HttpRoute
@@ -394,7 +394,7 @@ public class TestHttpRoute {
@SuppressWarnings("unused")
@Test
- public void testCstr4() {
+ void testCstr4() {
// test convenience constructor with 4 arguments
HttpRoute route = new HttpRoute(TARGET2, null, PROXY2, false);
HttpRoute should = new HttpRoute
@@ -414,7 +414,7 @@ public class TestHttpRoute {
}
@Test
- public void testCstr6() {
+ void testCstr6() {
// test convenience constructor with 6 arguments
HttpRoute route = new HttpRoute
(TARGET2, null, PROXY2, true,
@@ -436,7 +436,7 @@ public class TestHttpRoute {
}
@Test
- public void testImmutable() throws CloneNotSupportedException {
+ void testImmutable() throws CloneNotSupportedException {
final HttpHost[] proxies = new HttpHost[]{ PROXY1, PROXY2, PROXY3 };
final HttpRoute route1 = new HttpRoute(TARGET1, null, proxies, false,
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/async/methods/TestSimpleMessageBuilders.java b/httpclient5/src/test/java/org/apache/hc/client5/http/async/methods/TestSimpleMessageBuilders.java
index 786d7dfd4..56dbb5c8c 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/async/methods/TestSimpleMessageBuilders.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/async/methods/TestSimpleMessageBuilders.java
@@ -50,10 +50,10 @@ import org.junit.jupiter.api.Test;
/**
* Simple tests for {@link SimpleResponseBuilder} and {@link SimpleRequestBuilder}.
*/
-public class TestSimpleMessageBuilders {
+class TestSimpleMessageBuilders {
@Test
- public void testResponseBasics() throws Exception {
+ void testResponseBasics() {
final SimpleResponseBuilder builder = SimpleResponseBuilder.create(200);
Assertions.assertEquals(200, builder.getStatus());
Assertions.assertNull(builder.getHeaders());
@@ -111,7 +111,7 @@ public class TestSimpleMessageBuilders {
}
@Test
- public void testRequestBasics() throws Exception {
+ void testRequestBasics() throws Exception {
final SimpleRequestBuilder builder = SimpleRequestBuilder.get();
Assertions.assertEquals(URI.create("/"), builder.getUri());
Assertions.assertEquals("GET", builder.getMethod());
@@ -205,7 +205,7 @@ public class TestSimpleMessageBuilders {
}
@Test
- public void testResponseCopy() throws Exception {
+ void testResponseCopy() {
final SimpleHttpResponse response = SimpleHttpResponse.create(400);
response.addHeader("h1", "v1");
response.addHeader("h1", "v2");
@@ -220,7 +220,7 @@ public class TestSimpleMessageBuilders {
}
@Test
- public void testRequestCopy() throws Exception {
+ void testRequestCopy() {
final SimpleHttpRequest request = SimpleHttpRequest.create(Method.GET, URI.create("https://host:3456/stuff?blah")) ;
request.addHeader("h1", "v1");
request.addHeader("h1", "v2");
@@ -238,7 +238,7 @@ public class TestSimpleMessageBuilders {
}
@Test
- public void testGetParameters() throws Exception {
+ void testGetParameters() {
final SimpleRequestBuilder builder = SimpleRequestBuilder.get(URI.create("https://host:3456/stuff?p0=p0"));
builder.addParameter("p1", "v1");
builder.addParameters(new BasicNameValuePair("p2", "v2"), new BasicNameValuePair("p3", "v3"));
@@ -256,7 +256,7 @@ public class TestSimpleMessageBuilders {
}
@Test
- public void testPostParameters() throws Exception {
+ void testPostParameters() {
final SimpleRequestBuilder builder = SimpleRequestBuilder.post(URI.create("https://host:3456/stuff?p0=p0"));
builder.addParameter("p1", "v1");
builder.addParameters(new BasicNameValuePair("p2", "v2"), new BasicNameValuePair("p3", "v3"));
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestAuthChallenge.java b/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestAuthChallenge.java
index e987792a9..b7bb0ea77 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestAuthChallenge.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestAuthChallenge.java
@@ -33,10 +33,10 @@ import org.apache.hc.core5.http.message.BasicNameValuePair;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class TestAuthChallenge {
+class TestAuthChallenge {
@Test
- public void testAuthChallengeWithValue() {
+ void testAuthChallengeWithValue() {
final AuthChallenge authChallenge = new AuthChallenge(ChallengeType.TARGET, StandardAuthScheme.BASIC, "blah", null);
Assertions.assertEquals(StandardAuthScheme.BASIC, authChallenge.getSchemeName());
Assertions.assertEquals("blah", authChallenge.getValue());
@@ -45,7 +45,7 @@ public class TestAuthChallenge {
}
@Test
- public void testAuthChallengeWithParams() {
+ void testAuthChallengeWithParams() {
final AuthChallenge authChallenge = new AuthChallenge(ChallengeType.TARGET, StandardAuthScheme.BASIC, null,
Arrays.asList(new BasicNameValuePair("blah", "this"), new BasicNameValuePair("blah", "that")));
Assertions.assertEquals(StandardAuthScheme.BASIC, authChallenge.getSchemeName());
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestAuthScope.java b/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestAuthScope.java
index b7b72b7b4..531d0119b 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestAuthScope.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestAuthScope.java
@@ -33,10 +33,10 @@ import org.junit.jupiter.api.Test;
/**
* Tests for {@link org.apache.hc.client5.http.auth.AuthScope}.
*/
-public class TestAuthScope {
+class TestAuthScope {
@Test
- public void testBasics() {
+ void testBasics() {
final AuthScope authscope = new AuthScope("http", "somehost", 80, "somerealm", "SomeScheme");
Assertions.assertEquals("SOMESCHEME", authscope.getSchemeName());
Assertions.assertEquals("http", authscope.getProtocol());
@@ -47,7 +47,7 @@ public class TestAuthScope {
}
@Test
- public void testByOrigin() {
+ void testByOrigin() {
final HttpHost host = new HttpHost("http", "somehost", 8080);
final AuthScope authscope = new AuthScope(host);
Assertions.assertNull(authscope.getSchemeName());
@@ -59,7 +59,7 @@ public class TestAuthScope {
}
@Test
- public void testMixedCaseHostname() {
+ void testMixedCaseHostname() {
final AuthScope authscope = new AuthScope("SomeHost", 80);
Assertions.assertNull(authscope.getSchemeName());
Assertions.assertEquals("somehost", authscope.getHost());
@@ -69,14 +69,14 @@ public class TestAuthScope {
}
@Test
- public void testByOriginMixedCaseHostname() throws Exception {
+ void testByOriginMixedCaseHostname() {
final HttpHost host = new HttpHost("http", "SomeHost", 8080);
final AuthScope authscope = new AuthScope(host);
Assertions.assertEquals("somehost", authscope.getHost());
}
@Test
- public void testBasicsAllOptional() {
+ void testBasicsAllOptional() {
final AuthScope authscope = new AuthScope(null, null, -1, null, null);
Assertions.assertNull(authscope.getSchemeName());
Assertions.assertNull(authscope.getHost());
@@ -86,7 +86,7 @@ public class TestAuthScope {
}
@Test
- public void testScopeMatching() {
+ void testScopeMatching() {
final AuthScope authscope1 = new AuthScope("http", "somehost", 80, "somerealm", "somescheme");
final AuthScope authscope2 = new AuthScope("http", "someotherhost", 80, "somerealm", "somescheme");
Assertions.assertTrue(authscope1.match(authscope2) < 0);
@@ -117,7 +117,7 @@ public class TestAuthScope {
}
@Test
- public void testEquals() {
+ void testEquals() {
final AuthScope authscope1 = new AuthScope("http", "somehost", 80, "somerealm", "somescheme");
final AuthScope authscope2 = new AuthScope("http", "someotherhost", 80, "somerealm", "somescheme");
final AuthScope authscope3 = new AuthScope("http", "somehost", 80, "somerealm", "somescheme");
@@ -137,7 +137,7 @@ public class TestAuthScope {
}
@Test
- public void testHash() {
+ void testHash() {
final AuthScope authscope1 = new AuthScope("http", "somehost", 80, "somerealm", "somescheme");
final AuthScope authscope2 = new AuthScope("http", "someotherhost", 80, "somerealm", "somescheme");
final AuthScope authscope3 = new AuthScope("http", "somehost", 80, "somerealm", "somescheme");
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestCredentials.java b/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestCredentials.java
index ee7df8940..51896c097 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestCredentials.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/auth/TestCredentials.java
@@ -36,10 +36,10 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@SuppressWarnings("deprecation")
-public class TestCredentials {
+class TestCredentials {
@Test
- public void testUsernamePasswordCredentialsBasics() {
+ void testUsernamePasswordCredentialsBasics() {
final UsernamePasswordCredentials creds1 = new UsernamePasswordCredentials(
"name","pwd".toCharArray());
Assertions.assertEquals("name", creds1.getUserName());
@@ -57,7 +57,7 @@ public class TestCredentials {
}
@Test
- public void testNTCredentialsBasics() {
+ void testNTCredentialsBasics() {
final NTCredentials creds1 = new NTCredentials(
"name","pwd".toCharArray(), "localhost", "domain");
Assertions.assertEquals("name", creds1.getUserName());
@@ -77,7 +77,7 @@ public class TestCredentials {
}
@Test
- public void testUsernamePasswordCredentialsHashCode() {
+ void testUsernamePasswordCredentialsHashCode() {
final UsernamePasswordCredentials creds1 = new UsernamePasswordCredentials(
"name","pwd".toCharArray());
final UsernamePasswordCredentials creds2 = new UsernamePasswordCredentials(
@@ -91,7 +91,7 @@ public class TestCredentials {
}
@Test
- public void testUsernamePasswordCredentialsEquals() {
+ void testUsernamePasswordCredentialsEquals() {
final UsernamePasswordCredentials creds1 = new UsernamePasswordCredentials(
"name","pwd".toCharArray());
final UsernamePasswordCredentials creds2 = new UsernamePasswordCredentials(
@@ -105,13 +105,13 @@ public class TestCredentials {
}
@Test
- public void tesBearerTokenBasics() {
+ void tesBearerTokenBasics() {
final BearerToken creds1 = new BearerToken("token of some sort");
Assertions.assertEquals("token of some sort", creds1.getToken());
}
@Test
- public void testBearerTokenHashCode() {
+ void testBearerTokenHashCode() {
final BearerToken creds1 = new BearerToken("token of some sort");
final BearerToken creds2 = new BearerToken("another token of some sort");
final BearerToken creds3 = new BearerToken("token of some sort");
@@ -122,7 +122,7 @@ public class TestCredentials {
}
@Test
- public void testBearerTokenEquals() {
+ void testBearerTokenEquals() {
final BearerToken creds1 = new BearerToken("token of some sort");
final BearerToken creds2 = new BearerToken("another token of some sort");
final BearerToken creds3 = new BearerToken("token of some sort");
@@ -133,7 +133,7 @@ public class TestCredentials {
}
@Test
- public void testNTCredentialsHashCode() {
+ void testNTCredentialsHashCode() {
final NTCredentials creds1 = new NTCredentials(
"name","pwd".toCharArray(), "somehost", "domain");
final NTCredentials creds2 = new NTCredentials(
@@ -165,7 +165,7 @@ public class TestCredentials {
}
@Test
- public void testNTCredentialsEquals() {
+ void testNTCredentialsEquals() {
final NTCredentials creds1 = new NTCredentials(
"name","pwd".toCharArray(), "somehost", "domain");
final NTCredentials creds2 = new NTCredentials(
@@ -198,7 +198,7 @@ public class TestCredentials {
}
@Test
- public void testUsernamePasswordCredentialsSerialization() throws Exception {
+ void testUsernamePasswordCredentialsSerialization() throws Exception {
final UsernamePasswordCredentials orig = new UsernamePasswordCredentials("name","pwd".toCharArray());
final ByteArrayOutputStream outbuffer = new ByteArrayOutputStream();
final ObjectOutputStream outStream = new ObjectOutputStream(outbuffer);
@@ -212,7 +212,7 @@ public class TestCredentials {
}
@Test
- public void testNTCredentialsSerialization() throws Exception {
+ void testNTCredentialsSerialization() throws Exception {
final NTCredentials orig = new NTCredentials("name","pwd".toCharArray(), "somehost", "domain");
final ByteArrayOutputStream outbuffer = new ByteArrayOutputStream();
final ObjectOutputStream outStream = new ObjectOutputStream(outbuffer);
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/classic/methods/TestHttpOptions.java b/httpclient5/src/test/java/org/apache/hc/client5/http/classic/methods/TestHttpOptions.java
index c660ddfc9..210852570 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/classic/methods/TestHttpOptions.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/classic/methods/TestHttpOptions.java
@@ -33,10 +33,10 @@ import org.apache.hc.core5.http.message.BasicHttpResponse;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class TestHttpOptions {
+class TestHttpOptions {
@Test
- public void testMultipleAllows() {
+ void testMultipleAllows() {
final BasicHttpResponse resp = new BasicHttpResponse(200, "test reason");
resp.addHeader("Allow", "POST");
resp.addHeader("Allow", "GET");
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/classic/methods/TestHttpRequestBase.java b/httpclient5/src/test/java/org/apache/hc/client5/http/classic/methods/TestHttpRequestBase.java
index d6ba7b8cf..7103294ae 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/classic/methods/TestHttpRequestBase.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/classic/methods/TestHttpRequestBase.java
@@ -47,54 +47,54 @@ import org.apache.hc.core5.http.message.BasicHttpResponse;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class TestHttpRequestBase {
+class TestHttpRequestBase {
private static final String HOT_URL = "http://host/path";
@Test
- public void testBasicGetMethodProperties() throws Exception {
+ void testBasicGetMethodProperties() throws Exception {
final HttpGet httpget = new HttpGet(HOT_URL);
Assertions.assertEquals("GET", httpget.getMethod());
Assertions.assertEquals(new URI(HOT_URL), httpget.getUri());
}
@Test
- public void testBasicHttpPostMethodProperties() throws Exception {
+ void testBasicHttpPostMethodProperties() throws Exception {
final HttpPost HttpPost = new HttpPost(HOT_URL);
Assertions.assertEquals("POST", HttpPost.getMethod());
Assertions.assertEquals(new URI(HOT_URL), HttpPost.getUri());
}
@Test
- public void testBasicHttpHeadMethodProperties() throws Exception {
+ void testBasicHttpHeadMethodProperties() throws Exception {
final HttpHead httpHead = new HttpHead(HOT_URL);
Assertions.assertEquals("HEAD", httpHead.getMethod());
Assertions.assertEquals(new URI(HOT_URL), httpHead.getUri());
}
@Test
- public void testBasicHttpOptionMethodProperties() throws Exception {
+ void testBasicHttpOptionMethodProperties() throws Exception {
final HttpOptions httpOption = new HttpOptions(HOT_URL);
Assertions.assertEquals("OPTIONS", httpOption.getMethod());
Assertions.assertEquals(new URI(HOT_URL), httpOption.getUri());
}
@Test
- public void testBasicHttpPatchMethodProperties() throws Exception {
+ void testBasicHttpPatchMethodProperties() throws Exception {
final HttpPatch httpPatch = new HttpPatch(HOT_URL);
Assertions.assertEquals("PATCH", httpPatch.getMethod());
Assertions.assertEquals(new URI(HOT_URL), httpPatch.getUri());
}
@Test
- public void testBasicHttpPutMethodProperties() throws Exception {
+ void testBasicHttpPutMethodProperties() throws Exception {
final HttpPut httpPut = new HttpPut(HOT_URL);
Assertions.assertEquals("PUT", httpPut.getMethod());
Assertions.assertEquals(new URI(HOT_URL), httpPut.getUri());
}
@Test
- public void testBasicHttpTraceMethodProperties() throws Exception {
+ void testBasicHttpTraceMethodProperties() throws Exception {
final HttpTrace httpTrace = new HttpTrace(HOT_URL);
Assertions.assertEquals("TRACE", httpTrace.getMethod());
Assertions.assertEquals(new URI(HOT_URL), httpTrace.getUri());
@@ -102,7 +102,7 @@ public class TestHttpRequestBase {
@Test
- public void testBasicHttpDeleteMethodProperties() throws Exception {
+ void testBasicHttpDeleteMethodProperties() throws Exception {
final HttpDelete httpDelete = new HttpDelete(HOT_URL);
Assertions.assertEquals("DELETE", httpDelete.getMethod());
Assertions.assertEquals(new URI(HOT_URL), httpDelete.getUri());
@@ -110,64 +110,64 @@ public class TestHttpRequestBase {
@Test
- public void testGetMethodEmptyURI() throws Exception {
+ void testGetMethodEmptyURI() throws Exception {
final HttpGet httpget = new HttpGet("");
Assertions.assertEquals(new URI("/"), httpget.getUri());
}
@Test
- public void testPostMethodEmptyURI() throws Exception {
+ void testPostMethodEmptyURI() throws Exception {
final HttpPost HttpPost = new HttpPost("");
Assertions.assertEquals(new URI("/"), HttpPost.getUri());
}
@Test
- public void testHeadMethodEmptyURI() throws Exception {
+ void testHeadMethodEmptyURI() throws Exception {
final HttpHead httpHead = new HttpHead("");
Assertions.assertEquals(new URI("/"), httpHead.getUri());
}
@Test
- public void testOptionMethodEmptyURI() throws Exception {
+ void testOptionMethodEmptyURI() throws Exception {
final HttpOptions httpOption = new HttpOptions("");
Assertions.assertEquals(new URI("/"), httpOption.getUri());
}
@Test
- public void testPatchMethodEmptyURI() throws Exception {
+ void testPatchMethodEmptyURI() throws Exception {
final HttpPatch httpPatch = new HttpPatch("");
Assertions.assertEquals(new URI("/"), httpPatch.getUri());
}
@Test
- public void testPutMethodEmptyURI() throws Exception {
+ void testPutMethodEmptyURI() throws Exception {
final HttpPut httpPut = new HttpPut("");
Assertions.assertEquals(new URI("/"), httpPut.getUri());
}
@Test
- public void testTraceMethodEmptyURI() throws Exception {
+ void testTraceMethodEmptyURI() throws Exception {
final HttpTrace httpTrace = new HttpTrace("");
Assertions.assertEquals(new URI("/"), httpTrace.getUri());
}
@Test
- public void testDeleteMethodEmptyURI() throws Exception {
+ void testDeleteMethodEmptyURI() throws Exception {
final HttpDelete httpDelete = new HttpDelete("");
Assertions.assertEquals(new URI("/"), httpDelete.getUri());
}
@Test
- public void testTraceMethodSetEntity() {
+ void testTraceMethodSetEntity() {
final HttpTrace httpTrace = new HttpTrace(HOT_URL);
final HttpEntity entity = EntityBuilder.create().setText("stuff").build();
assertThrows(IllegalStateException.class, () -> httpTrace.setEntity(entity));
}
@Test
- public void testOptionMethodGetAllowedMethods() {
+ void testOptionMethodGetAllowedMethods() {
final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_OK, "OK");
response.addHeader("Allow", "GET, HEAD");
response.addHeader("Allow", "DELETE");
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/classic/methods/TestHttpTrace.java b/httpclient5/src/test/java/org/apache/hc/client5/http/classic/methods/TestHttpTrace.java
index 2c0a92bc0..ccd5342a7 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/classic/methods/TestHttpTrace.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/classic/methods/TestHttpTrace.java
@@ -30,10 +30,10 @@ package org.apache.hc.client5.http.classic.methods;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class TestHttpTrace {
+class TestHttpTrace {
@Test
- public void testHttpTraceSetEntity() {
+ void testHttpTraceSetEntity() {
final HttpTrace httpTrace = new HttpTrace("/path");
Assertions.assertThrows(IllegalStateException.class, () ->
httpTrace.setEntity(null));
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/config/TestRequestConfig.java b/httpclient5/src/test/java/org/apache/hc/client5/http/config/TestRequestConfig.java
index 8eeea8c31..ac48c99d4 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/config/TestRequestConfig.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/config/TestRequestConfig.java
@@ -37,16 +37,16 @@ import org.apache.hc.core5.util.Timeout;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class TestRequestConfig {
+class TestRequestConfig {
@Test
- public void testBasics() {
+ void testBasics() {
final RequestConfig config = RequestConfig.custom().build();
config.toString();
}
@Test
- public void testDefaults() {
+ void testDefaults() {
final RequestConfig config = RequestConfig.DEFAULT;
Assertions.assertEquals(Timeout.ofMinutes(3), config.getConnectionRequestTimeout());
Assertions.assertFalse(config.isExpectContinueEnabled());
@@ -61,7 +61,7 @@ public class TestRequestConfig {
}
@Test
- public void testBuildAndCopy() throws Exception {
+ void testBuildAndCopy() {
final RequestConfig config0 = RequestConfig.custom()
.setConnectionRequestTimeout(44, TimeUnit.MILLISECONDS)
.setExpectContinueEnabled(true)
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/cookie/TestCookieOrigin.java b/httpclient5/src/test/java/org/apache/hc/client5/http/cookie/TestCookieOrigin.java
index a94dc951d..542aec858 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/cookie/TestCookieOrigin.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/cookie/TestCookieOrigin.java
@@ -33,10 +33,10 @@ import org.junit.jupiter.api.Test;
/**
* Test cases for {@link CookieOrigin}.
*/
-public class TestCookieOrigin {
+class TestCookieOrigin {
@Test
- public void testConstructor() {
+ void testConstructor() {
final CookieOrigin origin = new CookieOrigin("www.apache.org", 80, "/", false);
Assertions.assertEquals("www.apache.org", origin.getHost());
Assertions.assertEquals(80, origin.getPort());
@@ -45,31 +45,31 @@ public class TestCookieOrigin {
}
@Test
- public void testNullHost() {
+ void testNullHost() {
Assertions.assertThrows(NullPointerException.class, () ->
new CookieOrigin(null, 80, "/", false));
}
@Test
- public void testEmptyHost() {
+ void testEmptyHost() {
Assertions.assertThrows(IllegalArgumentException.class, () ->
new CookieOrigin(" ", 80, "/", false));
}
@Test
- public void testNegativePort() {
+ void testNegativePort() {
Assertions.assertThrows(IllegalArgumentException.class, () ->
new CookieOrigin("www.apache.org", -80, "/", false));
}
@Test
- public void testNullPath() {
+ void testNullPath() {
Assertions.assertThrows(NullPointerException.class, () ->
new CookieOrigin("www.apache.org", 80, null, false));
}
@Test
- public void testEmptyPath() {
+ void testEmptyPath() {
final CookieOrigin origin = new CookieOrigin("www.apache.org", 80, "", false);
Assertions.assertEquals("www.apache.org", origin.getHost());
Assertions.assertEquals(80, origin.getPort());
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/cookie/TestCookiePathComparator.java b/httpclient5/src/test/java/org/apache/hc/client5/http/cookie/TestCookiePathComparator.java
index adcfa22d0..48499d0b4 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/cookie/TestCookiePathComparator.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/cookie/TestCookiePathComparator.java
@@ -36,10 +36,10 @@ import org.junit.jupiter.api.Test;
/**
* Test cases for {@link CookiePathComparator}.
*/
-public class TestCookiePathComparator {
+class TestCookiePathComparator {
@Test
- public void testUnequality1() {
+ void testUnequality1() {
final BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
cookie1.setPath("/a/b/");
final BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
@@ -50,7 +50,7 @@ public class TestCookiePathComparator {
}
@Test
- public void testUnequality2() {
+ void testUnequality2() {
final BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
cookie1.setPath("/a/b");
final BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
@@ -61,7 +61,7 @@ public class TestCookiePathComparator {
}
@Test
- public void testEquality1() {
+ void testEquality1() {
final BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
cookie1.setPath("/a");
final BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
@@ -72,7 +72,7 @@ public class TestCookiePathComparator {
}
@Test
- public void testEquality2() {
+ void testEquality2() {
final BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
cookie1.setPath("/a/");
final BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
@@ -83,7 +83,7 @@ public class TestCookiePathComparator {
}
@Test
- public void testEquality3() {
+ void testEquality3() {
final BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
cookie1.setPath(null);
final BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
@@ -94,7 +94,7 @@ public class TestCookiePathComparator {
}
@Test
- public void testEquality4() {
+ void testEquality4() {
final BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
cookie1.setPath("/this");
final BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/cookie/TestCookiePriorityComparator.java b/httpclient5/src/test/java/org/apache/hc/client5/http/cookie/TestCookiePriorityComparator.java
index f980f0443..086eb9c82 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/cookie/TestCookiePriorityComparator.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/cookie/TestCookiePriorityComparator.java
@@ -38,17 +38,17 @@ import org.junit.jupiter.api.Test;
/**
* Test cases for {@link org.apache.hc.client5.http.cookie.CookiePriorityComparator}.
*/
-public class TestCookiePriorityComparator {
+class TestCookiePriorityComparator {
private Comparator<Cookie> comparator;
@BeforeEach
- public void setup() {
+ void setup() {
comparator = CookiePriorityComparator.INSTANCE;
}
@Test
- public void testUnequality() {
+ void testUnequality() {
final BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
cookie1.setPath("/a/b/");
final BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
@@ -58,7 +58,7 @@ public class TestCookiePriorityComparator {
}
@Test
- public void testEquality() {
+ void testEquality() {
final BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
cookie1.setPath("/a");
final BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
@@ -68,7 +68,7 @@ public class TestCookiePriorityComparator {
}
@Test
- public void testUnequalityTrailingSlash() {
+ void testUnequalityTrailingSlash() {
final BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
cookie1.setPath("/a/");
final BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
@@ -78,7 +78,7 @@ public class TestCookiePriorityComparator {
}
@Test
- public void testEqualityNullPath() {
+ void testEqualityNullPath() {
final BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
cookie1.setPath(null);
final BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
@@ -88,7 +88,7 @@ public class TestCookiePriorityComparator {
}
@Test
- public void testEqualitySameLength() {
+ void testEqualitySameLength() {
final BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
cookie1.setPath("/this");
final BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
@@ -98,7 +98,7 @@ public class TestCookiePriorityComparator {
}
@Test
- public void testUnequalityCreationDate() {
+ void testUnequalityCreationDate() {
final BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
cookie1.setPath("/blah");
cookie1.setCreationDate(Instant.now().minusMillis(200000));
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestBrotli.java b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestBrotli.java
index 5b48150fa..735a62399 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestBrotli.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestBrotli.java
@@ -33,7 +33,7 @@ import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class TestBrotli {
+class TestBrotli {
/**
* Brotli decompression test implemented by request with specified response encoding br
@@ -41,7 +41,7 @@ public class TestBrotli {
* @throws Exception
*/
@Test
- public void testDecompressionWithBrotli() throws Exception {
+ void testDecompressionWithBrotli() throws Exception {
final byte[] bytes = new byte[] {33, 44, 0, 4, 116, 101, 115, 116, 32, 98, 114, 111, 116, 108, 105, 10, 3};
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestDecompressingEntity.java b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestDecompressingEntity.java
index cc439405e..ecbb27cc2 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestDecompressingEntity.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestDecompressingEntity.java
@@ -43,10 +43,10 @@ import org.apache.hc.core5.http.io.entity.StringEntity;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class TestDecompressingEntity {
+class TestDecompressingEntity {
@Test
- public void testNonStreaming() throws Exception {
+ void testNonStreaming() throws Exception {
final CRC32 crc32 = new CRC32();
final StringEntity wrapped = new StringEntity("1234567890", StandardCharsets.US_ASCII);
final ChecksumEntity entity = new ChecksumEntity(wrapped, crc32);
@@ -60,7 +60,7 @@ public class TestDecompressingEntity {
}
@Test
- public void testStreaming() throws Exception {
+ void testStreaming() throws Exception {
final CRC32 crc32 = new CRC32();
final ByteArrayInputStream in = new ByteArrayInputStream("1234567890".getBytes(StandardCharsets.US_ASCII));
final InputStreamEntity wrapped = new InputStreamEntity(in, -1, ContentType.DEFAULT_TEXT);
@@ -77,7 +77,7 @@ public class TestDecompressingEntity {
}
@Test
- public void testWriteToStream() throws Exception {
+ void testWriteToStream() throws Exception {
final CRC32 crc32 = new CRC32();
final StringEntity wrapped = new StringEntity("1234567890", StandardCharsets.US_ASCII);
try (final ChecksumEntity entity = new ChecksumEntity(wrapped, crc32)) {
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestDeflate.java b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestDeflate.java
index b0ab922a1..0859a8bd1 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestDeflate.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestDeflate.java
@@ -37,10 +37,10 @@ import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-public class TestDeflate {
+class TestDeflate {
@Test
- public void testCompressDecompress() throws Exception {
+ void testCompressDecompress() throws Exception {
final String s = "some kind of text";
final byte[] input = s.getBytes(StandardCharsets.US_ASCII);
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestEntityBuilder.java b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestEntityBuilder.java
index 4f975dbaa..fec3a0aef 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestEntityBuilder.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestEntityBuilder.java
@@ -37,16 +37,16 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
-public class TestEntityBuilder {
+class TestEntityBuilder {
@Test
- public void testBuildEmptyEntity() throws Exception {
+ void testBuildEmptyEntity() {
Assertions.assertThrows(IllegalStateException.class, () ->
EntityBuilder.create().build());
}
@Test
- public void testBuildTextEntity() throws Exception {
+ void testBuildTextEntity() throws Exception {
final HttpEntity entity = EntityBuilder.create().setText("stuff").build();
Assertions.assertNotNull(entity);
Assertions.assertNotNull(entity.getContent());
@@ -55,7 +55,7 @@ public class TestEntityBuilder {
}
@Test
- public void testBuildBinaryEntity() throws Exception {
+ void testBuildBinaryEntity() throws Exception {
final HttpEntity entity = EntityBuilder.create().setBinary(new byte[] {0, 1, 2}).build();
Assertions.assertNotNull(entity);
Assertions.assertNotNull(entity.getContent());
@@ -64,7 +64,7 @@ public class TestEntityBuilder {
}
@Test
- public void testBuildStreamEntity() throws Exception {
+ void testBuildStreamEntity() throws Exception {
final InputStream in = Mockito.mock(InputStream.class);
final HttpEntity entity = EntityBuilder.create().setStream(in).build();
Assertions.assertNotNull(entity);
@@ -75,7 +75,7 @@ public class TestEntityBuilder {
}
@Test
- public void testBuildSerializableEntity() throws Exception {
+ void testBuildSerializableEntity() throws Exception {
final HttpEntity entity = EntityBuilder.create().setSerializable(Boolean.TRUE).build();
Assertions.assertNotNull(entity);
Assertions.assertNotNull(entity.getContent());
@@ -84,7 +84,7 @@ public class TestEntityBuilder {
}
@Test
- public void testBuildFileEntity() throws Exception {
+ void testBuildFileEntity() {
final File file = new File("stuff");
final HttpEntity entity = EntityBuilder.create().setFile(file).build();
Assertions.assertNotNull(entity);
@@ -93,7 +93,7 @@ public class TestEntityBuilder {
}
@Test
- public void testExplicitContentProperties() throws Exception {
+ void testExplicitContentProperties() throws Exception {
final HttpEntity entity = EntityBuilder.create()
.setContentType(ContentType.APPLICATION_JSON)
.setContentEncoding("identity")
@@ -108,14 +108,14 @@ public class TestEntityBuilder {
}
@Test
- public void testBuildChunked() throws Exception {
+ void testBuildChunked() {
final HttpEntity entity = EntityBuilder.create().setText("stuff").chunked().build();
Assertions.assertNotNull(entity);
Assertions.assertTrue(entity.isChunked());
}
@Test
- public void testBuildGZipped() throws Exception {
+ void testBuildGZipped() {
final HttpEntity entity = EntityBuilder.create().setText("stuff").gzipCompressed().build();
Assertions.assertNotNull(entity);
Assertions.assertNotNull(entity.getContentType());
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestGZip.java b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestGZip.java
index 786c8a0e0..7ca13caf4 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestGZip.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/entity/TestGZip.java
@@ -44,10 +44,10 @@ import org.junit.jupiter.api.Test;
import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
-public class TestGZip {
+class TestGZip {
@Test
- public void testBasic() throws Exception {
+ void testBasic() throws Exception {
final String s = "some kind of text";
final StringEntity e = new StringEntity(s, ContentType.TEXT_PLAIN, false);
try (final GzipCompressingEntity gzipe = new GzipCompressingEntity(e)) {
@@ -59,7 +59,7 @@ public class TestGZip {
}
@Test
- public void testCompressionDecompression() throws Exception {
+ void testCompressionDecompression() throws Exception {
final StringEntity in = new StringEntity("some kind of text", ContentType.TEXT_PLAIN);
try (final GzipCompressingEntity gzipe = new GzipCompressingEntity(in)) {
final ByteArrayOutputStream buf = new ByteArrayOutputStream();
@@ -71,7 +71,7 @@ public class TestGZip {
}
@Test
- public void testCompressionIOExceptionLeavesOutputStreamOpen() throws Exception {
+ void testCompressionIOExceptionLeavesOutputStreamOpen() throws Exception {
final HttpEntity in = Mockito.mock(HttpEntity.class);
Mockito.doThrow(new IOException("Ooopsie")).when(in).writeTo(ArgumentMatchers.any());
try (final GzipCompressingEntity gzipe = new GzipCompressingEntity(in)) {
@@ -85,7 +85,7 @@ public class TestGZip {
}
@Test
- public void testDecompressionWithMultipleGZipStream() throws Exception {
+ void testDecompressionWithMultipleGZipStream() throws Exception {
final int[] data = new int[] {
0x1f, 0x8b, 0x08, 0x08, 0x03, 0xf1, 0x55, 0x5a, 0x00, 0x03, 0x74, 0x65, 0x73, 0x74, 0x31, 0x00,
... 6649 lines suppressed ...