diff --git a/core/src/test/java/feign/assertions/AbstractHttpHeaderAssert.java b/core/src/test/java/feign/assertions/AbstractHttpHeaderAssert.java index 8fdfb25..0d38020 100644 --- a/core/src/test/java/feign/assertions/AbstractHttpHeaderAssert.java +++ b/core/src/test/java/feign/assertions/AbstractHttpHeaderAssert.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 OpenFeign Contributors + * Copyright 2019-2022 OpenFeign Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,8 @@ import feign.http.HttpHeader; import org.assertj.core.api.AbstractObjectAssert; import org.assertj.core.internal.Iterables; -import org.assertj.core.util.Objects; + +import java.util.Objects; /** * Abstract base class for {@link HttpHeader} specific assertions - Generated by CustomAssertionGenerator. @@ -86,7 +87,7 @@ public S hasName(String name) { // null safe check String actualName = org.assertj.core.util.introspection.FieldSupport.EXTRACTION.fieldValue("name", String.class, actual); - if (!Objects.areEqual(actualName, name)) { + if (!Objects.deepEquals(actualName, name)) { failWithMessage(assertjErrorMessage, actual, name, actualName); } diff --git a/core/src/test/java/feign/assertions/AbstractHttpRequestAssert.java b/core/src/test/java/feign/assertions/AbstractHttpRequestAssert.java index 8e4599d..7b95a42 100644 --- a/core/src/test/java/feign/assertions/AbstractHttpRequestAssert.java +++ b/core/src/test/java/feign/assertions/AbstractHttpRequestAssert.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 OpenFeign Contributors + * Copyright 2019-2022 OpenFeign Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,12 @@ import feign.Header; import feign.http.HttpHeader; import feign.http.HttpRequest; -import java.util.Collection; import org.assertj.core.api.AbstractObjectAssert; import org.assertj.core.api.Assertions; import org.assertj.core.internal.Iterables; -import org.assertj.core.util.Objects; + +import java.util.Collection; +import java.util.Objects; /** * Abstract base class for {@link HttpRequest} specific assertions - Generated by @@ -261,7 +262,7 @@ public S hasMethod(feign.http.HttpMethod method) { // null safe check feign.http.HttpMethod actualMethod = org.assertj.core.util.introspection.FieldSupport.EXTRACTION .fieldValue("method", feign.http.HttpMethod.class, actual); - if (!Objects.areEqual(actualMethod, method)) { + if (!Objects.deepEquals(actualMethod, method)) { failWithMessage(assertjErrorMessage, actual, method, actualMethod); } @@ -286,7 +287,7 @@ public S hasOptions(feign.RequestOptions options) { // null safe check feign.RequestOptions actualOptions = org.assertj.core.util.introspection.FieldSupport.EXTRACTION .fieldValue("options", feign.RequestOptions.class, actual); - if (!Objects.areEqual(actualOptions, options)) { + if (!Objects.deepEquals(actualOptions, options)) { failWithMessage(assertjErrorMessage, actual, options, actualOptions); } @@ -311,7 +312,7 @@ public S hasUri(java.net.URI uri) { // null safe check java.net.URI actualUri = org.assertj.core.util.introspection.FieldSupport.EXTRACTION .fieldValue("uri", java.net.URI.class, actual); - if (!Objects.areEqual(actualUri, uri)) { + if (!Objects.deepEquals(actualUri, uri)) { failWithMessage(assertjErrorMessage, actual, uri, actualUri); } diff --git a/core/src/test/java/feign/assertions/AbstractHttpResponseAssert.java b/core/src/test/java/feign/assertions/AbstractHttpResponseAssert.java index 7db0637..f17109e 100644 --- a/core/src/test/java/feign/assertions/AbstractHttpResponseAssert.java +++ b/core/src/test/java/feign/assertions/AbstractHttpResponseAssert.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 OpenFeign Contributors + * Copyright 2019-2022 OpenFeign Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,8 @@ import feign.http.HttpResponse; import org.assertj.core.api.AbstractObjectAssert; import org.assertj.core.internal.Iterables; -import org.assertj.core.util.Objects; + +import java.util.Objects; /** * Abstract base class for {@link HttpResponse} specific assertions - Generated by CustomAssertionGenerator. @@ -51,7 +52,7 @@ public S hasBody(java.io.InputStream body) { // null safe check java.io.InputStream actualBody = org.assertj.core.util.introspection.FieldSupport.EXTRACTION.fieldValue("body", java.io.InputStream.class, actual); - if (!Objects.areEqual(actualBody, body)) { + if (!Objects.deepEquals(actualBody, body)) { failWithMessage(assertjErrorMessage, actual, body, actualBody); } @@ -250,7 +251,7 @@ public S hasReason(String reason) { // null safe check String actualReason = org.assertj.core.util.introspection.FieldSupport.EXTRACTION.fieldValue("reason", String.class, actual); - if (!Objects.areEqual(actualReason, reason)) { + if (!Objects.deepEquals(actualReason, reason)) { failWithMessage(assertjErrorMessage, actual, reason, actualReason); } diff --git a/core/src/test/java/feign/assertions/Assertions.java b/core/src/test/java/feign/assertions/Assertions.java index f95a543..da19d36 100644 --- a/core/src/test/java/feign/assertions/Assertions.java +++ b/core/src/test/java/feign/assertions/Assertions.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 OpenFeign Contributors + * Copyright 2019-2022 OpenFeign Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ package feign.assertions; +import org.assertj.core.util.introspection.Introspection; + /** * Entry point for assertions of different data types. Each method in this class is a static factory for the * type-specific assertion objects. @@ -31,6 +33,7 @@ public class Assertions { */ @org.assertj.core.util.CheckReturnValue public static feign.assertions.HttpHeaderAssert assertThat(feign.http.HttpHeader actual) { + Introspection.setExtractBareNamePropertyMethods(true); return new feign.assertions.HttpHeaderAssert(actual); } @@ -42,6 +45,7 @@ public static feign.assertions.HttpHeaderAssert assertThat(feign.http.HttpHeader */ @org.assertj.core.util.CheckReturnValue public static feign.assertions.HttpRequestAssert assertThat(feign.http.HttpRequest actual) { + Introspection.setExtractBareNamePropertyMethods(true); return new feign.assertions.HttpRequestAssert(actual); } @@ -53,6 +57,7 @@ public static feign.assertions.HttpRequestAssert assertThat(feign.http.HttpReque */ @org.assertj.core.util.CheckReturnValue public static feign.assertions.HttpResponseAssert assertThat(feign.http.HttpResponse actual) { + Introspection.setExtractBareNamePropertyMethods(true); return new feign.assertions.HttpResponseAssert(actual); } diff --git a/core/src/test/java/feign/http/RequestSpecificationTest.java b/core/src/test/java/feign/http/RequestSpecificationTest.java index b58f8b2..f311bdd 100644 --- a/core/src/test/java/feign/http/RequestSpecificationTest.java +++ b/core/src/test/java/feign/http/RequestSpecificationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 OpenFeign Contributors + * Copyright 2019-2022 OpenFeign Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ package feign.http; -import static feign.assertions.HttpRequestAssert.assertThat; +import static feign.assertions.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat; import feign.Header; diff --git a/core/src/test/java/feign/impl/AbstractTargetMethodHandlerTest.java b/core/src/test/java/feign/impl/AbstractTargetMethodHandlerTest.java index a484f71..da5a113 100644 --- a/core/src/test/java/feign/impl/AbstractTargetMethodHandlerTest.java +++ b/core/src/test/java/feign/impl/AbstractTargetMethodHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 OpenFeign Contributors + * Copyright 2019-2022 OpenFeign Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import feign.Client; @@ -134,7 +134,7 @@ void interceptors_areApplied_ifPresent() throws Throwable { verify(encoder, times(1)).apply(any(), any(RequestSpecification.class)); verify(client, times(1)).request(any(Request.class)); verify(decoder, times(1)).decode(any(Response.class), eq(String.class)); - verifyZeroInteractions(this.exceptionHandler); + verifyNoInteractions(this.exceptionHandler); } @Test @@ -163,7 +163,7 @@ void interceptors_areNotApplied_ifNotPresent() throws Throwable { verify(encoder, times(1)).apply(any(), any(RequestSpecification.class)); verify(client, times(1)).request(any(Request.class)); verify(decoder, times(1)).decode(any(Response.class), eq(String.class)); - verifyZeroInteractions(this.exceptionHandler); + verifyNoInteractions(this.exceptionHandler); } @Test @@ -214,7 +214,7 @@ public byte[] getData() { verify(client, times(1)).request(any(Request.class)); verify(decoder, times(1)).decode(any(Response.class), eq(String.class)); verify(encoder, times(1)).apply(any(), any(RequestSpecification.class)); - verifyZeroInteractions(this.exceptionHandler); + verifyNoInteractions(this.exceptionHandler); } @Test @@ -241,7 +241,7 @@ void skipEncoding_withNoBody() throws Throwable { targetMethodHandler.execute(Arrays.array("name")); verify(client, times(1)).request(any(Request.class)); verify(decoder, times(1)).decode(any(Response.class), eq(String.class)); - verifyZeroInteractions(this.exceptionHandler, this.encoder); + verifyNoInteractions(this.exceptionHandler, this.encoder); } @Test @@ -267,7 +267,7 @@ void skipDecode_ifReturnType_isResponse() throws Throwable { Object result = targetMethodHandler.execute(Arrays.array("name")); verify(client, times(1)).request(any(Request.class)); - verifyZeroInteractions(this.exceptionHandler, this.encoder, this.decoder); + verifyNoInteractions(this.exceptionHandler, this.encoder, this.decoder); assertThat(result).isInstanceOf(Response.class); } @@ -292,7 +292,7 @@ void skipDecode_ifResponseIsNull() throws Throwable { Object result = targetMethodHandler.execute(Arrays.array("name")); verify(client, times(1)).request(any(Request.class)); - verifyZeroInteractions(this.exceptionHandler, this.encoder, this.decoder); + verifyNoInteractions(this.exceptionHandler, this.encoder, this.decoder); assertThat(result).isNull(); } @@ -318,7 +318,7 @@ void skipDecode_ifResponseBody_isNull() throws Throwable { Object result = targetMethodHandler.execute(Arrays.array("name")); verify(client, times(1)).request(any(Request.class)); - verifyZeroInteractions(this.exceptionHandler, this.encoder, this.decoder); + verifyNoInteractions(this.exceptionHandler, this.encoder, this.decoder); assertThat(result).isNull(); } @@ -344,7 +344,7 @@ void skipDecode_ifReturnType_Void() throws Throwable { Object result = targetMethodHandler.execute(Arrays.array("name")); verify(client, times(1)).request(any(Request.class)); - verifyZeroInteractions(this.exceptionHandler, this.encoder, this.decoder); + verifyNoInteractions(this.exceptionHandler, this.encoder, this.decoder); assertThat(result).isNull(); } @@ -376,7 +376,7 @@ void whenExceptionOccursBeforeRequest_exceptionHandlerIsCalled() { assertThrows(RuntimeException.class, () -> targetMethodHandler.execute(Arrays.array("name"))); - verifyZeroInteractions(this.client, this.decoder); + verifyNoInteractions(this.client, this.decoder); verify(this.exceptionHandler, times(1)).apply(any(Throwable.class)); } @@ -404,7 +404,7 @@ void whenExceptionOccursDuringRequest_exceptionHandlerIsCalled() { () -> targetMethodHandler.execute(Arrays.array("name"))); verify(this.client, times(1)).request(any(Request.class)); verify(this.exceptionHandler, times(1)).apply(any(Throwable.class)); - verifyZeroInteractions(this.decoder); + verifyNoInteractions(this.decoder); } @Test diff --git a/core/src/test/java/feign/impl/AsyncTargetMethodHandlerTest.java b/core/src/test/java/feign/impl/AsyncTargetMethodHandlerTest.java index 4a56b49..9729be8 100644 --- a/core/src/test/java/feign/impl/AsyncTargetMethodHandlerTest.java +++ b/core/src/test/java/feign/impl/AsyncTargetMethodHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 OpenFeign Contributors + * Copyright 2019-2022 OpenFeign Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; +import static org.mockito.Mockito.*; import feign.Client; import feign.Contract; @@ -141,7 +137,7 @@ void throwException_onFailure() { assertThrows(ExecutionException.class, future::get); assertThat(future).isCompletedExceptionally(); - verifyZeroInteractions(this.decoder); + verifyNoInteractions(this.decoder); verify(this.exceptionHandler, times(1)).apply(any(Throwable.class)); } @@ -166,7 +162,7 @@ void methodNotHandled_returnsNull() { assertThrows(ExecutionException.class, future::get); assertThat(future).isCompletedExceptionally(); - verifyZeroInteractions(this.decoder); + verifyNoInteractions(this.decoder); verify(mockHandler, times(1)).apply(any(Throwable.class)); } diff --git a/core/src/test/java/feign/logging/SimpleLoggerTest.java b/core/src/test/java/feign/logging/SimpleLoggerTest.java index 82730d7..5c3bc15 100644 --- a/core/src/test/java/feign/logging/SimpleLoggerTest.java +++ b/core/src/test/java/feign/logging/SimpleLoggerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 OpenFeign Contributors + * Copyright 2019-2022 OpenFeign Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import feign.Request; @@ -42,7 +42,7 @@ void shouldNotLog_ifNotEnabled() { simpleLogger.logRequest("test", request); simpleLogger.logResponse("test", response); - verifyZeroInteractions(request, response); + verifyNoInteractions(request, response); } @Test @@ -188,7 +188,7 @@ void shouldLogRetry_whenNotEnabled() { Response response = mock(Response.class); simpleLogger.logRetry( "test", new RetryContext(3, new IOException("bad"), response)); - verifyZeroInteractions(response); + verifyNoInteractions(response); } @Test diff --git a/core/src/test/java/feign/proxy/ProxyTargetTest.java b/core/src/test/java/feign/proxy/ProxyTargetTest.java index a386b4f..28fec31 100644 --- a/core/src/test/java/feign/proxy/ProxyTargetTest.java +++ b/core/src/test/java/feign/proxy/ProxyTargetTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 OpenFeign Contributors + * Copyright 2019-2022 OpenFeign Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import feign.FeignConfiguration; @@ -73,7 +73,7 @@ void toString_isNotProxied() throws Throwable { String value = (String) this.target.invoke(this.target, method, null); assertThat(value).isNotNull(); - verifyZeroInteractions(this.targetMethodHandler); + verifyNoInteractions(this.targetMethodHandler); } @Test @@ -82,7 +82,7 @@ void hashCode_isNotProxied() throws Throwable { int value = (int) this.target.invoke(this.target, method, null); assertThat(value).isNotZero(); - verifyZeroInteractions(this.targetMethodHandler); + verifyNoInteractions(this.targetMethodHandler); } @Test @@ -91,7 +91,7 @@ void equals_isNotProxied() throws Throwable { boolean value = (boolean) this.target.invoke(this.target, method, new Object[]{"string"}); assertThat(value).isFalse(); - verifyZeroInteractions(this.targetMethodHandler); + verifyNoInteractions(this.targetMethodHandler); } interface ProxyInterface { diff --git a/core/src/test/java/feign/retry/ConditionalRetryTest.java b/core/src/test/java/feign/retry/ConditionalRetryTest.java index 75c2051..0dcc6c1 100644 --- a/core/src/test/java/feign/retry/ConditionalRetryTest.java +++ b/core/src/test/java/feign/retry/ConditionalRetryTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 OpenFeign Contributors + * Copyright 2019-2022 OpenFeign Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import feign.Client; @@ -105,7 +105,7 @@ void shouldNotRetry_whenConditionFails_onInitialAttempt() throws Throwable { Response response = this.conditionalRetry.execute("test", this.request, client::request); verify(this.client, times(1)).request(any(Request.class)); - verifyZeroInteractions(this.logger); + verifyNoInteractions(this.logger); assertThat(response).isNotNull(); } diff --git a/pom.xml b/pom.xml index f8aed27..ec80282 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@