Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Oct 29, 2023
2 parents 5d5ed6d + d84d1af commit 764928e
Show file tree
Hide file tree
Showing 31 changed files with 46 additions and 57 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
<dependency>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-aspects</artifactId>
<version>0.24.1</version>
<version>0.25.1</version>
</dependency>
<dependency>
<groupId>com.jcabi</groupId>
Expand Down Expand Up @@ -431,7 +431,7 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
<plugin>
<groupId>com.qulice</groupId>
<artifactId>qulice-maven-plugin</artifactId>
<version>0.19.4</version>
<version>0.22.0</version>
<configuration>
<excludes combine.children="append">
<exclude>duplicatefinder:.*</exclude>
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/jcabi/http/wire/AutoRedirectingWire.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
package com.jcabi.http.wire;

import com.jcabi.aspects.Immutable;
import com.jcabi.aspects.Tv;
import com.jcabi.http.Request;
import com.jcabi.http.Response;
import com.jcabi.http.Wire;
Expand Down Expand Up @@ -86,7 +85,7 @@ public final class AutoRedirectingWire implements Wire {
* @param wire Original wire
*/
public AutoRedirectingWire(final Wire wire) {
this(wire, Tv.FIVE);
this(wire, 5);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/jcabi/http/wire/CachingWire.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.jcabi.aspects.Immutable;
import com.jcabi.aspects.Tv;
import com.jcabi.http.Request;
import com.jcabi.http.Response;
import com.jcabi.http.Wire;
Expand Down Expand Up @@ -204,7 +203,7 @@ public Response send(
final int read
) throws IOException {
final URI uri = req.uri().get();
final StringBuilder label = new StringBuilder(Tv.HUNDRED)
final StringBuilder label = new StringBuilder(100)
.append(method).append(' ').append(uri.getPath());
if (uri.getQuery() != null) {
label.append('?').append(uri.getQuery());
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/jcabi/http/wire/FcWire.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
package com.jcabi.http.wire;

import com.jcabi.aspects.Immutable;
import com.jcabi.aspects.Tv;
import com.jcabi.http.Request;
import com.jcabi.http.Response;
import com.jcabi.http.Wire;
Expand Down Expand Up @@ -138,7 +137,7 @@ public Response send(final Request req, final String home,
final int connect,
final int read) throws IOException {
final URI uri = req.uri().get();
final StringBuilder label = new StringBuilder(Tv.HUNDRED)
final StringBuilder label = new StringBuilder(100)
.append(method).append(' ').append(uri.getPath());
if (uri.getQuery() != null) {
label.append('?').append(uri.getQuery());
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/jcabi/http/wire/RetryWire.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
package com.jcabi.http.wire;

import com.jcabi.aspects.Immutable;
import com.jcabi.aspects.Tv;
import com.jcabi.http.Request;
import com.jcabi.http.Response;
import com.jcabi.http.Wire;
Expand Down Expand Up @@ -91,7 +90,7 @@ public Response send(final Request req, final String home,
final int connect, final int read) throws IOException {
int attempt = 0;
while (true) {
if (attempt > Tv.THREE) {
if (attempt > 3) {
throw new IOException(
String.format("failed after %d attempts", attempt)
);
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/jcabi/http/wire/VerboseWire.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
package com.jcabi.http.wire;

import com.jcabi.aspects.Immutable;
import com.jcabi.aspects.Tv;
import com.jcabi.http.Request;
import com.jcabi.http.RequestBody;
import com.jcabi.http.Response;
Expand Down Expand Up @@ -88,7 +87,7 @@ public Response send(final Request req, final String home,
final int connect,
final int read) throws IOException {
final ByteArrayOutputStream output = new ByteArrayOutputStream();
final byte[] buffer = new byte[Tv.THOUSAND];
final byte[] buffer = new byte[1000];
for (int bytes = content.read(buffer); bytes != -1;
bytes = content.read(buffer)) {
output.write(buffer, 0, bytes);
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/jcabi/http/ImmutableHeaderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* Test case for {@link ImmutableHeader}.
* @since 1.1
*/
public final class ImmutableHeaderTest {
final class ImmutableHeaderTest {

/**
* ImmutableHeader can normalize headers.
Expand Down
5 changes: 2 additions & 3 deletions src/test/java/com/jcabi/http/RequestITCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
*/
package com.jcabi.http;

import com.jcabi.aspects.Tv;
import com.jcabi.http.mock.MkAnswer;
import com.jcabi.http.mock.MkContainer;
import com.jcabi.http.mock.MkGrizzlyContainer;
Expand Down Expand Up @@ -64,7 +63,7 @@ final class RequestITCase extends RequestTestTemplate {
*/
@Values
@ParameterizedTest
@Timeout(Tv.TEN)
@Timeout(10)
void sendsHttpRequestAndProcessesHttpResponse(
final Class<? extends Request> type
) throws Exception {
Expand All @@ -82,7 +81,7 @@ void sendsHttpRequestAndProcessesHttpResponse(
*/
@Values
@ParameterizedTest
@Timeout(Tv.TEN)
@Timeout(10)
void processesNotOkHttpResponse(
final Class<? extends Request> type
) throws Exception {
Expand Down
7 changes: 3 additions & 4 deletions src/test/java/com/jcabi/http/RequestITCaseTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
*/
package com.jcabi.http;

import com.jcabi.aspects.Tv;
import com.jcabi.http.request.JdkRequest;
import com.jcabi.http.response.JsonResponse;
import com.jcabi.http.response.RestResponse;
Expand Down Expand Up @@ -147,7 +146,7 @@ final void sendsCookies() throws IOException {
@Test
final void followsLocationHeader() throws IOException {
this.request("/absolute-redirect/5")
.through(AutoRedirectingWire.class, Tv.SIX)
.through(AutoRedirectingWire.class, 6)
.fetch()
.as(RestResponse.class)
.assertStatus(HttpURLConnection.HTTP_OK);
Expand All @@ -156,7 +155,7 @@ final void followsLocationHeader() throws IOException {
@Test
final void followsLocationHeaderRelativeRedirect() throws IOException {
this.request("/relative-redirect/5")
.through(AutoRedirectingWire.class, Tv.SIX)
.through(AutoRedirectingWire.class, 6)
.fetch()
.as(RestResponse.class)
.assertStatus(HttpURLConnection.HTTP_OK);
Expand All @@ -168,7 +167,7 @@ final void failsOnTimeout() {
IOException.class,
() ->
this.request("/delay/3")
.timeout(Tv.THOUSAND, Tv.THOUSAND)
.timeout(1000, 1000)
.fetch()
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/jcabi/http/RequestSecondITCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
@SuppressWarnings("PMD.AbstractClassWithoutAbstractMethod")
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@Testcontainers(disabledWithoutDocker = true)
public final class RequestSecondITCase {
final class RequestSecondITCase {

/**
* Container with HttpBin.
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/jcabi/http/RequestTimeoutLossTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
* @since 1.17.3
*/
@SuppressWarnings("PMD.TooManyMethods")
public final class RequestTimeoutLossTest extends RequestTestTemplate {
final class RequestTimeoutLossTest extends RequestTestTemplate {
/**
* Placeholder URL used for testing purposes only.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/jcabi/http/mock/GrizzlyQueryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* Test case for {@link GrizzlyQuery}.
* @since 1.13
*/
public final class GrizzlyQueryTest {
final class GrizzlyQueryTest {

/**
* GrizzlyQuery can return a body as a byte array.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* Test case for {@link MkAnswerMatchers}.
* @since 1.5
*/
public final class MkAnswerMatchersTest {
final class MkAnswerMatchersTest {

/**
* MkAnswerMatchers should be able to match MkAnswer body.
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/jcabi/http/mock/MkQueryMatchersTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*
* @since 1.5
*/
public final class MkQueryMatchersTest {
final class MkQueryMatchersTest {

/**
* MkQueryMatchers should be able to match MkQuery body.
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/jcabi/http/request/BoundaryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* Test case {@link Boundary}.
* @since 1.17.3
*/
public final class BoundaryTest {
final class BoundaryTest {

/**
* Boundary builds valid string.
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/jcabi/http/request/DefaultResponseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@
* Test case for {@link DefaultResponse}.
* @since 1.0
*/
public final class DefaultResponseTest {
final class DefaultResponseTest {

/**
* DefaultResponse can throw when entity is not a Unicode text.
*/
@Test
public void throwsWhenEntityIsNotAUnicodeString() {
void throwsWhenEntityIsNotAUnicodeString() {
Assertions.assertThrows(
RuntimeException.class,
new Executable() {
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/com/jcabi/http/request/JdkRequestITCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
*/
package com.jcabi.http.request;

import com.jcabi.aspects.Tv;
import jakarta.ws.rs.HttpMethod;
import java.io.IOException;
import java.net.MalformedURLException;
Expand Down Expand Up @@ -124,7 +123,7 @@ public void execute() throws Throwable {
StringUtils.join(
url,
colon,
String.valueOf(Tv.EIGHTY)
"80"
)
).fetch();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* Test case for {@link JsonResponse}.
* @since 1.1
*/
public final class JsonResponseTest {
final class JsonResponseTest {

/**
* JsonResponse can read and return a JSON document.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*
* @since 1.4
*/
public final class JsoupResponseTest {
final class JsoupResponseTest {

/**
* JsoupResponse normalizes malformed HTML responses.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* Test case for {@link WebLinkingResponse}.
* @since 0.9
*/
public final class WebLinkingResponseTest {
final class WebLinkingResponseTest {

/**
* The Link header.
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/jcabi/http/response/XmlResponseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* @since 1.1
*/
@SuppressWarnings("PMD.TooManyMethods")
public final class XmlResponseTest {
final class XmlResponseTest {

/**
* XmlResponse can find nodes with XPath.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
*/
package com.jcabi.http.wire;

import com.jcabi.aspects.Tv;
import com.jcabi.http.mock.MkAnswer;
import com.jcabi.http.mock.MkContainer;
import com.jcabi.http.mock.MkGrizzlyContainer;
Expand All @@ -47,7 +46,7 @@
*
* @since 1.7
*/
public final class AutoRedirectingWireTest {
final class AutoRedirectingWireTest {

/**
* AutoRedirectingWire retries up to the specified number of times for
Expand All @@ -65,7 +64,7 @@ void retriesForHttpRedirectStatus() throws Exception {
Integer.MAX_VALUE
).start();
try {
final int retries = Tv.THREE;
final int retries = 3;
new JdkRequest(container.home())
.through(AutoRedirectingWire.class, retries)
.fetch().as(RestResponse.class)
Expand Down Expand Up @@ -101,7 +100,7 @@ void returnsValidResponseAfterRetry() throws Exception {
.assertStatus(HttpStatus.SC_OK);
MatcherAssert.assertThat(
container.takeAll(Matchers.any(MkAnswer.class)),
Matchers.<MkQuery>iterableWithSize(Tv.THREE)
Matchers.<MkQuery>iterableWithSize(3)
);
} finally {
container.stop();
Expand Down
7 changes: 3 additions & 4 deletions src/test/java/com/jcabi/http/wire/CachingWireTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.jcabi.aspects.Tv;
import com.jcabi.http.Request;
import com.jcabi.http.Response;
import com.jcabi.http.mock.MkAnswer;
Expand Down Expand Up @@ -63,7 +62,7 @@ void cachesGetRequest() throws Exception {
).start();
final Request req = new JdkRequest(container.home())
.through(CachingWire.class);
for (int idx = 0; idx < Tv.TEN; ++idx) {
for (int idx = 0; idx < 10; ++idx) {
req.fetch().as(RestResponse.class)
.assertStatus(HttpURLConnection.HTTP_OK);
}
Expand Down Expand Up @@ -118,7 +117,7 @@ void flushesOnRegularExpressionMatch() throws Exception {
container.stop();
MatcherAssert.assertThat(
container.queries(),
Matchers.equalTo(Tv.THREE)
Matchers.equalTo(3)
);
}

Expand Down Expand Up @@ -147,7 +146,7 @@ public Response load(final Callable<Response> query)
);
final Request req = new JdkRequest(container.home())
.through(CachingWire.class, cache);
for (int idx = 0; idx < Tv.TEN; ++idx) {
for (int idx = 0; idx < 10; ++idx) {
req.fetch().as(RestResponse.class)
.assertStatus(HttpURLConnection.HTTP_OK);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* Test case for {@link CookieOptimizingWire}.
* @since 1.0
*/
public final class CookieOptimizingWireTest {
final class CookieOptimizingWireTest {

/**
* CookieOptimizingWire can transfer cookies.
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/jcabi/http/wire/ETagCachingWireTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* Test case for {@link ETagCachingWire}.
* @since 2.0
*/
public final class ETagCachingWireTest {
final class ETagCachingWireTest {

/**
* ETagCachingWire can take content from cache.
Expand Down
Loading

0 comments on commit 764928e

Please sign in to comment.