Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Kruszewski committed Nov 15, 2019
1 parent d4afe89 commit 1f3c7b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.exc.InputCoercionException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.InvalidFormatException;
Expand Down Expand Up @@ -162,7 +163,7 @@ public void testOptionalLongDeserializationFromJsonNull() throws IOException {
public void testLongOverflowDeserialization() {
BigInteger large = BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.ONE);
assertThatThrownBy(() -> MAPPER.readValue("" + large, Long.TYPE))
.isInstanceOf(JsonParseException.class)
.isInstanceOf(InputCoercionException.class)
.hasMessageContaining("out of range of long");
}

Expand All @@ -178,7 +179,7 @@ public void testLongAsStringOverflowDeserialization() {
public void testOptionalLongOverflowDeserialization() {
BigInteger large = BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.ONE);
assertThatThrownBy(() -> MAPPER.readValue("" + large, OptionalLong.class))
.isInstanceOf(JsonParseException.class)
.isInstanceOf(InputCoercionException.class)
.hasMessageContaining("out of range of long");
}

Expand All @@ -193,14 +194,14 @@ public void testOptionalLongAsStringOverflowDeserialization() {
@Test
public void testIntegerOverflowDeserialization() {
assertThatThrownBy(() -> MAPPER.readValue("" + Long.MAX_VALUE, Integer.TYPE))
.isInstanceOf(JsonParseException.class)
.isInstanceOf(InputCoercionException.class)
.hasMessageContaining("out of range of int");
}

@Test
public void testOptionalIntOverflowDeserialization() {
assertThatThrownBy(() -> MAPPER.readValue("" + Long.MAX_VALUE, OptionalInt.class))
.isInstanceOf(JsonParseException.class)
.isInstanceOf(InputCoercionException.class)
.hasMessageContaining("out of range of int");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ public void testUsesStringDecoderWithTextPlain() throws Exception {
}

@Test
public void testCannotReturnStringWithMediaTypeJson() throws Exception {
public void testCannotReturnStringWithMediaTypeJson() {
assertThatThrownBy(() -> service.getJsonString("foo"))
.isInstanceOf(FeignException.class)
.hasMessageStartingWith("Unrecognized token 'foo': was expecting 'null', 'true', 'false' or NaN");
.hasMessageStartingWith("Unrecognized token 'foo': was expecting "
+ "(JSON String, Number, Array, Object or token 'null', 'true' or 'false')");
}

@Test
Expand Down

0 comments on commit 1f3c7b9

Please sign in to comment.