Skip to content

Commit

Permalink
Upgrade Dependencies for use with Java 17 (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdavisk6 committed Jul 6, 2022
1 parent 6268d88 commit 5677777
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 55 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down
7 changes: 6 additions & 1 deletion core/src/test/java/feign/assertions/Assertions.java
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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.
Expand All @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/test/java/feign/http/RequestSpecificationTest.java
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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;
Expand Down
24 changes: 12 additions & 12 deletions core/src/test/java/feign/impl/AbstractTargetMethodHandlerTest.java
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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);
}

Expand All @@ -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();
}

Expand All @@ -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();
}

Expand All @@ -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();
}

Expand Down Expand Up @@ -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));
}

Expand Down Expand Up @@ -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
Expand Down
12 changes: 4 additions & 8 deletions core/src/test/java/feign/impl/AsyncTargetMethodHandlerTest.java
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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;
Expand Down Expand Up @@ -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));
}

Expand All @@ -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));
}

Expand Down
8 changes: 4 additions & 4 deletions core/src/test/java/feign/logging/SimpleLoggerTest.java
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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;
Expand All @@ -42,7 +42,7 @@ void shouldNotLog_ifNotEnabled() {

simpleLogger.logRequest("test", request);
simpleLogger.logResponse("test", response);
verifyZeroInteractions(request, response);
verifyNoInteractions(request, response);
}

@Test
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions core/src/test/java/feign/proxy/ProxyTargetTest.java
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 {
Expand Down
Loading

0 comments on commit 5677777

Please sign in to comment.