Skip to content

Commit

Permalink
Bump depedencies version (#1520)
Browse files Browse the repository at this point in the history
* Bump depedencies version

* Using javadoc style license header for java files

* Fix tests after new assertJ version
  • Loading branch information
velo committed Oct 17, 2021
1 parent 8089bb9 commit 15cf841
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 44 deletions.
32 changes: 21 additions & 11 deletions core/src/test/java/feign/FeignBuilderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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!
Expand All @@ -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!
Expand Down
33 changes: 22 additions & 11 deletions core/src/test/java/feign/UtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

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

Expand All @@ -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));
Expand Down
7 changes: 7 additions & 0 deletions jackson-jaxb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
30 changes: 15 additions & 15 deletions jackson/src/test/java/feign/jackson/JacksonIteratorTest.java
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -13,27 +13,27 @@
*/
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;
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;
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 {
Expand All @@ -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
Expand Down Expand Up @@ -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"));
}

Expand All @@ -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
Expand All @@ -97,7 +97,7 @@ public void unmodifiable() throws IOException {

JacksonIterator<String> it = iterator(String.class, "[\"test\"]");

assertThat(it).containsExactly("test");
assertThat(it).toIterable().containsExactly("test");
it.remove();
}

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

Expand All @@ -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();
}
Expand Down
17 changes: 10 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand All @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -581,6 +581,9 @@
<exclude>.circleci/**</exclude>
</excludes>
<strictCheck>true</strictCheck>
<mapping>
<java>JAVADOC_STYLE</java>
</mapping>
</configuration>
<executions>
<execution>
Expand Down

0 comments on commit 15cf841

Please sign in to comment.