From 15cf84157428c9b5f71ae0ae020b5c5ec0762bb6 Mon Sep 17 00:00:00 2001 From: Marvin Froeder Date: Mon, 18 Oct 2021 11:04:29 +1300 Subject: [PATCH] Bump depedencies version (#1520) * Bump depedencies version * Using javadoc style license header for java files * Fix tests after new assertJ version --- .../src/test/java/feign/FeignBuilderTest.java | 32 +++++++++++------- core/src/test/java/feign/UtilTest.java | 33 ++++++++++++------- jackson-jaxb/pom.xml | 7 ++++ .../feign/jackson/JacksonIteratorTest.java | 30 ++++++++--------- pom.xml | 17 ++++++---- 5 files changed, 75 insertions(+), 44 deletions(-) diff --git a/core/src/test/java/feign/FeignBuilderTest.java b/core/src/test/java/feign/FeignBuilderTest.java index 2ff63b531..c3debc00c 100644 --- a/core/src/test/java/feign/FeignBuilderTest.java +++ b/core/src/test/java/feign/FeignBuilderTest.java @@ -13,27 +13,37 @@ */ package feign; +import static feign.assertj.MockWebServerAssertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import feign.codec.Decoder; import feign.codec.Encoder; -import okhttp3.mockwebserver.MockResponse; -import okhttp3.mockwebserver.MockWebServer; -import org.assertj.core.data.MapEntry; -import org.junit.Rule; -import org.junit.Test; import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.nio.charset.Charset; -import java.util.*; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Optional; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Stream; -import static feign.assertj.MockWebServerAssertions.assertThat; -import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; -import static org.junit.Assert.*; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.assertj.core.data.MapEntry; +import org.junit.Rule; +import org.junit.Test; public class FeignBuilderTest { @@ -68,7 +78,7 @@ public void testDecode404() { TestInterface api = Feign.builder().decode404().target(TestInterface.class, url); assertThat(api.getQueues("/")).isEmpty(); // empty, not null! - assertThat(api.decodedLazyPost()).isEmpty(); // empty, not null! + assertThat(api.decodedLazyPost().hasNext()).isFalse(); // empty, not null! assertThat(api.optionalContent()).isEmpty(); // empty, not null! assertThat(api.streamPost()).isEmpty(); // empty, not null! assertThat(api.decodedPost()).isNull(); // null, not empty! @@ -95,7 +105,7 @@ public void testDecode204() { TestInterface api = Feign.builder().target(TestInterface.class, url); assertThat(api.getQueues("/")).isEmpty(); // empty, not null! - assertThat(api.decodedLazyPost()).isEmpty(); // empty, not null! + assertThat(api.decodedLazyPost().hasNext()).isFalse(); // empty, not null! assertThat(api.optionalContent()).isEmpty(); // empty, not null! assertThat(api.streamPost()).isEmpty(); // empty, not null! assertThat(api.decodedPost()).isNull(); // null, not empty! diff --git a/core/src/test/java/feign/UtilTest.java b/core/src/test/java/feign/UtilTest.java index 68b2ff5f0..d9e6b49e3 100644 --- a/core/src/test/java/feign/UtilTest.java +++ b/core/src/test/java/feign/UtilTest.java @@ -13,18 +13,29 @@ */ package feign; -import org.junit.Rule; -import org.junit.rules.ExpectedException; -import org.junit.Test; -import java.io.Reader; -import java.lang.reflect.Type; -import java.util.*; -import feign.codec.Decoder; -import static feign.Util.*; +import static feign.Util.caseInsensitiveCopyOf; +import static feign.Util.emptyToNull; +import static feign.Util.removeValues; +import static feign.Util.resolveLastTypeParameter; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; +import feign.codec.Decoder; +import java.io.Reader; +import java.lang.reflect.Type; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; public class UtilTest { @@ -34,14 +45,14 @@ public class UtilTest { @Test public void removesEmptyStrings() { String[] values = new String[] {"", null}; - assertThat(removeValues(values, (value) -> emptyToNull(value) == null, String.class)) + assertThat(removeValues(values, value -> emptyToNull(value) == null, String.class)) .isEmpty(); } @Test public void removesEvenNumbers() { Integer[] values = new Integer[] {22, 23}; - assertThat(removeValues(values, (number) -> number % 2 == 0, Integer.class)) + assertThat(removeValues(values, number -> number % 2 == 0, Integer.class)) .containsExactly(23); } @@ -51,7 +62,7 @@ public void emptyValueOf() throws Exception { assertEquals(false, Util.emptyValueOf(Boolean.class)); assertThat((byte[]) Util.emptyValueOf(byte[].class)).isEmpty(); assertEquals(Collections.emptyList(), Util.emptyValueOf(Collection.class)); - assertThat((Iterator) Util.emptyValueOf(Iterator.class)).isEmpty(); + assertThat(((Iterator) Util.emptyValueOf(Iterator.class)).hasNext()).isFalse(); assertEquals(Collections.emptyList(), Util.emptyValueOf(List.class)); assertEquals(Collections.emptyMap(), Util.emptyValueOf(Map.class)); assertEquals(Collections.emptySet(), Util.emptyValueOf(Set.class)); diff --git a/jackson-jaxb/pom.xml b/jackson-jaxb/pom.xml index d8bb63a29..cdfa55eda 100644 --- a/jackson-jaxb/pom.xml +++ b/jackson-jaxb/pom.xml @@ -49,6 +49,13 @@ 1.1.1 + + javax.ws.rs + javax.ws.rs-api + 2.1.1 + test + + com.fasterxml.jackson.jaxrs jackson-jaxrs-json-provider diff --git a/jackson/src/test/java/feign/jackson/JacksonIteratorTest.java b/jackson/src/test/java/feign/jackson/JacksonIteratorTest.java index f5cd8ccd1..c89e237f8 100644 --- a/jackson/src/test/java/feign/jackson/JacksonIteratorTest.java +++ b/jackson/src/test/java/feign/jackson/JacksonIteratorTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2012-2020 The Feign Authors + * Copyright 2012-2021 The Feign Authors * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at @@ -13,6 +13,10 @@ */ package feign.jackson; +import static feign.Util.UTF_8; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.hamcrest.core.Is.isA; import com.fasterxml.jackson.databind.ObjectMapper; import feign.Request; import feign.Request.HttpMethod; @@ -20,9 +24,6 @@ import feign.Util; import feign.codec.DecodeException; import feign.jackson.JacksonIteratorDecoder.JacksonIterator; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -30,10 +31,9 @@ import java.util.LinkedHashMap; import java.util.NoSuchElementException; import java.util.concurrent.atomic.AtomicBoolean; -import static feign.Util.UTF_8; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.hamcrest.core.Is.isA; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; @SuppressWarnings("deprecation") public class JacksonIteratorTest { @@ -43,7 +43,7 @@ public class JacksonIteratorTest { @Test public void shouldDecodePrimitiveArrays() throws IOException { - assertThat(iterator(Integer.class, "[0,1,2,3]")).containsExactly(0, 1, 2, 3); + assertThat(iterator(Integer.class, "[0,1,2,3]")).toIterable().containsExactly(0, 1, 2, 3); } @Test @@ -73,7 +73,7 @@ public void expectExceptionOnNoElements() throws IOException { @Test public void shouldDecodeObjects() throws IOException { - assertThat(iterator(User.class, "[{\"login\":\"bob\"},{\"login\":\"joe\"}]")) + assertThat(iterator(User.class, "[{\"login\":\"bob\"},{\"login\":\"joe\"}]")).toIterable() .containsExactly(new User("bob"), new User("joe")); } @@ -82,13 +82,13 @@ public void malformedObjectThrowsDecodeException() throws IOException { thrown.expect(DecodeException.class); thrown.expectCause(isA(IOException.class)); - assertThat(iterator(User.class, "[{\"login\":\"bob\"},{\"login\":\"joe...")) + assertThat(iterator(User.class, "[{\"login\":\"bob\"},{\"login\":\"joe...")).toIterable() .containsOnly(new User("bob")); } @Test public void emptyBodyDecodesToEmptyIterator() throws IOException { - assertThat(iterator(String.class, "")).isEmpty(); + assertThat(iterator(String.class, "")).toIterable().isEmpty(); } @Test @@ -97,7 +97,7 @@ public void unmodifiable() throws IOException { JacksonIterator it = iterator(String.class, "[\"test\"]"); - assertThat(it).containsExactly("test"); + assertThat(it).toIterable().containsExactly("test"); it.remove(); } @@ -121,7 +121,7 @@ public void close() throws IOException { .body(inputStream, jsonBytes.length) .build(); - assertThat(iterator(Boolean.class, response)).hasSize(2); + assertThat(iterator(Boolean.class, response)).toIterable().hasSize(2); assertThat(closed.get()).isTrue(); } @@ -147,7 +147,7 @@ public void close() throws IOException { try { thrown.expect(DecodeException.class); - assertThat(iterator(Boolean.class, response)).hasSize(1); + assertThat(iterator(Boolean.class, response)).toIterable().hasSize(1); } finally { assertThat(closed.get()).isTrue(); } diff --git a/pom.xml b/pom.xml index c2d0dc601..ff1c047ae 100644 --- a/pom.xml +++ b/pom.xml @@ -76,15 +76,15 @@ 4.9.2 30.1.1-jre - 1.39.2 + 1.40.1 2.8.8 1.7.32 1.69 20210307 - 4.13.1 - 2.12.5 - 3.10.0 + 4.13.2 + 2.13.0 + 3.21.0 2.2 4.0.0 @@ -93,13 +93,13 @@ 2.5.2 3.0.1 3.0.1 - 3.0 + 4.1 3.1.0 2.5.3 5.1.2 0.1.0 2.22.0 - 0.14.3 + 0.40.1 file://${project.basedir}/src/config/bom.xml 1.11.2 2.7 @@ -435,7 +435,7 @@ org.ow2.asm asm - 7.0-beta + 9.2 @@ -581,6 +581,9 @@ .circleci/** true + + JAVADOC_STYLE +