Skip to content

Commit 1e3d8b8

Browse files
committed
LengthLimitingJsonProcessingException now comes wrapped
1 parent 937b05f commit 1e3d8b8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/test/java/com/hubspot/jinjava/objects/serialization/PyishObjectMapperTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import static org.assertj.core.api.Assertions.assertThat;
44
import static org.assertj.core.api.Assertions.assertThatThrownBy;
55

6-
import com.fasterxml.jackson.core.JsonProcessingException;
6+
import com.fasterxml.jackson.databind.JsonMappingException;
77
import com.google.common.collect.ImmutableMap;
88
import com.hubspot.jinjava.Jinjava;
99
import com.hubspot.jinjava.JinjavaConfig;
@@ -29,7 +29,7 @@ public void itSerializesMapWithNullKeysAsEmptyString() {
2929
}
3030

3131
@Test
32-
public void itSerializesMapEntrySet() throws JsonProcessingException {
32+
public void itSerializesMapEntrySet() {
3333
SizeLimitingPyMap map = new SizeLimitingPyMap(new HashMap<>(), 10);
3434
map.put("foo", "bar");
3535
map.put("bar", ImmutableMap.of("foobar", new ArrayList<>()));
@@ -39,7 +39,7 @@ public void itSerializesMapEntrySet() throws JsonProcessingException {
3939
}
4040

4141
@Test
42-
public void itSerializesMapEntrySetWithLimit() throws JsonProcessingException {
42+
public void itSerializesMapEntrySetWithLimit() {
4343
SizeLimitingPyMap map = new SizeLimitingPyMap(new HashMap<>(), 10);
4444
map.put("foo", "bar");
4545
map.put("bar", ImmutableMap.of("foobar", new ArrayList<>()));
@@ -85,7 +85,8 @@ public void itLimitsDepth() {
8585
JinjavaInterpreter.pushCurrent(jinjava.newInterpreter());
8686
assertThatThrownBy(() -> PyishObjectMapper.getAsPyishStringOrThrow(original))
8787
.as("The string to be serialized is larger than the max output size")
88-
.isInstanceOf(LengthLimitingJsonProcessingException.class);
88+
.isInstanceOf(JsonMappingException.class)
89+
.hasMessageContaining("Max length of 10000 chars reached");
8990
} finally {
9091
JinjavaInterpreter.popCurrent();
9192
}

0 commit comments

Comments
 (0)