From 991c1be748a89cef9e6374c5e6fa1820f2ea32a6 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Thu, 21 Nov 2024 01:50:38 +0300 Subject: [PATCH 001/112] update dependency qulice-maven-plugin to v0.23.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9b2b2113..2ec089bc 100644 --- a/pom.xml +++ b/pom.xml @@ -431,7 +431,7 @@ OF THE POSSIBILITY OF SUCH DAMAGE. com.qulice qulice-maven-plugin - 0.22.0 + 0.23.0 duplicatefinder:.* From 64254be726d289cde9b31fc028e87a24d40d3910 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Thu, 21 Nov 2024 01:54:09 +0300 Subject: [PATCH 002/112] fix typo in owasp.yml --- .github/workflows/owasp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/owasp.yml b/.github/workflows/owasp.yml index fd68bfd7..e36695e3 100644 --- a/.github/workflows/owasp.yml +++ b/.github/workflows/owasp.yml @@ -16,6 +16,6 @@ jobs: uses: actions/setup-java@v4 with: java-version: 1.8 - distibution: 'temurin' + distribution: 'temurin' - name: Maven run: mvn --errors --batch-mode -Powasp dependency-check:check From f76bc81f32403d0de13dfcae7497a5a6b8d9370a Mon Sep 17 00:00:00 2001 From: uchitsa Date: Thu, 21 Nov 2024 01:57:28 +0300 Subject: [PATCH 003/112] fix java version in owasp.yml --- .github/workflows/owasp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/owasp.yml b/.github/workflows/owasp.yml index e36695e3..2a8dcecd 100644 --- a/.github/workflows/owasp.yml +++ b/.github/workflows/owasp.yml @@ -15,7 +15,7 @@ jobs: - name: JDK 1.8 uses: actions/setup-java@v4 with: - java-version: 1.8 + java-version: 8 distribution: 'temurin' - name: Maven run: mvn --errors --batch-mode -Powasp dependency-check:check From f50ac2a71c4b0480b3c8567d865ace5b1d95816c Mon Sep 17 00:00:00 2001 From: uchitsa Date: Thu, 21 Nov 2024 01:58:19 +0300 Subject: [PATCH 004/112] fix java version in owasp.yml --- .github/workflows/owasp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/owasp.yml b/.github/workflows/owasp.yml index 2a8dcecd..cc8743aa 100644 --- a/.github/workflows/owasp.yml +++ b/.github/workflows/owasp.yml @@ -15,7 +15,7 @@ jobs: - name: JDK 1.8 uses: actions/setup-java@v4 with: - java-version: 8 + java-version: '8' distribution: 'temurin' - name: Maven run: mvn --errors --batch-mode -Powasp dependency-check:check From ac618ecbce48daa84e5eba8956580b5fc58e0042 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Thu, 21 Nov 2024 01:59:50 +0300 Subject: [PATCH 005/112] fix owasp.yml --- .github/workflows/owasp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/owasp.yml b/.github/workflows/owasp.yml index cc8743aa..4f757209 100644 --- a/.github/workflows/owasp.yml +++ b/.github/workflows/owasp.yml @@ -16,6 +16,6 @@ jobs: uses: actions/setup-java@v4 with: java-version: '8' - distribution: 'temurin' + distribution: 'temurin' - name: Maven run: mvn --errors --batch-mode -Powasp dependency-check:check From e772dd72a35520120adf2ba411c0291af8468dcc Mon Sep 17 00:00:00 2001 From: uchitsa Date: Sun, 24 Nov 2024 14:17:47 +0300 Subject: [PATCH 006/112] up java version to 11 in owasp.yml --- .github/workflows/owasp.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/owasp.yml b/.github/workflows/owasp.yml index 4f757209..757e5ffd 100644 --- a/.github/workflows/owasp.yml +++ b/.github/workflows/owasp.yml @@ -12,10 +12,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: JDK 1.8 + - name: JDK 11 uses: actions/setup-java@v4 with: - java-version: '8' + java-version: 11 distribution: 'temurin' - name: Maven run: mvn --errors --batch-mode -Powasp dependency-check:check From fe0fde35a2cf4da539b96c8cc69c3dd2dad5d805 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Thu, 28 Nov 2024 02:14:56 +0300 Subject: [PATCH 007/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTimeoutLossTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java b/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java index 02a56d28..19ac4348 100644 --- a/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java +++ b/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java @@ -76,8 +76,8 @@ final class RequestTimeoutLossTest extends RequestTestTemplate { * The connect and read timeouts are properly set no matter in which order * Request.timeout is called. * - * @throws Exception If something goes wrong inside * @param type Type of Request + * @throws Exception If something goes wrong inside */ @ParameterizedTest @Values From 049af954f44bf395905779a476a0c9dfd916304e Mon Sep 17 00:00:00 2001 From: uchitsa Date: Thu, 28 Nov 2024 02:15:05 +0300 Subject: [PATCH 008/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTimeoutLossTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java b/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java index 19ac4348..c5d6496f 100644 --- a/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java +++ b/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java @@ -107,8 +107,8 @@ public Response call() throws Exception { * The connect and read timeouts are properly set no matter in which order * Request.timeout is called. * - * @throws Exception If something goes wrong inside * @param type Type of Request + * @throws Exception If something goes wrong inside */ @ParameterizedTest @Values From 3c078f50fe402cdbfc2c0c6e1508d15cf3c4eb52 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Thu, 28 Nov 2024 02:15:14 +0300 Subject: [PATCH 009/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTimeoutLossTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java b/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java index c5d6496f..8391923d 100644 --- a/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java +++ b/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java @@ -136,8 +136,8 @@ public Response call() throws Exception { * The connect and read timeouts are properly set no matter in which order * Request.timeout is called. * - * @throws Exception If something goes wrong inside * @param type Type of Request + * @throws Exception If something goes wrong inside */ @ParameterizedTest @Values From ff7dd458570472d97656394871f42c217cf7b485 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Thu, 28 Nov 2024 02:16:08 +0300 Subject: [PATCH 010/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTimeoutLossTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java b/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java index 8391923d..0f4cdac7 100644 --- a/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java +++ b/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java @@ -169,8 +169,8 @@ public Response call() throws Exception { * The connect and read timeouts are properly set no matter in which order * Request.timeout is called. * - * @throws Exception If something goes wrong inside * @param type Type of Request + * @throws Exception If something goes wrong inside */ @ParameterizedTest @Values From 218458dc6cd576ba8814ae82732dcf3931a6a26a Mon Sep 17 00:00:00 2001 From: uchitsa Date: Thu, 28 Nov 2024 02:16:11 +0300 Subject: [PATCH 011/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTimeoutLossTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java b/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java index 0f4cdac7..e03be002 100644 --- a/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java +++ b/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java @@ -198,8 +198,8 @@ public Response call() throws Exception { * The connect and read timeouts are properly set no matter in which order * Request.timeout is called. * - * @throws Exception If something goes wrong inside * @param type Type of Request + * @throws Exception If something goes wrong inside */ @ParameterizedTest @Values From aef6661c8ad2e45920aa06b629b7a67ee29b31fb Mon Sep 17 00:00:00 2001 From: uchitsa Date: Thu, 28 Nov 2024 02:16:14 +0300 Subject: [PATCH 012/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTimeoutLossTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java b/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java index e03be002..1880009b 100644 --- a/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java +++ b/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java @@ -229,8 +229,8 @@ public Response call() throws Exception { * The connect and read timeouts are properly set no matter in which order * Request.timeout is called. * - * @throws Exception If something goes wrong inside * @param type Type of Request + * @throws Exception If something goes wrong inside */ @ParameterizedTest @Values From cbe5a3b242fca5b68d34086b8d4373bda72653cc Mon Sep 17 00:00:00 2001 From: uchitsa Date: Thu, 28 Nov 2024 02:16:22 +0300 Subject: [PATCH 013/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTimeoutLossTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java b/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java index 1880009b..b57f2c48 100644 --- a/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java +++ b/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java @@ -259,8 +259,8 @@ public Response call() throws Exception { * The connect and read timeouts are properly set no matter in which order * Request.timeout is called. * - * @throws Exception If something goes wrong inside * @param type Type of Request + * @throws Exception If something goes wrong inside */ @ParameterizedTest @Values From a5b13e7d8f4fe7e5df0387e52fbec3a2dd904a41 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Thu, 28 Nov 2024 16:27:29 +0300 Subject: [PATCH 014/112] fix quality violations --- src/main/java/com/jcabi/http/request/FakeRequest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/jcabi/http/request/FakeRequest.java b/src/main/java/com/jcabi/http/request/FakeRequest.java index 17ba926d..0b3cfc08 100644 --- a/src/main/java/com/jcabi/http/request/FakeRequest.java +++ b/src/main/java/com/jcabi/http/request/FakeRequest.java @@ -42,6 +42,7 @@ import java.io.InputStream; import java.net.HttpURLConnection; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.Collections; import java.util.Map; @@ -70,7 +71,7 @@ public final class FakeRequest implements Request { /** * The Charset to use. */ - private static final Charset CHARSET = Charset.forName("UTF-8"); + private static final Charset CHARSET = StandardCharsets.UTF_8; /** * Base request. From 19961f67129b6f7a453a991d3630e966a1d5d3dc Mon Sep 17 00:00:00 2001 From: uchitsa Date: Thu, 28 Nov 2024 16:27:33 +0300 Subject: [PATCH 015/112] fix quality violations --- src/main/java/com/jcabi/http/mock/MkAnswer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/jcabi/http/mock/MkAnswer.java b/src/main/java/com/jcabi/http/mock/MkAnswer.java index ba7acbb0..b6129fd0 100644 --- a/src/main/java/com/jcabi/http/mock/MkAnswer.java +++ b/src/main/java/com/jcabi/http/mock/MkAnswer.java @@ -37,6 +37,7 @@ import com.jcabi.log.Logger; import java.net.HttpURLConnection; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -89,7 +90,7 @@ final class Simple implements MkAnswer { /** * The Charset to use. */ - private static final Charset CHARSET = Charset.forName("UTF-8"); + private static final Charset CHARSET = StandardCharsets.UTF_8; /** * Encapsulated response. From faeb2dd47b8ed8935c98af2abfd1122641d82f14 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Thu, 28 Nov 2024 16:49:10 +0300 Subject: [PATCH 016/112] fix quality violations --- src/test/java/com/jcabi/http/response/XmlResponseTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/response/XmlResponseTest.java b/src/test/java/com/jcabi/http/response/XmlResponseTest.java index 67d03fc0..33d1a4c3 100644 --- a/src/test/java/com/jcabi/http/response/XmlResponseTest.java +++ b/src/test/java/com/jcabi/http/response/XmlResponseTest.java @@ -39,8 +39,8 @@ /** * Test case for {@link XmlResponse}. - * @checkstyle ClassDataAbstractionCoupling (500 lines) * @since 1.1 + * @checkstyle ClassDataAbstractionCoupling (500 lines) */ @SuppressWarnings("PMD.TooManyMethods") final class XmlResponseTest { From e9eb17a5a6b38323271a4249f498a7c9faeca52e Mon Sep 17 00:00:00 2001 From: uchitsa Date: Thu, 28 Nov 2024 16:49:15 +0300 Subject: [PATCH 017/112] fix quality violations --- .../java/com/jcabi/http/wire/LastModifiedCachingWireTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/wire/LastModifiedCachingWireTest.java b/src/test/java/com/jcabi/http/wire/LastModifiedCachingWireTest.java index e41194c5..0422977c 100644 --- a/src/test/java/com/jcabi/http/wire/LastModifiedCachingWireTest.java +++ b/src/test/java/com/jcabi/http/wire/LastModifiedCachingWireTest.java @@ -201,6 +201,7 @@ void doesNotCacheGetRequestIfTheLastModifiedHeaderIsMissing() /** * LastModifiedCachingWire can resist cache eviction in the event of a non * OK response without a last modified header. + * @throws Exception If fails * @todo #120:30min Confirm cache clearing behaviour in all non-OK responses * Non-OK behaviour was not specified in #120, so for example, if the * response is 404 as below, does it make any sense to keep the item in @@ -210,7 +211,6 @@ void doesNotCacheGetRequestIfTheLastModifiedHeaderIsMissing() * or 410 Gone etc. Or, personally I think all non-OK and OK responses * should behave the same WRT to clearing the cache as the cache value is * so unlikely to be returned in future. - * @throws Exception If fails */ @Test void doesNotEvictCacheOnNonOk() From 7216ad2d2743bdff064deb2e0cdcca08e471d4da Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 4 Dec 2024 12:13:36 +0300 Subject: [PATCH 018/112] fix quality violations --- src/main/java/com/jcabi/http/request/MultipartBodyBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/jcabi/http/request/MultipartBodyBuilder.java b/src/main/java/com/jcabi/http/request/MultipartBodyBuilder.java index ee940262..8cedbd39 100644 --- a/src/main/java/com/jcabi/http/request/MultipartBodyBuilder.java +++ b/src/main/java/com/jcabi/http/request/MultipartBodyBuilder.java @@ -44,7 +44,7 @@ public final class MultipartBodyBuilder { /** * Carriage return constant. */ - private static final byte[] CRLF = new byte[]{13, 10}; + private static final byte[] CRLF = {13, 10}; /** * Byte array. From 8d36d8c22170ebc9aba39161ea8610678f10d636 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 4 Dec 2024 12:21:35 +0300 Subject: [PATCH 019/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index e712e3b0..e7a6ab7f 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -69,8 +69,8 @@ final class RequestTest extends RequestTestTemplate { /** * BaseRequest can fetch HTTP request and process HTTP response. - * @throws Exception If something goes wrong inside * @param type Request type + * @throws Exception If something goes wrong inside */ @Values @ParameterizedTest From 50e68e4cb83bcc6ea46aa0aa1cfafd3c10bd8d81 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 4 Dec 2024 12:21:38 +0300 Subject: [PATCH 020/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index e7a6ab7f..f9347af2 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -101,8 +101,8 @@ void sendsHttpRequestAndProcessesHttpResponse( /** * BaseRequest can fetch HTTP headers. - * @throws Exception If something goes wrong inside * @param type Request type + * @throws Exception If something goes wrong inside */ @Values @ParameterizedTest From a418b634c41994fc4926cdc112f55a1ffa2db9de Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 4 Dec 2024 12:21:41 +0300 Subject: [PATCH 021/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index f9347af2..c5ad8550 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -138,8 +138,8 @@ void sendsHttpRequestWithHeaders( /** * BaseRequest can fetch GET request with query params. - * @throws Exception If something goes wrong inside * @param type Request type + * @throws Exception If something goes wrong inside */ @Values @ParameterizedTest From dc19fc0d61fe0fbfa727ce0564323dcbb56da9a6 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 4 Dec 2024 12:21:45 +0300 Subject: [PATCH 022/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index c5ad8550..52ba4a68 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -169,8 +169,8 @@ void sendsTextWithGetParameters( /** * BaseRequest can fetch body with HTTP POST request. - * @throws Exception If something goes wrong inside * @param type Request type + * @throws Exception If something goes wrong inside */ @Values @ParameterizedTest From 54e123e5c973501b8e44b383a5c45474063bf705 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 4 Dec 2024 12:21:49 +0300 Subject: [PATCH 023/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index 52ba4a68..ee561f29 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -200,8 +200,8 @@ void sendsTextWithPostRequestMatchParam( /** * BaseRequest can fetch body with HTTP POST request with params. - * @throws Exception If something goes wrong inside * @param type Request type + * @throws Exception If something goes wrong inside */ @Values @ParameterizedTest From ad1e6a6748ba4c41dc2a1c976b4c968b2c076837 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 4 Dec 2024 12:21:53 +0300 Subject: [PATCH 024/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index ee561f29..c7b12ef1 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -238,9 +238,9 @@ void sendsTextWithPostRequestMatchMultipleParams( /** * BaseRequest can fetch multipart body with HTTP POST request * with single byte param. + * @param type Request type * @throws Exception If something goes wrong inside * @checkstyle LineLength (30 lines) - * @param type Request type */ @Values @ParameterizedTest From f800975accfbdefd085ec7ed985b40db713644b7 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 4 Dec 2024 12:21:58 +0300 Subject: [PATCH 025/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index c7b12ef1..237b91ff 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -284,9 +284,9 @@ void sendsMultipartPostRequestMatchByteParam( /** * BaseRequest can fetch multipart body with HTTP POST request * with single param. + * @param type Request type * @throws Exception If something goes wrong inside * @checkstyle LineLength (30 lines) - * @param type Request type */ @Values @ParameterizedTest From 74cb90f1d724309a71a5588e31f8565109288fb7 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 4 Dec 2024 12:22:02 +0300 Subject: [PATCH 026/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index 237b91ff..3b51d6b7 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -330,9 +330,9 @@ void sendsMultipartPostRequestMatchSingleParam( /** * BaseRequest can fetch multipart body with HTTP POST request * with two params. + * @param type Request type * @throws Exception If something goes wrong inside * @checkstyle LineLength (40 lines) - * @param type Request type */ @Values @ParameterizedTest From 6247ddafda39aafa9f0639e0abebb74091d9e3bb Mon Sep 17 00:00:00 2001 From: uchitsa Date: Fri, 6 Dec 2024 02:18:17 +0300 Subject: [PATCH 027/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index 3b51d6b7..8697c8fe 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -383,8 +383,8 @@ void sendsMultipartPostRequestMatchTwoParams( /** * BaseRequest can fetch body with HTTP POST request. - * @throws Exception If something goes wrong inside * @param type Request type + * @throws Exception If something goes wrong inside */ @Values @ParameterizedTest From be5dec6ea7203490f69f97123c653c632592fdaa Mon Sep 17 00:00:00 2001 From: uchitsa Date: Fri, 6 Dec 2024 02:18:21 +0300 Subject: [PATCH 028/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index 8697c8fe..95483b69 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -416,8 +416,8 @@ void sendsTextWithPostRequestMatchBody( /** * BaseRequest can assert HTTP status code value. - * @throws Exception If something goes wrong inside. * @param type Request type + * @throws Exception If something goes wrong inside. */ @Values @ParameterizedTest From a5c231a687bf4ee8673532080f23b22a9049dc0e Mon Sep 17 00:00:00 2001 From: uchitsa Date: Fri, 6 Dec 2024 02:18:25 +0300 Subject: [PATCH 029/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index 95483b69..735aefd5 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -439,8 +439,8 @@ void assertsHttpStatus( /** * BaseRequest can assert response body. - * @throws Exception If something goes wrong inside. * @param type Request type + * @throws Exception If something goes wrong inside. */ @Values @ParameterizedTest From 030d46be8dac27eed7ea8b546a78f994f093d862 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Fri, 6 Dec 2024 02:18:28 +0300 Subject: [PATCH 030/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index 735aefd5..80b8f6ab 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -460,8 +460,8 @@ void assertsHttpResponseBody( /** * BaseRequest can assert HTTP headers in response. - * @throws Exception If something goes wrong inside. * @param type Request type + * @throws Exception If something goes wrong inside. */ @Values @ParameterizedTest From 60c40a7c7ea5eb71ad87570476c21085c8f18e75 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Fri, 6 Dec 2024 02:18:33 +0300 Subject: [PATCH 031/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index 80b8f6ab..bc80acb8 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -492,8 +492,8 @@ void assertsHttpHeaders( /** * BaseRequest can assert response body content with XPath query. - * @throws Exception If something goes wrong inside. * @param type Request type + * @throws Exception If something goes wrong inside. */ @Values @ParameterizedTest From c65a91d675c5e2c661e685d45aba8ecff2cac595 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Fri, 6 Dec 2024 15:51:11 +0300 Subject: [PATCH 032/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index bc80acb8..a267899a 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -532,8 +532,8 @@ void mockedUrlIsInCorrectFormat() throws Exception { /** * BaseRequest can handle unicode in plain text response. - * @throws Exception If something goes wrong inside * @param type Request type + * @throws Exception If something goes wrong inside */ @Values @ParameterizedTest From 61c43d0570ee0c6304382bf5568f90ca5507f9c0 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Fri, 6 Dec 2024 15:51:13 +0300 Subject: [PATCH 033/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index a267899a..d3b78d0c 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -556,8 +556,8 @@ void acceptsUnicodeInPlainText( /** * BaseRequest can handle unicode in XML response. - * @throws Exception If something goes wrong inside * @param type Request type + * @throws Exception If something goes wrong inside */ @Values @ParameterizedTest From 90e1a3793f07a4fc5c88e51e2bdd7342d47c6430 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Fri, 6 Dec 2024 15:51:17 +0300 Subject: [PATCH 034/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index d3b78d0c..d13103b8 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -579,8 +579,8 @@ void acceptsUnicodeInXml( /** * BaseRequest can use basic authentication scheme. - * @throws Exception If something goes wrong inside * @param type Request type + * @throws Exception If something goes wrong inside */ @ParameterizedTest @Values From 0826363f04c7d8eaadd9ebc2629e3c90d478f45a Mon Sep 17 00:00:00 2001 From: uchitsa Date: Fri, 6 Dec 2024 15:51:20 +0300 Subject: [PATCH 035/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index d13103b8..50453b48 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -611,8 +611,8 @@ void sendsBasicAuthenticationHeader( /** * BaseRequest can fetch GET request twice. - * @throws Exception If something goes wrong inside * @param type Request type + * @throws Exception If something goes wrong inside */ @Values @ParameterizedTest From 2fce6bfe08d8ceec6bb42eb625f3038ff3fee7cc Mon Sep 17 00:00:00 2001 From: uchitsa Date: Fri, 6 Dec 2024 15:51:23 +0300 Subject: [PATCH 036/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index 50453b48..1042d212 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -642,9 +642,9 @@ void sendsIdenticalHttpRequestTwice( /** * BaseRequest can return redirect status (without redirecting). + * @param type Request type * @throws Exception If something goes wrong inside * @since 0.10 - * @param type Request type */ @Values @ParameterizedTest From 23262868fe7981e933dc42f9242070613ced96e5 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Fri, 6 Dec 2024 15:51:55 +0300 Subject: [PATCH 037/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index 1042d212..c0da7b92 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -664,8 +664,8 @@ void doesntRedirectWithoutRequest( /** * BaseRequest can fetch body with HTTP POST request. - * @throws Exception If something goes wrong inside * @param type Request type + * @throws Exception If something goes wrong inside */ @Values @ParameterizedTest From 0c321cc38c2ee5da8823dba1f9e72b7d8a4a9b37 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Fri, 6 Dec 2024 15:59:15 +0300 Subject: [PATCH 038/112] fix quality violations --- .../java/com/jcabi/http/mock/MkGrizzlyAdapter.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/jcabi/http/mock/MkGrizzlyAdapter.java b/src/main/java/com/jcabi/http/mock/MkGrizzlyAdapter.java index 0dba9174..4b1d8068 100644 --- a/src/main/java/com/jcabi/http/mock/MkGrizzlyAdapter.java +++ b/src/main/java/com/jcabi/http/mock/MkGrizzlyAdapter.java @@ -79,11 +79,11 @@ final class MkGrizzlyAdapter extends HttpHandler { @Override @SuppressWarnings ( - { - "PMD.AvoidCatchingThrowable", - "PMD.AvoidInstantiatingObjectsInLoops", - "rawtypes" - } + { + "PMD.AvoidCatchingThrowable", + "PMD.AvoidInstantiatingObjectsInLoops", + "rawtypes" + } ) public void service( final Request request, From 2c04209f45966586420fc3ee2fbe0fe870c7e387 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Sun, 8 Dec 2024 23:17:34 +0300 Subject: [PATCH 039/112] fix quality violations --- src/main/java/com/jcabi/http/response/JsoupResponse.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/jcabi/http/response/JsoupResponse.java b/src/main/java/com/jcabi/http/response/JsoupResponse.java index b916821d..6f339266 100644 --- a/src/main/java/com/jcabi/http/response/JsoupResponse.java +++ b/src/main/java/com/jcabi/http/response/JsoupResponse.java @@ -60,8 +60,8 @@ * *

The class is immutable and thread-safe. * - * @since 1.4 * @see Jsoup website + * @since 1.4 */ @Immutable @EqualsAndHashCode(callSuper = true) From 00220c57c3e18d6a72e91425f28e4e5b4a668f40 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Sun, 8 Dec 2024 23:17:44 +0300 Subject: [PATCH 040/112] fix quality violations --- src/test/java/com/jcabi/http/RequestITCase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestITCase.java b/src/test/java/com/jcabi/http/RequestITCase.java index 8788b19b..9f944056 100644 --- a/src/test/java/com/jcabi/http/RequestITCase.java +++ b/src/test/java/com/jcabi/http/RequestITCase.java @@ -79,8 +79,8 @@ void sendsHttpRequestAndProcessesHttpResponse( /** * BaseRequest can process not-OK response. - * @throws Exception If something goes wrong inside * @param type Request type + * @throws Exception If something goes wrong inside */ @Values @ParameterizedTest From f4a466c8c0fdcbe5a17c4f8bd384f99fb33bffe2 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Sun, 8 Dec 2024 23:17:47 +0300 Subject: [PATCH 041/112] fix quality violations --- src/test/java/com/jcabi/http/RequestITCase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestITCase.java b/src/test/java/com/jcabi/http/RequestITCase.java index 9f944056..3ae89224 100644 --- a/src/test/java/com/jcabi/http/RequestITCase.java +++ b/src/test/java/com/jcabi/http/RequestITCase.java @@ -60,8 +60,8 @@ final class RequestITCase extends RequestTestTemplate { /** * BaseRequest can fetch HTTP request and process HTTP response. - * @throws Exception If something goes wrong inside * @param type Request type + * @throws Exception If something goes wrong inside */ @Values @ParameterizedTest From 8456039a10b4c0d15c90e9cdaa6760cbc329c09e Mon Sep 17 00:00:00 2001 From: uchitsa Date: Sun, 8 Dec 2024 23:17:57 +0300 Subject: [PATCH 042/112] fix quality violations --- src/test/java/com/jcabi/http/RequestITCaseTemplate.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestITCaseTemplate.java b/src/test/java/com/jcabi/http/RequestITCaseTemplate.java index 009a6495..8c16c3c8 100644 --- a/src/test/java/com/jcabi/http/RequestITCaseTemplate.java +++ b/src/test/java/com/jcabi/http/RequestITCaseTemplate.java @@ -58,8 +58,8 @@ /** * Tests for any implementation of {@link Request}. * - * @checkstyle JavadocMethodCheck (500 lines) * @since 1.17.8 + * @checkstyle JavadocMethodCheck (500 lines) */ @RequiredArgsConstructor(access = AccessLevel.PROTECTED) @SuppressWarnings({"PMD.AbstractClassWithoutAbstractMethod", "PMD.TooManyMethods"}) From e86139dc766f7f7140d1d244b92f65b7d01c8865 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Mon, 9 Dec 2024 17:50:01 +0300 Subject: [PATCH 043/112] fix quality violations --- src/main/java/com/jcabi/http/wire/BasicAuthWire.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/jcabi/http/wire/BasicAuthWire.java b/src/main/java/com/jcabi/http/wire/BasicAuthWire.java index 412bb419..a2480672 100644 --- a/src/main/java/com/jcabi/http/wire/BasicAuthWire.java +++ b/src/main/java/com/jcabi/http/wire/BasicAuthWire.java @@ -64,8 +64,8 @@ * *

The class is immutable and thread-safe. * - * @since 0.10 * @see RFC 2617 "HTTP Authentication: Basic and Digest Access Authentication" + * @since 0.10 */ @Immutable @ToString(of = "origin") From 9f93bb1183116ecd777dd3599677df27c69497c3 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Mon, 9 Dec 2024 17:50:18 +0300 Subject: [PATCH 044/112] fix quality violations --- src/main/java/com/jcabi/http/wire/CookieOptimizingWire.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/jcabi/http/wire/CookieOptimizingWire.java b/src/main/java/com/jcabi/http/wire/CookieOptimizingWire.java index 34fd104b..3a91d72b 100644 --- a/src/main/java/com/jcabi/http/wire/CookieOptimizingWire.java +++ b/src/main/java/com/jcabi/http/wire/CookieOptimizingWire.java @@ -67,8 +67,8 @@ * *

The class is immutable and thread-safe. * - * @since 0.10 * @see RFC 2965 "HTTP State Management Mechanism" + * @since 0.10 */ @Immutable @ToString(of = "origin") From 9740432d37935a23b13bc5b980106c7d2d3cab0b Mon Sep 17 00:00:00 2001 From: uchitsa Date: Mon, 9 Dec 2024 17:50:27 +0300 Subject: [PATCH 045/112] fix quality violations --- src/main/java/com/jcabi/http/Response.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/jcabi/http/Response.java b/src/main/java/com/jcabi/http/Response.java index 2abe3419..4a024b53 100644 --- a/src/main/java/com/jcabi/http/Response.java +++ b/src/main/java/com/jcabi/http/Response.java @@ -44,8 +44,8 @@ * *

Instances of this interface are immutable and thread-safe. * + * @see com.jcabi.http.request.JdkRequest * * @since 0.8 - * @see com.jcabi.http.request.JdkRequest */ @Immutable public interface Response { From 32447147f6d788b6522f3d76935abfbdbc91e3bf Mon Sep 17 00:00:00 2001 From: uchitsa Date: Mon, 9 Dec 2024 17:50:30 +0300 Subject: [PATCH 046/112] fix quality violations --- src/main/java/com/jcabi/http/wire/UserAgentWire.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/jcabi/http/wire/UserAgentWire.java b/src/main/java/com/jcabi/http/wire/UserAgentWire.java index 8903f303..0f9f493f 100644 --- a/src/main/java/com/jcabi/http/wire/UserAgentWire.java +++ b/src/main/java/com/jcabi/http/wire/UserAgentWire.java @@ -64,8 +64,8 @@ * *

The class is immutable and thread-safe. * - * @since 0.10 * @see RFC 2616 section 14.43 "User-Agent" + * @since 0.10 */ @Immutable @ToString(of = "origin") From 0cbe0abc349b834268289f876aa60237b64874c7 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Mon, 9 Dec 2024 17:50:32 +0300 Subject: [PATCH 047/112] fix quality violations --- src/main/java/com/jcabi/http/response/WebLinkingResponse.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/jcabi/http/response/WebLinkingResponse.java b/src/main/java/com/jcabi/http/response/WebLinkingResponse.java index f1a52ce1..270c1aac 100644 --- a/src/main/java/com/jcabi/http/response/WebLinkingResponse.java +++ b/src/main/java/com/jcabi/http/response/WebLinkingResponse.java @@ -61,8 +61,8 @@ * *

The class is immutable and thread-safe. * - * @since 0.9 * @see RFC 5988 "Web Linking" + * @since 0.9 */ @Immutable @EqualsAndHashCode(callSuper = true) From 723ad2496563cf95a0151e65e89a6a77e42536fa Mon Sep 17 00:00:00 2001 From: uchitsa Date: Mon, 9 Dec 2024 23:14:42 +0300 Subject: [PATCH 048/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index c0da7b92..d6b4c8f3 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -89,10 +89,12 @@ void sendsHttpRequestAndProcessesHttpResponse( .assertStatus(HttpURLConnection.HTTP_OK); final MkQuery query = container.take(); MatcherAssert.assertThat( + "should contains 'helloall'", query, MkQueryMatchers.hasPath(Matchers.containsString("helloall")) ); MatcherAssert.assertThat( + "should be GET method", query.method(), Matchers.equalTo(Request.GET) ); @@ -121,6 +123,7 @@ void sendsHttpRequestWithHeaders( .assertStatus(HttpURLConnection.HTTP_OK); final MkQuery query = container.take(); MatcherAssert.assertThat( + "should be accept '*' and user-agent 'jcabi'", query.headers(), Matchers.allOf( Matchers.hasEntry( @@ -158,6 +161,7 @@ void sendsTextWithGetParameters( .assertStatus(HttpURLConnection.HTTP_OK); final MkQuery query = container.take(); MatcherAssert.assertThat( + "should be ends with '€'", URLDecoder.decode( query.uri().toString(), String.valueOf(StandardCharsets.UTF_8) @@ -250,7 +254,7 @@ void sendsMultipartPostRequestMatchByteParam( final MkContainer container = new MkGrizzlyContainer().next( new MkAnswer.Simple("") ).start(); - final byte[] value = new byte[]{Byte.parseByte("-122")}; + final byte[] value = {Byte.parseByte("-122")}; RequestTestTemplate.request(container.home(), type) .method(Request.POST) .header( From 6fcd1cac8e6e4f1bd628a058864d01cde1e0d2bb Mon Sep 17 00:00:00 2001 From: uchitsa Date: Mon, 9 Dec 2024 23:27:14 +0300 Subject: [PATCH 049/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index d6b4c8f3..fdcf6e00 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -196,6 +196,7 @@ void sendsTextWithPostRequestMatchParam( .assertStatus(HttpURLConnection.HTTP_OK); final MkQuery query = container.take(); MatcherAssert.assertThat( + "should be with param", URLDecoder.decode(query.body(), StandardCharsets.UTF_8.toString()), Matchers.is(String.format("p=%s", value)) ); @@ -231,6 +232,7 @@ void sendsTextWithPostRequestMatchMultipleParams( .assertStatus(HttpURLConnection.HTTP_OK); final MkQuery query = container.take(); MatcherAssert.assertThat( + "should be with multiple params", URLDecoder.decode(query.body(), StandardCharsets.UTF_8.toString()), Matchers.is( String.format("a=%s&b=%s", value, follow) @@ -270,6 +272,7 @@ void sendsMultipartPostRequestMatchByteParam( .assertStatus(HttpURLConnection.HTTP_OK); final MkQuery query = container.take(); MatcherAssert.assertThat( + "should be match byte param", query.body(), Matchers.is( Joiner.on(Constants.CRLF).join( @@ -316,6 +319,7 @@ void sendsMultipartPostRequestMatchSingleParam( .assertStatus(HttpURLConnection.HTTP_OK); final MkQuery query = container.take(); MatcherAssert.assertThat( + "should be match single param", query.body(), Matchers.is( Joiner.on(Constants.CRLF).join( @@ -365,6 +369,7 @@ void sendsMultipartPostRequestMatchTwoParams( final MkQuery query = container.take(); final String separator = "--xy--"; MatcherAssert.assertThat( + "should be match two params", query.body(), Matchers.is( Joiner.on(Constants.CRLF).join( @@ -412,6 +417,7 @@ void sendsTextWithPostRequestMatchBody( .assertStatus(HttpURLConnection.HTTP_OK); final MkQuery query = container.take(); MatcherAssert.assertThat( + "should be match body", URLDecoder.decode(query.body(), StandardCharsets.UTF_8.toString()), Matchers.containsString(value) ); From 7695b1b8829d0770ecd01937cf9b78284a9f2fcd Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 10 Dec 2024 01:55:25 +0300 Subject: [PATCH 050/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/java/com/jcabi/http/RequestTest.java b/src/test/java/com/jcabi/http/RequestTest.java index fdcf6e00..0ae38cfd 100644 --- a/src/test/java/com/jcabi/http/RequestTest.java +++ b/src/test/java/com/jcabi/http/RequestTest.java @@ -535,6 +535,7 @@ void mockedUrlIsInCorrectFormat() throws Exception { container.stop(); final URI uri = container.home(); MatcherAssert.assertThat( + "should be correct URI", uri.toString().matches("^http://localhost:\\d+/$"), Matchers.describedAs(uri.toString(), Matchers.is(true)) ); @@ -611,6 +612,7 @@ void sendsBasicAuthenticationHeader( container.stop(); final MkQuery query = container.take(); MatcherAssert.assertThat( + "should be basic authorization", query.headers(), Matchers.hasEntry( Matchers.equalTo(HttpHeaders.AUTHORIZATION), @@ -645,6 +647,7 @@ void sendsIdenticalHttpRequestTwice( .assertStatus(HttpURLConnection.HTTP_OK); container.stop(); MatcherAssert.assertThat( + "should be ends with 'foo-X'", container.take(), MkQueryMatchers.hasPath(Matchers.endsWith("foo-X")) ); @@ -698,6 +701,7 @@ void sendsRequestBodyAsInputStream( .assertStatus(HttpURLConnection.HTTP_OK); final MkQuery query = container.take(); MatcherAssert.assertThat( + "should contains body as input stream", query.body(), Matchers.containsString(value) ); From f0f30cc5fea54c7ea87f4f259d9f087bd26a7e55 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 10 Dec 2024 01:55:29 +0300 Subject: [PATCH 051/112] fix quality violations --- src/main/java/com/jcabi/http/request/BaseRequest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/jcabi/http/request/BaseRequest.java b/src/main/java/com/jcabi/http/request/BaseRequest.java index 49b47dd9..14c7ea73 100644 --- a/src/main/java/com/jcabi/http/request/BaseRequest.java +++ b/src/main/java/com/jcabi/http/request/BaseRequest.java @@ -64,10 +64,10 @@ /** * Base implementation of {@link Request}. * - * @since 0.8 * // @checkstyle ClassDataAbstractionCoupling (500 lines) * @see Request * @see Response + * @since 0.8 */ @Immutable @EqualsAndHashCode(of = {"home", "mtd", "hdrs", "content"}) From df790edbd61fcfa5850257c7f99dcc9bcf3ce34e Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 10 Dec 2024 02:06:33 +0300 Subject: [PATCH 052/112] fix quality violations --- src/main/java/com/jcabi/http/request/ApacheRequest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/jcabi/http/request/ApacheRequest.java b/src/main/java/com/jcabi/http/request/ApacheRequest.java index 9f27a97e..274437a3 100644 --- a/src/main/java/com/jcabi/http/request/ApacheRequest.java +++ b/src/main/java/com/jcabi/http/request/ApacheRequest.java @@ -64,10 +64,10 @@ *

The class is immutable and thread-safe. * * @since 0.8 - * @checkstyle ClassDataAbstractionCoupling (500 lines) * @todo #200:30m TrustedWire does not support ApacheRequest. * Investigate if it's possible for them to work together, * if not see jcabi-http#178 for discussion about alternative solutions. + * @checkstyle ClassDataAbstractionCoupling (500 lines) */ @Immutable @EqualsAndHashCode(of = "base") From 203b2f864ce6011694a8491d462f37fee4f66ff5 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 10 Dec 2024 02:06:45 +0300 Subject: [PATCH 053/112] fix quality violations --- src/main/java/com/jcabi/http/wire/CachingWire.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/jcabi/http/wire/CachingWire.java b/src/main/java/com/jcabi/http/wire/CachingWire.java index 35076324..0bb2334e 100644 --- a/src/main/java/com/jcabi/http/wire/CachingWire.java +++ b/src/main/java/com/jcabi/http/wire/CachingWire.java @@ -81,11 +81,11 @@ * query part. * *

The class is immutable and thread-safe. + * @since 1.0 * @todo #179:30m This implementation depends on Guava. Investigate for a * possible shared interface between this class and other implementations for * caching. If this shared interface is possible replace this task with a task * for implementing it. - * @since 1.0 */ @Immutable @ToString From c491c1c1eca5d607792ed9dcb498c48b87d2eedb Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 10 Dec 2024 02:06:49 +0300 Subject: [PATCH 054/112] fix quality violations --- src/main/java/com/jcabi/http/mock/MkContainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/jcabi/http/mock/MkContainer.java b/src/main/java/com/jcabi/http/mock/MkContainer.java index f307d0d2..82265657 100644 --- a/src/main/java/com/jcabi/http/mock/MkContainer.java +++ b/src/main/java/com/jcabi/http/mock/MkContainer.java @@ -62,8 +62,8 @@ *

Since version 0.11 container implements {@link Closeable} and can be * used in try-with-resource block. * - * @since 0.10 * @see Examples + * @since 0.10 */ @SuppressWarnings("PMD.TooManyMethods") public interface MkContainer extends Closeable { From 561daa0d1a332a5bd9449b610bcdea1791bc4b3f Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 10 Dec 2024 02:06:54 +0300 Subject: [PATCH 055/112] fix quality violations --- src/main/java/com/jcabi/http/mock/MkGrizzlyContainer.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/jcabi/http/mock/MkGrizzlyContainer.java b/src/main/java/com/jcabi/http/mock/MkGrizzlyContainer.java index 3368815d..fb04de83 100644 --- a/src/main/java/com/jcabi/http/mock/MkGrizzlyContainer.java +++ b/src/main/java/com/jcabi/http/mock/MkGrizzlyContainer.java @@ -42,9 +42,8 @@ /** * Implementation of {@link MkContainer} based on Grizzly Server. - * - * @since 0.10 * @see MkContainer + * @since 0.10 */ @SuppressWarnings("PMD.TooManyMethods") @EqualsAndHashCode(of = {"adapter", "gws", "port"}) From 7d2396e89a83b620f69b36b3c345d4c7a59c439a Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 10 Dec 2024 02:20:53 +0300 Subject: [PATCH 056/112] fix quality violations --- src/main/java/com/jcabi/http/Request.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/jcabi/http/Request.java b/src/main/java/com/jcabi/http/Request.java index d9dafaa1..f2698c2b 100644 --- a/src/main/java/com/jcabi/http/Request.java +++ b/src/main/java/com/jcabi/http/Request.java @@ -71,9 +71,9 @@ * possible HTTP methods (JdkRequest doesn't support {@code PATCH}, * for example). * - * @since 0.8 * @see com.jcabi.http.request.JdkRequest * @see com.jcabi.http.request.ApacheRequest + * @since 0.8 */ @Immutable @SuppressWarnings({"PMD.AvoidDuplicateLiterals", "PMD.TooManyMethods"}) From 3b38b79e060bc670b21af8cdb0010f60d6a75b8f Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 10 Dec 2024 02:20:59 +0300 Subject: [PATCH 057/112] fix quality violations --- src/test/java/com/jcabi/http/RequestTimeoutLossTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java b/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java index b57f2c48..3510dfab 100644 --- a/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java +++ b/src/test/java/com/jcabi/http/RequestTimeoutLossTest.java @@ -378,10 +378,12 @@ private void testTimeoutOrderDoesntMatter(final Callable exec) rdc.capture() ); MatcherAssert.assertThat( + "should be connect timeout", cnc.getValue().intValue(), Matchers.is(RequestTimeoutLossTest.CONNECT_TIMEOUT) ); MatcherAssert.assertThat( + "should be read timeout", rdc.getValue().intValue(), Matchers.is(RequestTimeoutLossTest.READ_TIMEOUT) ); From 90cc8f3bbfd17d29d498314de093728eee987021 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 10 Dec 2024 14:47:52 +0300 Subject: [PATCH 058/112] fix quality violations --- .../java/com/jcabi/http/response/JacksonResponseTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/java/com/jcabi/http/response/JacksonResponseTest.java b/src/test/java/com/jcabi/http/response/JacksonResponseTest.java index 739dbc02..1da67c34 100644 --- a/src/test/java/com/jcabi/http/response/JacksonResponseTest.java +++ b/src/test/java/com/jcabi/http/response/JacksonResponseTest.java @@ -56,10 +56,12 @@ void canReadJsonDocument() throws IOException { .withBody("{\n\t\r\"foo-foo\":2,\n\"bar\":\"\u20ac\"}") .fetch().as(JacksonResponse.class); MatcherAssert.assertThat( + "should be 2", response.json().read().path("foo-foo").asInt(), Matchers.equalTo(2) ); MatcherAssert.assertThat( + "should be '\u20ac'", response.json().read().path("bar").asText(), Matchers.equalTo("\u20ac") ); @@ -76,6 +78,7 @@ void canParseUnquotedControlCharacters() throws IOException { .withBody("{\"test\":\n\"\u001Fblah\uFFFDcwhoa\u0000!\"}") .fetch().as(JacksonResponse.class); MatcherAssert.assertThat( + "should be '\u001Fblah\uFFFDcwhoa\u0000!'", response.json().readObject().get("test").asText(), Matchers.is("\u001Fblah\uFFFDcwhoa\u0000!") ); @@ -94,6 +97,7 @@ void invalidJsonErrorHandlingIsLeftToJackson() throws IOException { final JacksonResponse response = new FakeRequest() .withBody(body).fetch().as(JacksonResponse.class); MatcherAssert.assertThat( + "should contains error 'was expecting double-quote to start field name'", Assertions.assertThrows( IOException.class, new Executable() { @@ -123,6 +127,7 @@ void invalidJsonArrayErrorHandlingIsLeftToJackson() .withBody("{\"anInvalidArrayTest\":[}") .fetch().as(JacksonResponse.class); MatcherAssert.assertThat( + "should contains error 'Unexpected close marker'", Assertions.assertThrows( IOException.class, new Executable() { @@ -149,6 +154,7 @@ void cannotReadJsonAsArrayIfNotOne() throws IOException { .withBody("{\"objectIsNotArray\": \"It's not!\"}") .fetch().as(JacksonResponse.class); MatcherAssert.assertThat( + "should contains 'Cannot read as an array. The JSON is not a valid array.'", Assertions.assertThrows( IOException.class, new Executable() { From 46c3280254537f77d68a1f874aa26be308dd7212 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 10 Dec 2024 20:12:19 +0300 Subject: [PATCH 059/112] fix quality violations --- .../java/com/jcabi/http/response/JacksonResponseTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/jcabi/http/response/JacksonResponseTest.java b/src/test/java/com/jcabi/http/response/JacksonResponseTest.java index 1da67c34..c78ea4e8 100644 --- a/src/test/java/com/jcabi/http/response/JacksonResponseTest.java +++ b/src/test/java/com/jcabi/http/response/JacksonResponseTest.java @@ -184,10 +184,10 @@ void canReadAsArrayIfOne() throws IOException { .fetch().as(JacksonResponse.class); final ArrayNode array = response.json().readArray(); MatcherAssert.assertThat( - array.get(0).asText(), Matchers.is("one") + "should be 'one'", array.get(0).asText(), Matchers.is("one") ); MatcherAssert.assertThat( - array.get(1).asText(), Matchers.is("two") + "should be 'one'", array.get(1).asText(), Matchers.is("two") ); } @@ -203,6 +203,7 @@ void invalidJsonObjectErrorIsLeftToJackson() throws IOException { .withBody("{\"anInvalidObjectTest\":{}") .fetch().as(JacksonResponse.class); MatcherAssert.assertThat( + "should contains error 'Unexpected end-of-input: expected close marker for Object", Assertions.assertThrows( IOException.class, new Executable() { From b0d23a77d60c4bfaac1635e80babac714da568c9 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 11 Dec 2024 17:43:06 +0300 Subject: [PATCH 060/112] fix quality violations --- src/test/java/com/jcabi/http/response/JacksonResponseTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/response/JacksonResponseTest.java b/src/test/java/com/jcabi/http/response/JacksonResponseTest.java index c78ea4e8..65ad43ff 100644 --- a/src/test/java/com/jcabi/http/response/JacksonResponseTest.java +++ b/src/test/java/com/jcabi/http/response/JacksonResponseTest.java @@ -232,6 +232,7 @@ void cannotReadJsonAsObjectIfNotOne() throws IOException { final JacksonResponse response = new FakeRequest() .withBody(body).fetch().as(JacksonResponse.class); MatcherAssert.assertThat( + "should contains error 'Cannot read as an object. The JSON is not a valid object.", Assertions.assertThrows( IOException.class, new Executable() { From 1c9c75a4dff7fd285819e8ce88fa78a4fb715036 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 11 Dec 2024 17:49:28 +0300 Subject: [PATCH 061/112] fix quality violations --- src/test/java/com/jcabi/http/response/JacksonResponseTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/response/JacksonResponseTest.java b/src/test/java/com/jcabi/http/response/JacksonResponseTest.java index 65ad43ff..a67f6aed 100644 --- a/src/test/java/com/jcabi/http/response/JacksonResponseTest.java +++ b/src/test/java/com/jcabi/http/response/JacksonResponseTest.java @@ -262,7 +262,7 @@ void canReadAsObjectIfOne() throws IOException { .fetch().as(JacksonResponse.class); final ObjectNode object = response.json().readObject(); MatcherAssert.assertThat( - object.get("hooray").asText(), Matchers.is("Got milk?") + "should contains 'Got milk?", object.get("hooray").asText(), Matchers.is("Got milk?") ); } } From 46bcb72e0eb1a24cd860bb4da4aba8cc73234404 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 11 Dec 2024 17:55:54 +0300 Subject: [PATCH 062/112] fix quality violations --- src/test/java/com/jcabi/http/response/RestResponseITCase.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/response/RestResponseITCase.java b/src/test/java/com/jcabi/http/response/RestResponseITCase.java index b5972ec3..a8f622d2 100644 --- a/src/test/java/com/jcabi/http/response/RestResponseITCase.java +++ b/src/test/java/com/jcabi/http/response/RestResponseITCase.java @@ -55,6 +55,7 @@ void readsCookiesSeveralValues() throws IOException { @Override public void execute() { MatcherAssert.assertThat( + "should contains value 'efg", resp.cookie("ijk"), Matchers.hasProperty("value", Matchers.is("efg")) ); From 8ce71cc9f3e7795f72aa66e978f81413c159f337 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 11 Dec 2024 17:55:57 +0300 Subject: [PATCH 063/112] fix quality violations --- src/test/java/com/jcabi/http/response/RestResponseITCase.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/response/RestResponseITCase.java b/src/test/java/com/jcabi/http/response/RestResponseITCase.java index a8f622d2..81059027 100644 --- a/src/test/java/com/jcabi/http/response/RestResponseITCase.java +++ b/src/test/java/com/jcabi/http/response/RestResponseITCase.java @@ -65,6 +65,7 @@ public void execute() { @Override public void execute() { MatcherAssert.assertThat( + "should contains value 'abc", resp.cookie("xyz"), Matchers.hasProperty("value", Matchers.is("abc")) ); From 0e659ba634104191eb6a7abc13c42e750efa3f49 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 11 Dec 2024 17:55:59 +0300 Subject: [PATCH 064/112] fix quality violations --- src/test/java/com/jcabi/http/response/RestResponseITCase.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/response/RestResponseITCase.java b/src/test/java/com/jcabi/http/response/RestResponseITCase.java index 81059027..a8ec2194 100644 --- a/src/test/java/com/jcabi/http/response/RestResponseITCase.java +++ b/src/test/java/com/jcabi/http/response/RestResponseITCase.java @@ -77,6 +77,7 @@ public void execute() { @Test void readsCookies() throws IOException { MatcherAssert.assertThat( + "should contains value 'bar", new JdkRequest("https://httpbin.org/cookies/set?foo=bar") .fetch() .as(RestResponse.class) From ee8222e13062d2d0526710a145720fc5fbdc4d99 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 11 Dec 2024 19:43:10 +0300 Subject: [PATCH 065/112] fix quality violations --- src/test/java/com/jcabi/http/response/RestResponseITCase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/response/RestResponseITCase.java b/src/test/java/com/jcabi/http/response/RestResponseITCase.java index a8ec2194..32675a2c 100644 --- a/src/test/java/com/jcabi/http/response/RestResponseITCase.java +++ b/src/test/java/com/jcabi/http/response/RestResponseITCase.java @@ -55,7 +55,7 @@ void readsCookiesSeveralValues() throws IOException { @Override public void execute() { MatcherAssert.assertThat( - "should contains value 'efg", + "should contains value 'efg'", resp.cookie("ijk"), Matchers.hasProperty("value", Matchers.is("efg")) ); From a7cac5cd5353b0be714f01fcc3f7cb16af429a28 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 11 Dec 2024 20:04:12 +0300 Subject: [PATCH 066/112] fix quality violations --- src/test/java/com/jcabi/http/response/RestResponseTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/java/com/jcabi/http/response/RestResponseTest.java b/src/test/java/com/jcabi/http/response/RestResponseTest.java index 6ff67bcb..31196640 100644 --- a/src/test/java/com/jcabi/http/response/RestResponseTest.java +++ b/src/test/java/com/jcabi/http/response/RestResponseTest.java @@ -107,6 +107,7 @@ void retrievesCookieByName() throws Exception { .fetch() ); MatcherAssert.assertThat( + "should contains value & path", response.cookie("cookie1"), Matchers.allOf( Matchers.hasProperty("value", Matchers.equalTo("foo1")), @@ -129,6 +130,7 @@ void retrievesCookieByNameSeveralValues() throws Exception { .fetch() ); MatcherAssert.assertThat( + "should contains value & path", response.cookie("baz"), Matchers.allOf( Matchers.hasProperty("value", Matchers.equalTo("goo")), @@ -136,6 +138,7 @@ void retrievesCookieByNameSeveralValues() throws Exception { ) ); MatcherAssert.assertThat( + "should contains value & path", response.cookie("foo"), Matchers.allOf( Matchers.hasProperty("value", Matchers.equalTo("bar")), @@ -151,6 +154,7 @@ void retrievesCookieByNameSeveralValues() throws Exception { @Test void jumpsToRelativeUrls() throws Exception { MatcherAssert.assertThat( + "should contains value & path", new RestResponse( new FakeRequest() .uri().set(new URI("http://locahost:888/tt")).back() From 7b16fd3698d407ab995cb9b13c73997d834523a7 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Fri, 13 Dec 2024 01:08:45 +0300 Subject: [PATCH 067/112] fix quality violations --- src/test/java/com/jcabi/http/response/RestResponseITCase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/jcabi/http/response/RestResponseITCase.java b/src/test/java/com/jcabi/http/response/RestResponseITCase.java index 32675a2c..11765b65 100644 --- a/src/test/java/com/jcabi/http/response/RestResponseITCase.java +++ b/src/test/java/com/jcabi/http/response/RestResponseITCase.java @@ -65,7 +65,7 @@ public void execute() { @Override public void execute() { MatcherAssert.assertThat( - "should contains value 'abc", + "should contains value 'abc'", resp.cookie("xyz"), Matchers.hasProperty("value", Matchers.is("abc")) ); @@ -77,7 +77,7 @@ public void execute() { @Test void readsCookies() throws IOException { MatcherAssert.assertThat( - "should contains value 'bar", + "should contains value 'bar'", new JdkRequest("https://httpbin.org/cookies/set?foo=bar") .fetch() .as(RestResponse.class) From 3be200566ade09905e8d2c3e06cc160619d12667 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Fri, 13 Dec 2024 01:11:54 +0300 Subject: [PATCH 068/112] fix quality violations --- .../java/com/jcabi/http/response/WebLinkingResponseTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/test/java/com/jcabi/http/response/WebLinkingResponseTest.java b/src/test/java/com/jcabi/http/response/WebLinkingResponseTest.java index 78f57bac..48cc0bc3 100644 --- a/src/test/java/com/jcabi/http/response/WebLinkingResponseTest.java +++ b/src/test/java/com/jcabi/http/response/WebLinkingResponseTest.java @@ -65,14 +65,17 @@ void parsesLinksInHeaders() throws Exception { ); final WebLinkingResponse.Link link = response.links().get("foo"); MatcherAssert.assertThat( + "should contains '/hey/foo'", link.uri(), Matchers.hasToString("/hey/foo") ); MatcherAssert.assertThat( + "should contains key 'title'", link, Matchers.hasKey("title") ); MatcherAssert.assertThat( + "should not contains key 'something else'", response.links(), Matchers.not(Matchers.hasKey("something else")) ); @@ -92,10 +95,12 @@ void followsLinksInHeaders() throws Exception { ).uri().set(new URI("http://localhost/test")).back().fetch() ); MatcherAssert.assertThat( + "should equals 'http://localhost/a'", response.follow("first").uri().get(), Matchers.equalTo(new URI("http://localhost/a")) ); MatcherAssert.assertThat( + "should equals 'http://localhost/o'", response.follow("second").uri().get(), Matchers.equalTo(new URI("http://localhost/o")) ); From c6e6ce7393fc1df255069f554db98141887a0630 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Mon, 16 Dec 2024 02:15:48 +0300 Subject: [PATCH 069/112] fix quality violations --- src/test/java/com/jcabi/http/response/JsoupResponseTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/response/JsoupResponseTest.java b/src/test/java/com/jcabi/http/response/JsoupResponseTest.java index b79763bf..0913a637 100644 --- a/src/test/java/com/jcabi/http/response/JsoupResponseTest.java +++ b/src/test/java/com/jcabi/http/response/JsoupResponseTest.java @@ -57,6 +57,7 @@ void normalizesHtml() throws Exception { ) ).fetch(); MatcherAssert.assertThat( + "should contains normalized response", new JsoupResponse(resp).body(), XhtmlMatchers.hasXPaths( "/xhtml:html/xhtml:head", From 3db0ae7b0dce149d8dc22a8211193f999563d81c Mon Sep 17 00:00:00 2001 From: uchitsa Date: Mon, 16 Dec 2024 02:46:51 +0300 Subject: [PATCH 070/112] fix quality violations --- src/test/java/com/jcabi/http/response/JsonResponseTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/response/JsonResponseTest.java b/src/test/java/com/jcabi/http/response/JsonResponseTest.java index 9a0f50b4..b19f1a34 100644 --- a/src/test/java/com/jcabi/http/response/JsonResponseTest.java +++ b/src/test/java/com/jcabi/http/response/JsonResponseTest.java @@ -55,6 +55,7 @@ void readsJsonDocument() throws Exception { .fetch(); final JsonResponse response = new JsonResponse(resp); MatcherAssert.assertThat( + "should be equal 2", response.json().readObject().getInt("foo-foo"), Matchers.equalTo(2) ); From 89cbe2e330f3592276aae9648043202713ffc655 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Mon, 16 Dec 2024 02:46:54 +0300 Subject: [PATCH 071/112] fix quality violations --- src/test/java/com/jcabi/http/response/JsonResponseTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/response/JsonResponseTest.java b/src/test/java/com/jcabi/http/response/JsonResponseTest.java index b19f1a34..1c7a4a0b 100644 --- a/src/test/java/com/jcabi/http/response/JsonResponseTest.java +++ b/src/test/java/com/jcabi/http/response/JsonResponseTest.java @@ -60,6 +60,7 @@ void readsJsonDocument() throws Exception { Matchers.equalTo(2) ); MatcherAssert.assertThat( + "should be equal \u20ac", response.json().readObject().getString("bar"), Matchers.equalTo("\u20ac") ); From c44bcb7c301cf163ddb35aef9ae23661ed76b5d2 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Mon, 16 Dec 2024 02:46:57 +0300 Subject: [PATCH 072/112] fix quality violations --- src/test/java/com/jcabi/http/response/JsonResponseTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/response/JsonResponseTest.java b/src/test/java/com/jcabi/http/response/JsonResponseTest.java index 1c7a4a0b..4304bbd2 100644 --- a/src/test/java/com/jcabi/http/response/JsonResponseTest.java +++ b/src/test/java/com/jcabi/http/response/JsonResponseTest.java @@ -77,6 +77,7 @@ void readsControlCharacters() throws Exception { .withBody("{\"test\":\n\"\u001Fblah\uFFFDcwhoa\u0000!\"}").fetch(); final JsonResponse response = new JsonResponse(resp); MatcherAssert.assertThat( + "should be \u001Fblah\uFFFDcwhoa\u0000!", response.json().readObject().getString("test"), Matchers.is("\u001Fblah\uFFFDcwhoa\u0000!") ); From b1469986f5ae3256dc2dd6e28ee14989df7c1fdd Mon Sep 17 00:00:00 2001 From: uchitsa Date: Mon, 16 Dec 2024 02:46:59 +0300 Subject: [PATCH 073/112] fix quality violations --- src/test/java/com/jcabi/http/response/JsonResponseTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/response/JsonResponseTest.java b/src/test/java/com/jcabi/http/response/JsonResponseTest.java index 4304bbd2..4bd0c500 100644 --- a/src/test/java/com/jcabi/http/response/JsonResponseTest.java +++ b/src/test/java/com/jcabi/http/response/JsonResponseTest.java @@ -93,6 +93,7 @@ void logsForInvalidJsonObject() throws Exception { final String body = "{\"test\": \"logged!\"$@%#^&%@$#}"; final Response resp = new FakeRequest().withBody(body).fetch(); MatcherAssert.assertThat( + "should contains json body", Assertions.assertThrows( JsonParsingException.class, new Executable() { From ddecd6e7faca62cfc612b58bf2278730ac2ba7b8 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Mon, 16 Dec 2024 02:47:02 +0300 Subject: [PATCH 074/112] fix quality violations --- src/test/java/com/jcabi/http/response/JsonResponseTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/response/JsonResponseTest.java b/src/test/java/com/jcabi/http/response/JsonResponseTest.java index 4bd0c500..fdcec8f7 100644 --- a/src/test/java/com/jcabi/http/response/JsonResponseTest.java +++ b/src/test/java/com/jcabi/http/response/JsonResponseTest.java @@ -118,6 +118,7 @@ void logsForInvalidJsonArray() throws Exception { final String body = "[\"test\": \"logged!\"$@%#^&%@$#]"; final Response resp = new FakeRequest().withBody(body).fetch(); MatcherAssert.assertThat( + "should contains json body", Assertions.assertThrows( JsonParsingException.class, new Executable() { From 3df27a974614aee6da547c0071cf2995fb6fe405 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Mon, 16 Dec 2024 02:47:04 +0300 Subject: [PATCH 075/112] fix quality violations --- src/test/java/com/jcabi/http/response/JsonResponseTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/response/JsonResponseTest.java b/src/test/java/com/jcabi/http/response/JsonResponseTest.java index fdcec8f7..99c794b1 100644 --- a/src/test/java/com/jcabi/http/response/JsonResponseTest.java +++ b/src/test/java/com/jcabi/http/response/JsonResponseTest.java @@ -147,6 +147,7 @@ void logsForInvalidJson() throws Exception { final String body = "{test:[]}}}"; final Response resp = new FakeRequest().withBody(body).fetch(); MatcherAssert.assertThat( + "should contains json body", Assertions.assertThrows( JsonParsingException.class, new Executable() { From 7eb33ffed5bea88aee56da706dcf35afaf4c1a6f Mon Sep 17 00:00:00 2001 From: uchitsa Date: Mon, 16 Dec 2024 02:56:52 +0300 Subject: [PATCH 076/112] fix quality violations --- src/test/java/com/jcabi/http/response/XmlResponseTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/response/XmlResponseTest.java b/src/test/java/com/jcabi/http/response/XmlResponseTest.java index 33d1a4c3..94f92d8d 100644 --- a/src/test/java/com/jcabi/http/response/XmlResponseTest.java +++ b/src/test/java/com/jcabi/http/response/XmlResponseTest.java @@ -57,6 +57,7 @@ void findsDocumentNodesWithXpath() throws Exception { .fetch() ); MatcherAssert.assertThat( + "should be equal 2", response.xml().xpath("//a/text()"), Matchers.hasSize(2) ); From 7ffd91142c8e5aee1035416bae426b09cdefc069 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Mon, 16 Dec 2024 02:56:54 +0300 Subject: [PATCH 077/112] fix quality violations --- src/test/java/com/jcabi/http/response/XmlResponseTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/response/XmlResponseTest.java b/src/test/java/com/jcabi/http/response/XmlResponseTest.java index 94f92d8d..cc163be5 100644 --- a/src/test/java/com/jcabi/http/response/XmlResponseTest.java +++ b/src/test/java/com/jcabi/http/response/XmlResponseTest.java @@ -62,6 +62,7 @@ void findsDocumentNodesWithXpath() throws Exception { Matchers.hasSize(2) ); MatcherAssert.assertThat( + "should contains '\u0443\u0440\u0430'", response.xml().xpath("/r/a/text()"), Matchers.hasItem("\u0443\u0440\u0430!") ); From d3ff913cae8235f72a9540c648a84b7696a2dfa4 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Mon, 16 Dec 2024 02:56:57 +0300 Subject: [PATCH 078/112] fix quality violations --- src/test/java/com/jcabi/http/response/XmlResponseTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/response/XmlResponseTest.java b/src/test/java/com/jcabi/http/response/XmlResponseTest.java index cc163be5..daa6fcbb 100644 --- a/src/test/java/com/jcabi/http/response/XmlResponseTest.java +++ b/src/test/java/com/jcabi/http/response/XmlResponseTest.java @@ -114,6 +114,7 @@ void assertsWithXpathWithCustomNamespace() throws Exception { ).registerNs("foo", "urn:foo"); final XML xml = response.xml(); MatcherAssert.assertThat( + "should be equal to 'yes!'", xml.xpath("//foo:b/text()").get(0), Matchers.equalTo("yes!") ); From fdb1cf1188a867933beb864c32f53b90d3b14e78 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Mon, 16 Dec 2024 02:57:00 +0300 Subject: [PATCH 079/112] fix quality violations --- src/test/java/com/jcabi/http/response/XmlResponseTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/response/XmlResponseTest.java b/src/test/java/com/jcabi/http/response/XmlResponseTest.java index daa6fcbb..acd6bd21 100644 --- a/src/test/java/com/jcabi/http/response/XmlResponseTest.java +++ b/src/test/java/com/jcabi/http/response/XmlResponseTest.java @@ -119,6 +119,7 @@ void assertsWithXpathWithCustomNamespace() throws Exception { Matchers.equalTo("yes!") ); MatcherAssert.assertThat( + "should be empty", xml.nodes("/foo:a/foo:b"), Matchers.not(Matchers.empty()) ); From dcf2bd9a6e6b5b2b3b64465bedd41622f7106a14 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Mon, 16 Dec 2024 02:57:03 +0300 Subject: [PATCH 080/112] fix quality violations --- src/test/java/com/jcabi/http/response/XmlResponseTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/response/XmlResponseTest.java b/src/test/java/com/jcabi/http/response/XmlResponseTest.java index acd6bd21..a10c2026 100644 --- a/src/test/java/com/jcabi/http/response/XmlResponseTest.java +++ b/src/test/java/com/jcabi/http/response/XmlResponseTest.java @@ -137,6 +137,7 @@ void findsDocumentNodesWithXpathAndReturnsThem() throws Exception { .fetch() ); MatcherAssert.assertThat( + "should be equal 2", response.xml().nodes("//a"), Matchers.hasSize(2) ); From f42da8ba6e9e063a094519eea6d172f2869b640a Mon Sep 17 00:00:00 2001 From: uchitsa Date: Mon, 16 Dec 2024 02:57:06 +0300 Subject: [PATCH 081/112] fix quality violations --- src/test/java/com/jcabi/http/response/XmlResponseTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/response/XmlResponseTest.java b/src/test/java/com/jcabi/http/response/XmlResponseTest.java index a10c2026..9d554388 100644 --- a/src/test/java/com/jcabi/http/response/XmlResponseTest.java +++ b/src/test/java/com/jcabi/http/response/XmlResponseTest.java @@ -142,6 +142,7 @@ void findsDocumentNodesWithXpathAndReturnsThem() throws Exception { Matchers.hasSize(2) ); MatcherAssert.assertThat( + "should be equal 1", response.xml().nodes("/root/a").get(0).xpath("x/text()").get(0), Matchers.equalTo("1") ); From 38f2c2dea428cf6770e48137635ff178d3b42110 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 17 Dec 2024 01:11:16 +0300 Subject: [PATCH 082/112] fix quality violations --- src/test/java/com/jcabi/http/wire/RetryWireTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/wire/RetryWireTest.java b/src/test/java/com/jcabi/http/wire/RetryWireTest.java index d0befe7e..bebe5dd4 100644 --- a/src/test/java/com/jcabi/http/wire/RetryWireTest.java +++ b/src/test/java/com/jcabi/http/wire/RetryWireTest.java @@ -94,6 +94,7 @@ void stripsUserInfoWhenLogging() throws Exception { .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); MatcherAssert.assertThat( + "should strips user info", appender.list, Matchers.hasItem( Matchers.hasProperty( From b57bc8d46647a566515eff1407c2f56446b7eaa0 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 17 Dec 2024 01:11:28 +0300 Subject: [PATCH 083/112] fix quality violations --- src/test/java/com/jcabi/http/wire/FcWireTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/wire/FcWireTest.java b/src/test/java/com/jcabi/http/wire/FcWireTest.java index da91f670..0a3c65f7 100644 --- a/src/test/java/com/jcabi/http/wire/FcWireTest.java +++ b/src/test/java/com/jcabi/http/wire/FcWireTest.java @@ -62,7 +62,7 @@ void cachesGetRequest() throws Exception { .assertStatus(HttpURLConnection.HTTP_OK); } container.stop(); - MatcherAssert.assertThat(container.queries(), Matchers.equalTo(1)); + MatcherAssert.assertThat("should be equal 1", container.queries(), Matchers.equalTo(1)); } /** From ff8b761062ab569c9a61b68fd967901a393e9791 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 17 Dec 2024 01:11:31 +0300 Subject: [PATCH 084/112] fix quality violations --- src/test/java/com/jcabi/http/wire/FcWireTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/wire/FcWireTest.java b/src/test/java/com/jcabi/http/wire/FcWireTest.java index 0a3c65f7..fb84724c 100644 --- a/src/test/java/com/jcabi/http/wire/FcWireTest.java +++ b/src/test/java/com/jcabi/http/wire/FcWireTest.java @@ -82,7 +82,7 @@ void ignoresPutRequest() throws Exception { .assertStatus(HttpURLConnection.HTTP_OK); } container.stop(); - MatcherAssert.assertThat(container.queries(), Matchers.equalTo(2)); + MatcherAssert.assertThat("should be equal 2", container.queries(), Matchers.equalTo(2)); } /** From 5a29c2d29902b63c84325fef09fffec108cbe590 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 17 Dec 2024 01:11:35 +0300 Subject: [PATCH 085/112] fix quality violations --- src/test/java/com/jcabi/http/wire/FcWireTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/wire/FcWireTest.java b/src/test/java/com/jcabi/http/wire/FcWireTest.java index fb84724c..31c7daad 100644 --- a/src/test/java/com/jcabi/http/wire/FcWireTest.java +++ b/src/test/java/com/jcabi/http/wire/FcWireTest.java @@ -111,6 +111,7 @@ void flushesOnRegularExpressionMatch() throws Exception { .assertBody(Matchers.containsString("third")); container.stop(); MatcherAssert.assertThat( + "should be equal 3", container.queries(), Matchers.equalTo(3) ); From d51d486811d79689b08cf131b7c8128665377482 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 17 Dec 2024 01:16:43 +0300 Subject: [PATCH 086/112] fix quality violations --- src/test/java/com/jcabi/http/wire/CookieOptimizingWireTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/wire/CookieOptimizingWireTest.java b/src/test/java/com/jcabi/http/wire/CookieOptimizingWireTest.java index 8d1686f9..9942943c 100644 --- a/src/test/java/com/jcabi/http/wire/CookieOptimizingWireTest.java +++ b/src/test/java/com/jcabi/http/wire/CookieOptimizingWireTest.java @@ -73,6 +73,7 @@ void transfersCookiesOnFollow() throws Exception { container.take(); final MkQuery query = container.take(); MatcherAssert.assertThat( + "should be size 1", query.headers().get(HttpHeaders.COOKIE), Matchers.hasSize(1) ); From 624560391e690762e7e4f16a366e509162374fd5 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 17 Dec 2024 01:20:29 +0300 Subject: [PATCH 087/112] fix quality violations --- src/test/java/com/jcabi/http/wire/VerboseWireTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/wire/VerboseWireTest.java b/src/test/java/com/jcabi/http/wire/VerboseWireTest.java index eb763a88..b5ea1035 100644 --- a/src/test/java/com/jcabi/http/wire/VerboseWireTest.java +++ b/src/test/java/com/jcabi/http/wire/VerboseWireTest.java @@ -85,6 +85,7 @@ void logsRequestBody() throws Exception { .assertStatus(HttpURLConnection.HTTP_OK); final MkQuery query = container.take(); MatcherAssert.assertThat( + "should starts with 'hello,'", query.body(), Matchers.startsWith("hello,") ); From fcb50e99cae4a728ee685bb632293aac96f8b764 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 17 Dec 2024 01:20:35 +0300 Subject: [PATCH 088/112] fix quality violations --- .../java/com/jcabi/http/wire/CookieOptimizingWireTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/java/com/jcabi/http/wire/CookieOptimizingWireTest.java b/src/test/java/com/jcabi/http/wire/CookieOptimizingWireTest.java index 9942943c..ffc4fd56 100644 --- a/src/test/java/com/jcabi/http/wire/CookieOptimizingWireTest.java +++ b/src/test/java/com/jcabi/http/wire/CookieOptimizingWireTest.java @@ -78,6 +78,7 @@ void transfersCookiesOnFollow() throws Exception { Matchers.hasSize(1) ); MatcherAssert.assertThat( + "should contains 3 items", query.headers(), Matchers.hasEntry( Matchers.equalTo(HttpHeaders.COOKIE), @@ -119,10 +120,12 @@ void avoidsTransferringOfEmptyCookiesOnFollow() throws Exception { container.take(); final MkQuery query = container.take(); MatcherAssert.assertThat( + "should be size 1", query.headers().get(HttpHeaders.COOKIE), Matchers.hasSize(1) ); MatcherAssert.assertThat( + "should contains 2 items & not contains 1 item", query.headers(), Matchers.hasEntry( Matchers.equalTo(HttpHeaders.COOKIE), From 91ce6870b49ff479922630fea680b7d99b1c9621 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 17 Dec 2024 01:52:16 +0300 Subject: [PATCH 089/112] fix quality violations --- src/test/java/com/jcabi/http/wire/CachingWireTest.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/test/java/com/jcabi/http/wire/CachingWireTest.java b/src/test/java/com/jcabi/http/wire/CachingWireTest.java index 26123658..0f30a23b 100644 --- a/src/test/java/com/jcabi/http/wire/CachingWireTest.java +++ b/src/test/java/com/jcabi/http/wire/CachingWireTest.java @@ -67,7 +67,7 @@ void cachesGetRequest() throws Exception { .assertStatus(HttpURLConnection.HTTP_OK); } container.stop(); - MatcherAssert.assertThat(container.queries(), Matchers.equalTo(1)); + MatcherAssert.assertThat("should be equal 1", container.queries(), Matchers.equalTo(1)); } /** @@ -87,7 +87,7 @@ void ignoresPutRequest() throws Exception { .assertStatus(HttpURLConnection.HTTP_OK); } container.stop(); - MatcherAssert.assertThat(container.queries(), Matchers.equalTo(2)); + MatcherAssert.assertThat("should be equal 1", container.queries(), Matchers.equalTo(2)); } /** @@ -116,6 +116,7 @@ void flushesOnRegularExpressionMatch() throws Exception { .assertBody(Matchers.containsString("third")); container.stop(); MatcherAssert.assertThat( + "should be equal 3", container.queries(), Matchers.equalTo(3) ); @@ -151,7 +152,7 @@ public Response load(final Callable query) .assertStatus(HttpURLConnection.HTTP_OK); } container.stop(); - MatcherAssert.assertThat(container.queries(), Matchers.equalTo(1)); + MatcherAssert.assertThat("should be equal 1", container.queries(), Matchers.equalTo(1)); } } From 3bb65a1d694fea674b44e8b6cbc72f4ab218464d Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 17 Dec 2024 01:56:46 +0300 Subject: [PATCH 090/112] fix quality violations --- .../com/jcabi/http/wire/LastModifiedCachingWireTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/com/jcabi/http/wire/LastModifiedCachingWireTest.java b/src/test/java/com/jcabi/http/wire/LastModifiedCachingWireTest.java index 0422977c..5d7f4d53 100644 --- a/src/test/java/com/jcabi/http/wire/LastModifiedCachingWireTest.java +++ b/src/test/java/com/jcabi/http/wire/LastModifiedCachingWireTest.java @@ -90,7 +90,7 @@ void requestWithoutHeaderPassed() throws Exception { req.fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .assertBody(Matchers.equalTo(LastModifiedCachingWireTest.BODY)); - MatcherAssert.assertThat(container.queries(), Matchers.equalTo(1)); + MatcherAssert.assertThat("should be equal 1", container.queries(), Matchers.equalTo(1)); } finally { container.stop(); } @@ -133,7 +133,7 @@ void cachesGetRequest() throws Exception { ); } MatcherAssert.assertThat( - container.queries(), Matchers.equalTo(count) + "should be equal to count", container.queries(), Matchers.equalTo(count) ); } finally { container.stop(); @@ -314,7 +314,7 @@ void cacheUpdateNewerResponse() throws Exception { ); } MatcherAssert.assertThat( - container.queries(), Matchers.equalTo(2 + 2) + "should be equal 4", container.queries(), Matchers.equalTo(2 + 2) ); } finally { container.stop(); @@ -355,7 +355,7 @@ void sendsRequestDirectly() throws Exception { Matchers.equalTo(LastModifiedCachingWireTest.BODY) ); } - MatcherAssert.assertThat(container.queries(), Matchers.equalTo(2)); + MatcherAssert.assertThat("should be eq 2", container.queries(), Matchers.equalTo(2)); } finally { container.stop(); } From 9ebe26f71fc1f9f8f95c8e6dc8137d18f7bd1a4a Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 17 Dec 2024 20:14:46 +0300 Subject: [PATCH 091/112] fix quality violations --- .../java/com/jcabi/http/wire/LastModifiedCachingWireTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/wire/LastModifiedCachingWireTest.java b/src/test/java/com/jcabi/http/wire/LastModifiedCachingWireTest.java index 5d7f4d53..f0533b0f 100644 --- a/src/test/java/com/jcabi/http/wire/LastModifiedCachingWireTest.java +++ b/src/test/java/com/jcabi/http/wire/LastModifiedCachingWireTest.java @@ -133,7 +133,7 @@ void cachesGetRequest() throws Exception { ); } MatcherAssert.assertThat( - "should be equal to count", container.queries(), Matchers.equalTo(count) + "should be equal to count", container.queries(), Matchers.equalTo(count) ); } finally { container.stop(); From 7d1c742b20872b0489fb2e26fc4e532f37c5a5d5 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 17 Dec 2024 20:14:55 +0300 Subject: [PATCH 092/112] fix quality violations --- src/test/java/com/jcabi/http/wire/AutoRedirectingWireTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/java/com/jcabi/http/wire/AutoRedirectingWireTest.java b/src/test/java/com/jcabi/http/wire/AutoRedirectingWireTest.java index 58d33ede..78ea9548 100644 --- a/src/test/java/com/jcabi/http/wire/AutoRedirectingWireTest.java +++ b/src/test/java/com/jcabi/http/wire/AutoRedirectingWireTest.java @@ -70,6 +70,7 @@ void retriesForHttpRedirectStatus() throws Exception { .fetch().as(RestResponse.class) .assertStatus(HttpStatus.SC_MOVED_TEMPORARILY); MatcherAssert.assertThat( + "should retries 3 times", container.takeAll(Matchers.any(MkAnswer.class)), Matchers.iterableWithSize(retries) ); @@ -99,6 +100,7 @@ void returnsValidResponseAfterRetry() throws Exception { .assertBody(Matchers.is(body)) .assertStatus(HttpStatus.SC_OK); MatcherAssert.assertThat( + "should retries 3 times", container.takeAll(Matchers.any(MkAnswer.class)), Matchers.iterableWithSize(3) ); From 5eca48e042cefd78a92a168e789e0b70ddcd49ca Mon Sep 17 00:00:00 2001 From: uchitsa Date: Tue, 24 Dec 2024 19:56:15 +0300 Subject: [PATCH 093/112] fix quality violations --- src/test/java/com/jcabi/http/wire/BasicAuthWireTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/java/com/jcabi/http/wire/BasicAuthWireTest.java b/src/test/java/com/jcabi/http/wire/BasicAuthWireTest.java index 8031898a..46b74cf2 100644 --- a/src/test/java/com/jcabi/http/wire/BasicAuthWireTest.java +++ b/src/test/java/com/jcabi/http/wire/BasicAuthWireTest.java @@ -100,6 +100,7 @@ void testHeader( .assertStatus(HttpURLConnection.HTTP_OK); container.stop(); MatcherAssert.assertThat( + "should be correct header", container.take().headers().get(HttpHeaders.AUTHORIZATION).get(0), Matchers.equalTo(expected) ); @@ -125,6 +126,7 @@ void shouldStripUserInfo() throws Exception { userinfo ).build(); MatcherAssert.assertThat( + "should not contains user info", Assertions.assertThrows( AssertionError.class, new Executable() { From 6b10ef8ea6dade6ee18994fd3ce15d5b4d623651 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 25 Dec 2024 02:03:51 +0300 Subject: [PATCH 094/112] fix quality violations --- src/test/java/com/jcabi/http/wire/BasicAuthWireITCase.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/wire/BasicAuthWireITCase.java b/src/test/java/com/jcabi/http/wire/BasicAuthWireITCase.java index c000c182..1192c942 100644 --- a/src/test/java/com/jcabi/http/wire/BasicAuthWireITCase.java +++ b/src/test/java/com/jcabi/http/wire/BasicAuthWireITCase.java @@ -52,6 +52,7 @@ void basicAuthWorks() throws IOException { .fetch() .as(XmlResponse.class); MatcherAssert.assertThat( + "should be success", res.body(), Matchers.containsString("Success!") ); From cd0417675edeec77518c08899a0bf8e0832e30e6 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 25 Dec 2024 02:03:56 +0300 Subject: [PATCH 095/112] fix quality violations --- src/test/java/com/jcabi/http/mock/MkAnswerMatchersTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/java/com/jcabi/http/mock/MkAnswerMatchersTest.java b/src/test/java/com/jcabi/http/mock/MkAnswerMatchersTest.java index 8158ad58..0a51679b 100644 --- a/src/test/java/com/jcabi/http/mock/MkAnswerMatchersTest.java +++ b/src/test/java/com/jcabi/http/mock/MkAnswerMatchersTest.java @@ -50,6 +50,7 @@ void canMatchBody() { final MkAnswer query = Mockito.mock(MkAnswer.class); Mockito.doReturn(body).when(query).body(); MatcherAssert.assertThat( + "should match the answer body", query, MkAnswerMatchers.hasBody( Matchers.is(body) @@ -66,6 +67,7 @@ void canMatchBodyBytes() { final MkAnswer query = Mockito.mock(MkAnswer.class); Mockito.doReturn(body).when(query).bodyBytes(); MatcherAssert.assertThat( + "should match the answer body bytes", query, MkAnswerMatchers.hasBodyBytes( Matchers.is(body) @@ -85,6 +87,7 @@ void canMatchHeader() { Collections.singletonMap(header, Collections.singletonList(value)) ).when(query).headers(); MatcherAssert.assertThat( + "should match the answer header", query, MkAnswerMatchers.hasHeader( header, From 81feb4c2db2ca9635f623a111aa2a1cb96b8025e Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 25 Dec 2024 02:17:33 +0300 Subject: [PATCH 096/112] fix quality violations --- src/test/java/com/jcabi/http/mock/GrizzlyQueryTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/mock/GrizzlyQueryTest.java b/src/test/java/com/jcabi/http/mock/GrizzlyQueryTest.java index bbd48a5a..e00b5c1d 100644 --- a/src/test/java/com/jcabi/http/mock/GrizzlyQueryTest.java +++ b/src/test/java/com/jcabi/http/mock/GrizzlyQueryTest.java @@ -59,6 +59,7 @@ void returnsBinaryBody() throws Exception { new ByteArrayInputStream(body) ); MatcherAssert.assertThat( + "should match the body", new GrizzlyQuery(request).binary(), Matchers.is(body) ); From 44b88557c43b6895ec69ff7e95e07d6b0fa20f7f Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 25 Dec 2024 02:31:02 +0300 Subject: [PATCH 097/112] fix quality violations --- src/test/java/com/jcabi/http/mock/MkContainerTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/java/com/jcabi/http/mock/MkContainerTest.java b/src/test/java/com/jcabi/http/mock/MkContainerTest.java index 6224aa79..48f1a8a3 100644 --- a/src/test/java/com/jcabi/http/mock/MkContainerTest.java +++ b/src/test/java/com/jcabi/http/mock/MkContainerTest.java @@ -66,6 +66,7 @@ void worksAsServletContainer() throws Exception { .assertBody(Matchers.startsWith("works")); final MkQuery query = container.take(); MatcherAssert.assertThat( + "should be GET method", query.method(), Matchers.equalTo(Request.GET) ); @@ -89,6 +90,7 @@ void understandsDuplicateHeaders() throws Exception { .assertStatus(HttpURLConnection.HTTP_OK); final MkQuery query = container.take(); MatcherAssert.assertThat( + "should has size 2", query.headers().get(header), Matchers.hasSize(2) ); @@ -248,6 +250,7 @@ void takesMatchingQuery() throws Exception { .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); MatcherAssert.assertThat( + "should match the answer body", container.take(MkAnswerMatchers.hasBody(Matchers.is(response))), MkQueryMatchers.hasBody(Matchers.is(request)) ); @@ -286,6 +289,7 @@ void takesAllMatchingQueries() throws Exception { .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); MatcherAssert.assertThat( + "should match all bodies", container.takeAll( MkAnswerMatchers.hasBody(Matchers.is(response)) ), From 499193cb9f1566edd0bfd8fcf9c2a1896a30792d Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 25 Dec 2024 14:52:49 +0300 Subject: [PATCH 098/112] fix quality violations --- src/test/java/com/jcabi/http/mock/MkQueryMatchersTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/java/com/jcabi/http/mock/MkQueryMatchersTest.java b/src/test/java/com/jcabi/http/mock/MkQueryMatchersTest.java index db8ca107..a8ee101f 100644 --- a/src/test/java/com/jcabi/http/mock/MkQueryMatchersTest.java +++ b/src/test/java/com/jcabi/http/mock/MkQueryMatchersTest.java @@ -52,6 +52,7 @@ void canMatchBody() { final MkQuery query = Mockito.mock(MkQuery.class); Mockito.doReturn(body).when(query).body(); MatcherAssert.assertThat( + "should match the query body", query, MkQueryMatchers.hasBody( Matchers.is(body) @@ -71,6 +72,7 @@ void canMatchHeader() { Collections.singletonMap(header, Collections.singletonList(value)) ).when(query).headers(); MatcherAssert.assertThat( + "should match the query header", query, MkQueryMatchers.hasHeader( header, @@ -88,6 +90,7 @@ void canMatchPath() { final MkQuery query = Mockito.mock(MkQuery.class); Mockito.doReturn(body).when(query).uri(); MatcherAssert.assertThat( + "should match the raw path", query, MkQueryMatchers.hasPath( Matchers.is("/index.html") @@ -104,6 +107,7 @@ void canMatchQuery() { final MkQuery query = Mockito.mock(MkQuery.class); Mockito.doReturn(body).when(query).uri(); MatcherAssert.assertThat( + "should match the raw query", query, MkQueryMatchers.hasQuery( Matchers.is("x=10") From 736549c79febcd1abb7e0a89f5b626f0775dc0bf Mon Sep 17 00:00:00 2001 From: uchitsa Date: Thu, 26 Dec 2024 00:55:23 +0300 Subject: [PATCH 099/112] fix quality violations --- src/test/java/com/jcabi/http/request/JdkRequestITCase.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/java/com/jcabi/http/request/JdkRequestITCase.java b/src/test/java/com/jcabi/http/request/JdkRequestITCase.java index 1dc705f0..b7f04a84 100644 --- a/src/test/java/com/jcabi/http/request/JdkRequestITCase.java +++ b/src/test/java/com/jcabi/http/request/JdkRequestITCase.java @@ -60,6 +60,7 @@ void throwsDescriptiveException() { final String uri = "http://localhost:6789"; final String method = HttpMethod.POST; MatcherAssert.assertThat( + "should be error with a descriptive message", Assertions.assertThrows( IOException.class, new Executable() { @@ -86,6 +87,7 @@ public void execute() throws Throwable { void failsNoProtocolNoPort() { final String uri = "localhost"; MatcherAssert.assertThat( + "should be error with a descriptive message", Assertions.assertThrows( IOException.class, new Executable() { @@ -113,6 +115,7 @@ void failsWithPortButNoProtocol() { final String url = "test.com"; final String colon = ":"; MatcherAssert.assertThat( + "should be error with a descriptive message", Assertions.assertThrows( MalformedURLException.class, new Executable() { @@ -147,6 +150,7 @@ public void execute() throws Throwable { void failsMalformedEntirely() { final String uri = "bla bla url"; MatcherAssert.assertThat( + "should be error with a descriptive message", Assertions.assertThrows( IllegalArgumentException.class, new Executable() { From a06975bbfd85e758c0bcc0258fb66b6b7b067260 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Thu, 26 Dec 2024 00:55:48 +0300 Subject: [PATCH 100/112] fix quality violations --- src/test/java/com/jcabi/http/RequestITCase.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/java/com/jcabi/http/RequestITCase.java b/src/test/java/com/jcabi/http/RequestITCase.java index 3ae89224..2027e4dd 100644 --- a/src/test/java/com/jcabi/http/RequestITCase.java +++ b/src/test/java/com/jcabi/http/RequestITCase.java @@ -130,6 +130,7 @@ void handlesGet() throws Exception { .assertStatus(HttpURLConnection.HTTP_OK); final MkQuery query = container.take(); MatcherAssert.assertThat( + "should be 'GET'", query.method(), Matchers.is("GET") ); @@ -151,6 +152,7 @@ void handlesDelete() throws Exception { .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); MatcherAssert.assertThat( + "should be 'DELETE'", container.take().method(), Matchers.is("DELETE") ); @@ -176,10 +178,12 @@ void handlesDeleteWithBody() throws Exception { .json(); final MkQuery take = container.take(); MatcherAssert.assertThat( + "should be 'DELETE'", take.method(), Matchers.is("DELETE") ); MatcherAssert.assertThat( + "should be '{}'", take.body(), Matchers.is("{}") ); From 41e6e22c81d772b275888051fa68a42f5051d8b4 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Thu, 26 Dec 2024 16:41:38 +0300 Subject: [PATCH 101/112] fix quality violations --- src/test/java/com/jcabi/http/request/FakeRequestTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/java/com/jcabi/http/request/FakeRequestTest.java b/src/test/java/com/jcabi/http/request/FakeRequestTest.java index 1659557f..30d35bb4 100644 --- a/src/test/java/com/jcabi/http/request/FakeRequestTest.java +++ b/src/test/java/com/jcabi/http/request/FakeRequestTest.java @@ -90,6 +90,7 @@ void sendsHttpRequestAndProcessesHttpBinaryResponse() @Test void changesUri() throws Exception { MatcherAssert.assertThat( + "should ends with 'facebook.com/'", new FakeRequest() .uri().set(new URI("http://facebook.com")).back() .uri().get().toString(), @@ -104,6 +105,7 @@ void changesUri() throws Exception { @Test void changesUriInResponse() throws Exception { MatcherAssert.assertThat( + "should contains 'google.com'", new FakeRequest() .uri().set(new URI("http://google.com")).back() .fetch().back() @@ -163,6 +165,7 @@ void fakeRequestReturnsResponseBody() throws Exception { @Test void identifiesUniquely() { MatcherAssert.assertThat( + "should not equals", new FakeRequest().header("header-1", "value-1"), Matchers.not( Matchers.equalTo( @@ -171,6 +174,7 @@ void identifiesUniquely() { ) ); MatcherAssert.assertThat( + "should equals", new FakeRequest(), Matchers.equalTo(new FakeRequest()) ); From 58b40b5b55ae1d1c2e5ac27f9d3a0a90f6a4a76e Mon Sep 17 00:00:00 2001 From: uchitsa Date: Thu, 26 Dec 2024 18:42:33 +0300 Subject: [PATCH 102/112] fix quality violations --- src/test/java/com/jcabi/http/request/BaseRequestTest.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/test/java/com/jcabi/http/request/BaseRequestTest.java b/src/test/java/com/jcabi/http/request/BaseRequestTest.java index 2d62e93f..1b555f86 100644 --- a/src/test/java/com/jcabi/http/request/BaseRequestTest.java +++ b/src/test/java/com/jcabi/http/request/BaseRequestTest.java @@ -65,6 +65,7 @@ final class BaseRequestTest { void buildsDestinationUri() { final Wire wire = Mockito.mock(Wire.class); MatcherAssert.assertThat( + "should has the right destination URI", new BaseRequest(wire, "http://localhost:88/t/f") .uri().path("/bar").queryParam("u1", "\u20ac") .queryParams(new ArrayMap().with("u2", "")) @@ -82,6 +83,7 @@ void buildsDestinationUri() { void printsJsonInBody() { final Wire wire = Mockito.mock(Wire.class); MatcherAssert.assertThat( + "should equals to '{\"foo\":\"test 1\"}'", new BaseRequest(wire, "http://localhost:88/x").body().set( Json.createObjectBuilder().add("foo", "test 1").build() ).get(), @@ -96,6 +98,7 @@ void printsJsonInBody() { void includesPort() { final Wire wire = Mockito.mock(Wire.class); MatcherAssert.assertThat( + "should has 'http://localhost:8080/'", // @checkstyle MagicNumber (2 lines) new BaseRequest(wire, "http://localhost") .uri().port(8080).back().uri().get(), @@ -110,6 +113,7 @@ void includesPort() { void identifiesUniquely() { final Wire wire = Mockito.mock(Wire.class); MatcherAssert.assertThat( + "should not equals", new BaseRequest(wire, "").header("header-1", "value-1"), Matchers.not( Matchers.equalTo( @@ -118,6 +122,7 @@ void identifiesUniquely() { ) ); MatcherAssert.assertThat( + "should equals", new BaseRequest(wire, ""), Matchers.equalTo(new BaseRequest(wire, "")) ); @@ -131,6 +136,7 @@ void identifiesUniquely() { void exceptionWhenMissingContentType() { final Wire wire = Mockito.mock(Wire.class); MatcherAssert.assertThat( + "should be error when multipart-body without content-type", Assertions.assertThrows( IllegalStateException.class, new Executable() { @@ -158,6 +164,7 @@ public void execute() throws Throwable { void exceptionWhenMissingBoundary() { final Wire wire = Mockito.mock(Wire.class); MatcherAssert.assertThat( + "should be error when multipart-body without content-type", Assertions.assertThrows( IllegalStateException.class, new Executable() { @@ -197,6 +204,7 @@ void shouldHaveCorrectFormParameters() throws IOException { .method(Request.POST) .fetch(); MatcherAssert.assertThat( + "should be match to 'foo1=bar1&foo2=bar2&foo3=bar3&foo4=bar4'", srv.take().body(), Matchers.is("foo1=bar1&foo2=bar2&foo3=bar3&foo4=bar4") ); From 99955032511bc2de5abf365c96de7af7872c06a0 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Fri, 27 Dec 2024 19:15:19 +0300 Subject: [PATCH 103/112] fix quality violations --- src/test/java/com/jcabi/http/request/BoundaryTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/request/BoundaryTest.java b/src/test/java/com/jcabi/http/request/BoundaryTest.java index d40102c5..2e9df931 100644 --- a/src/test/java/com/jcabi/http/request/BoundaryTest.java +++ b/src/test/java/com/jcabi/http/request/BoundaryTest.java @@ -47,6 +47,7 @@ final class BoundaryTest { @Test void buildsExpectedBoundary() throws Exception { MatcherAssert.assertThat( + "should be match", new Boundary(new Random(0L)).value(), Matchers.is("PdAChx6AMjemBZYS_W0fi7l8H_-w-X") ); From e2843e021cd41672e6dedfe68ef86f8efa91296e Mon Sep 17 00:00:00 2001 From: uchitsa Date: Fri, 27 Dec 2024 19:15:21 +0300 Subject: [PATCH 104/112] fix quality violations --- src/test/java/com/jcabi/http/ImmutableHeaderTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/com/jcabi/http/ImmutableHeaderTest.java b/src/test/java/com/jcabi/http/ImmutableHeaderTest.java index 98e273f8..0579cf25 100644 --- a/src/test/java/com/jcabi/http/ImmutableHeaderTest.java +++ b/src/test/java/com/jcabi/http/ImmutableHeaderTest.java @@ -49,6 +49,7 @@ void normalizesHeaderKey() throws Exception { final Map.Entry header = new ImmutableHeader("content-type", "text/plain"); MatcherAssert.assertThat( + "should be 'Content-Type'", header.getKey(), Matchers.equalTo("Content-Type") ); From 656a61491b768b830d00a4d1e99a7283b0f7c61e Mon Sep 17 00:00:00 2001 From: uchitsa Date: Fri, 3 Jan 2025 03:40:29 +0300 Subject: [PATCH 105/112] fix quality violations --- .../java/com/jcabi/http/mock/GrizzlyQuery.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/jcabi/http/mock/GrizzlyQuery.java b/src/main/java/com/jcabi/http/mock/GrizzlyQuery.java index 6d7544ea..15b4dc9d 100644 --- a/src/main/java/com/jcabi/http/mock/GrizzlyQuery.java +++ b/src/main/java/com/jcabi/http/mock/GrizzlyQuery.java @@ -175,14 +175,16 @@ private static List headers( private static byte[] input(final Request req) throws IOException { // @checkstyle MagicNumber (1 line) final byte[] buffer = new byte[8192]; - final InputStream input = req.getInputStream(); - final ByteArrayOutputStream output = new ByteArrayOutputStream(); - while (true) { - final int bytes = input.read(buffer); - if (bytes == -1) { - break; + final ByteArrayOutputStream output; + try (InputStream input = req.getInputStream()) { + output = new ByteArrayOutputStream(); + while (true) { + final int bytes = input.read(buffer); + if (bytes == -1) { + break; + } + output.write(buffer, 0, bytes); } - output.write(buffer, 0, bytes); } return output.toByteArray(); } From 5671e17db0b3a76c1086c9edcbf96b0cd7f79c96 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Sat, 4 Jan 2025 03:00:40 +0300 Subject: [PATCH 106/112] fix quality violations --- .../com/jcabi/http/request/ApacheRequest.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/jcabi/http/request/ApacheRequest.java b/src/main/java/com/jcabi/http/request/ApacheRequest.java index 274437a3..09bf5a64 100644 --- a/src/main/java/com/jcabi/http/request/ApacheRequest.java +++ b/src/main/java/com/jcabi/http/request/ApacheRequest.java @@ -89,14 +89,12 @@ public Response send(final Request req, final String home, final InputStream content, final int connect, final int read) throws IOException { - final CloseableHttpResponse response = - HttpClients.createSystem().execute( - this.httpRequest( - home, method, headers, content, - connect, read - ) - ); - try { + try (CloseableHttpResponse response = HttpClients.createSystem().execute( + this.httpRequest( + home, method, headers, content, + connect, read + ) + )) { return new DefaultResponse( req, response.getStatusLine().getStatusCode(), @@ -104,8 +102,6 @@ public Response send(final Request req, final String home, this.headers(response.getAllHeaders()), this.consume(response.getEntity()) ); - } finally { - response.close(); } } From 57859b17b4bb3b19733f00bb9f7198d67032b2fd Mon Sep 17 00:00:00 2001 From: uchitsa Date: Sat, 4 Jan 2025 03:25:12 +0300 Subject: [PATCH 107/112] fix quality violations --- .../com/jcabi/http/mock/MkGrizzlyAdapter.java | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/jcabi/http/mock/MkGrizzlyAdapter.java b/src/main/java/com/jcabi/http/mock/MkGrizzlyAdapter.java index 4b1d8068..f12b090b 100644 --- a/src/main/java/com/jcabi/http/mock/MkGrizzlyAdapter.java +++ b/src/main/java/com/jcabi/http/mock/MkGrizzlyAdapter.java @@ -217,22 +217,17 @@ private static void fail( final Throwable failure ) { response.setStatus(HttpURLConnection.HTTP_INTERNAL_ERROR); - final PrintWriter writer; - try { - writer = new PrintWriter( - new OutputStreamWriter( - response.createOutputStream(), - MkGrizzlyAdapter.ENCODING - ) - ); + try (PrintWriter writer = new PrintWriter( + new OutputStreamWriter( + response.createOutputStream(), + MkGrizzlyAdapter.ENCODING + ) + ) + ) { + writer.print(Logger.format("%[exception]s", failure)); } catch (final UnsupportedEncodingException ex) { throw new IllegalStateException(ex); } - try { - writer.print(Logger.format("%[exception]s", failure)); - } finally { - writer.close(); - } } /** From cc0552d6b0fb940169d4fd37f8e45fc846d00e0d Mon Sep 17 00:00:00 2001 From: uchitsa Date: Sat, 4 Jan 2025 03:54:12 +0300 Subject: [PATCH 108/112] fix quality violations --- src/main/java/com/jcabi/http/request/JdkRequest.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/com/jcabi/http/request/JdkRequest.java b/src/main/java/com/jcabi/http/request/JdkRequest.java index 68ae293e..f8cc85e8 100644 --- a/src/main/java/com/jcabi/http/request/JdkRequest.java +++ b/src/main/java/com/jcabi/http/request/JdkRequest.java @@ -102,12 +102,8 @@ public Response send( if (method.equals(Request.POST) || method.equals(Request.PUT) || method.equals(Request.PATCH)) { conn.setDoOutput(true); - final OutputStream output = conn.getOutputStream(); - try { + try (OutputStream output = conn.getOutputStream()) { this.writeFully(content, output); - } finally { - output.close(); - content.close(); } } return new DefaultResponse( From c139e5af3c06980707824aa42bc4bdf05aa59e5f Mon Sep 17 00:00:00 2001 From: uchitsa Date: Thu, 9 Jan 2025 19:24:46 +0300 Subject: [PATCH 109/112] fix quality violations --- .../com/jcabi/http/request/JdkRequest.java | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/jcabi/http/request/JdkRequest.java b/src/main/java/com/jcabi/http/request/JdkRequest.java index f8cc85e8..57a5dd55 100644 --- a/src/main/java/com/jcabi/http/request/JdkRequest.java +++ b/src/main/java/com/jcabi/http/request/JdkRequest.java @@ -170,28 +170,25 @@ private Array> headers( * @throws IOException */ private byte[] body(final HttpURLConnection conn) throws IOException { - final InputStream input; + final InputStream inp; if (conn.getResponseCode() >= HttpURLConnection.HTTP_BAD_REQUEST) { - input = conn.getErrorStream(); + inp = conn.getErrorStream(); } else { - input = conn.getInputStream(); + inp = conn.getInputStream(); } - final byte[] body; - if (input == null) { - body = new byte[0]; - } else { - try { - // @checkstyle MagicNumber (1 line) + byte[] body = new byte[0]; + if (inp != null) { + try (InputStream is = inp; ByteArrayOutputStream os = new ByteArrayOutputStream()) { final byte[] buffer = new byte[8192]; - final ByteArrayOutputStream output = - new ByteArrayOutputStream(); - for (int bytes = input.read(buffer); bytes != -1; - bytes = input.read(buffer)) { - output.write(buffer, 0, bytes); + int bytes; + while (true) { + bytes = is.read(buffer); + if (bytes == -1) { + break; + } + os.write(buffer, 0, bytes); } - body = output.toByteArray(); - } finally { - input.close(); + body = os.toByteArray(); } } return body; From c63bae0fa53cc5caaaf222a523392b0b60cac7fd Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 15 Jan 2025 15:26:41 +0300 Subject: [PATCH 110/112] fix quality violations --- src/test/java/com/jcabi/http/RequestITCaseTemplate.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/jcabi/http/RequestITCaseTemplate.java b/src/test/java/com/jcabi/http/RequestITCaseTemplate.java index 8c16c3c8..0baef924 100644 --- a/src/test/java/com/jcabi/http/RequestITCaseTemplate.java +++ b/src/test/java/com/jcabi/http/RequestITCaseTemplate.java @@ -62,7 +62,8 @@ * @checkstyle JavadocMethodCheck (500 lines) */ @RequiredArgsConstructor(access = AccessLevel.PROTECTED) -@SuppressWarnings({"PMD.AbstractClassWithoutAbstractMethod", "PMD.TooManyMethods"}) +@SuppressWarnings({"PMD.AbstractClassWithoutAbstractMethod", "PMD.TooManyMethods", + "PMD.JUnitTestClassShouldBeFinal"}) public abstract class RequestITCaseTemplate { /** From b8cd5a30a303bad0a5e761094614d661a6a8cad8 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Wed, 15 Jan 2025 16:09:57 +0300 Subject: [PATCH 111/112] fix quality violations --- src/main/java/com/jcabi/http/RequestBody.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/jcabi/http/RequestBody.java b/src/main/java/com/jcabi/http/RequestBody.java index 0ffddd94..f8d5258a 100644 --- a/src/main/java/com/jcabi/http/RequestBody.java +++ b/src/main/java/com/jcabi/http/RequestBody.java @@ -127,7 +127,7 @@ final class Printable { * @param bytes Bytes to encapsulate */ public Printable(final byte[] bytes) { - this.array = bytes; + this.array = copyArray(bytes); } @Override @@ -152,6 +152,14 @@ public String toString() { } return text.toString(); } + + private static byte[] copyArray(final byte[] array) { + byte[] res = new byte[0]; + if (array == null) { + res = array.clone(); + } + return res; + } } } From e3946db4fe64acfbc998bf76f430d86c58803f67 Mon Sep 17 00:00:00 2001 From: uchitsa Date: Sun, 19 Jan 2025 03:25:38 +0300 Subject: [PATCH 112/112] fix quality violations --- .../jcabi/http/wire/CookieOptimizingWire.java | 49 +++++++++---------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/jcabi/http/wire/CookieOptimizingWire.java b/src/main/java/com/jcabi/http/wire/CookieOptimizingWire.java index 3a91d72b..66ac6f08 100644 --- a/src/main/java/com/jcabi/http/wire/CookieOptimizingWire.java +++ b/src/main/java/com/jcabi/http/wire/CookieOptimizingWire.java @@ -42,6 +42,7 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import java.util.stream.Collectors; import lombok.EqualsAndHashCode; import lombok.ToString; @@ -100,38 +101,34 @@ public Response send(final Request req, final String home, new LinkedList<>(); final ConcurrentMap cookies = new ConcurrentHashMap<>(0); - for (final Map.Entry header : headers) { - if (header.getKey().equals(HttpHeaders.COOKIE)) { - final String cookie = header.getValue(); - final int split = cookie.indexOf('='); - final String name = cookie.substring(0, split); - final String value = cookie.substring(split + 1); - if (value.isEmpty()) { - cookies.remove(name); + headers.forEach( + header -> { + if (header.getKey().equals(HttpHeaders.COOKIE)) { + final String cookie = header.getValue(); + final int split = cookie.indexOf('='); + final String name = cookie.substring(0, split); + final String value = cookie.substring(split + 1); + if (value.isEmpty()) { + cookies.remove(name); + } else { + cookies.put(name, value); + } } else { - cookies.put(name, value); + hdrs.add(header); } - } else { - hdrs.add(header); - } - } + }); if (!cookies.isEmpty()) { - final StringBuilder text = new StringBuilder(0); - for (final Map.Entry cookie : cookies.entrySet()) { - if (cookie.getValue().isEmpty()) { - continue; - } - if (text.length() > 0) { - text.append("; "); - } - text.append(cookie.getKey()) - .append('=') - .append(cookie.getValue()); - } + final String text = cookies.entrySet().stream().filter( + cookie -> !cookie.getValue().isEmpty() + ).map( + cookie -> cookie.getKey() + '=' + cookie.getValue() + ).collect( + Collectors.joining("; ") + ); hdrs.add( new ImmutableHeader( HttpHeaders.COOKIE, - text.toString() + text ) ); }