Browse Source

Bump depedencies version (#1520)

* Bump depedencies version

* Using javadoc style license header for java files

* Fix tests after new assertJ version
pull/1521/head
Marvin Froeder 3 years ago committed by GitHub
parent
commit
15cf841574
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 32
      core/src/test/java/feign/FeignBuilderTest.java
  2. 33
      core/src/test/java/feign/UtilTest.java
  3. 7
      jackson-jaxb/pom.xml
  4. 30
      jackson/src/test/java/feign/jackson/JacksonIteratorTest.java
  5. 17
      pom.xml

32
core/src/test/java/feign/FeignBuilderTest.java

@ -13,27 +13,37 @@ @@ -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 class FeignBuilderTest { @@ -68,7 +78,7 @@ public class FeignBuilderTest {
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 class FeignBuilderTest { @@ -95,7 +105,7 @@ public class FeignBuilderTest {
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!

33
core/src/test/java/feign/UtilTest.java

@ -13,18 +13,29 @@ @@ -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 { @@ -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 class UtilTest { @@ -51,7 +62,7 @@ public class UtilTest {
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));

7
jackson-jaxb/pom.xml

@ -49,6 +49,13 @@ @@ -49,6 +49,13 @@
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>

30
jackson/src/test/java/feign/jackson/JacksonIteratorTest.java

@ -1,5 +1,5 @@ @@ -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 @@ @@ -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.Response; @@ -20,9 +24,6 @@ import feign.Response;
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.Collections; @@ -30,10 +31,9 @@ import java.util.Collections;
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 { @@ -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 class JacksonIteratorTest { @@ -73,7 +73,7 @@ public class JacksonIteratorTest {
@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 class JacksonIteratorTest { @@ -82,13 +82,13 @@ public class JacksonIteratorTest {
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 class JacksonIteratorTest { @@ -97,7 +97,7 @@ public class JacksonIteratorTest {
JacksonIterator<String> it = iterator(String.class, "[\"test\"]");
assertThat(it).containsExactly("test");
assertThat(it).toIterable().containsExactly("test");
it.remove();
}
@ -121,7 +121,7 @@ public class JacksonIteratorTest { @@ -121,7 +121,7 @@ public class JacksonIteratorTest {
.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 class JacksonIteratorTest { @@ -147,7 +147,7 @@ public class JacksonIteratorTest {
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();
}

17
pom.xml

@ -76,15 +76,15 @@ @@ -76,15 +76,15 @@
<okhttp3.version>4.9.2</okhttp3.version>
<guava.version>30.1.1-jre</guava.version>
<googlehttpclient.version>1.39.2</googlehttpclient.version>
<googlehttpclient.version>1.40.1</googlehttpclient.version>
<gson.version>2.8.8</gson.version>
<slf4j.version>1.7.32</slf4j.version>
<bouncy.version>1.69</bouncy.version>
<json.version>20210307</json.version>
<junit.version>4.13.1</junit.version>
<jackson.version>2.12.5</jackson.version>
<assertj.version>3.10.0</assertj.version>
<junit.version>4.13.2</junit.version>
<jackson.version>2.13.0</jackson.version>
<assertj.version>3.21.0</assertj.version>
<hamcrest.version>2.2</hamcrest.version>
<mockito.version>4.0.0</mockito.version>
@ -93,13 +93,13 @@ @@ -93,13 +93,13 @@
<maven-install-plugin.version>2.5.2</maven-install-plugin.version>
<maven-source-plugin.version>3.0.1</maven-source-plugin.version>
<maven-javadoc-plugin.version>3.0.1</maven-javadoc-plugin.version>
<license-maven-plugin.version>3.0</license-maven-plugin.version>
<license-maven-plugin.version>4.1</license-maven-plugin.version>
<maven-jar-plugin.version>3.1.0</maven-jar-plugin.version>
<maven-release-plugin.version>2.5.3</maven-release-plugin.version>
<maven-bundle-plugin.version>5.1.2</maven-bundle-plugin.version>
<centralsync-maven-plugin.version>0.1.0</centralsync-maven-plugin.version>
<maven-surefire-plugin.version>2.22.0</maven-surefire-plugin.version>
<bom-generator.version>0.14.3</bom-generator.version>
<bom-generator.version>0.40.1</bom-generator.version>
<bom.template.file.path>file://${project.basedir}/src/config/bom.xml</bom.template.file.path>
<maven-scm-plugin.version>1.11.2</maven-scm-plugin.version>
<maven-versions-plugin.version>2.7</maven-versions-plugin.version>
@ -435,7 +435,7 @@ @@ -435,7 +435,7 @@
<!-- surefire uses ASM to do some bytecode magic... need to bump version to be java 11 compatible -->
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>7.0-beta</version>
<version>9.2</version>
</dependency>
</dependencies>
</plugin>
@ -581,6 +581,9 @@ @@ -581,6 +581,9 @@
<exclude>.circleci/**</exclude>
</excludes>
<strictCheck>true</strictCheck>
<mapping>
<java>JAVADOC_STYLE</java>
</mapping>
</configuration>
<executions>
<execution>

Loading…
Cancel
Save