From be7c8e1738923b25beb21279a4338ce4625e4e78 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Tue, 21 Mar 2023 20:02:57 -0700 Subject: [PATCH] Update stream constraints test wrt jackson-core changes to allow longer String values --- .../deser/dos/StreamReadStringConstraintsTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/dos/StreamReadStringConstraintsTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/dos/StreamReadStringConstraintsTest.java index ac60fe48d1..eea77178f3 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/dos/StreamReadStringConstraintsTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/dos/StreamReadStringConstraintsTest.java @@ -44,31 +44,31 @@ private ObjectMapper newJsonMapperWithUnlimitedStringSizeSupport() { public void testBigString() throws Exception { try { - MAPPER.readValue(generateJson("string", 1001000), StringWrapper.class); + MAPPER.readValue(generateJson("string", 5001000), StringWrapper.class); fail("expected JsonMappingException"); } catch (DatabindException e) { assertTrue("unexpected exception message: " + e.getMessage(), - e.getMessage().startsWith("String length (1001000) exceeds the maximum length (1000000)")); + e.getMessage().startsWith("String length (5001000) exceeds the maximum length (5000000)")); } } public void testBiggerString() throws Exception { try { - MAPPER.readValue(generateJson("string", 2_000_000), StringWrapper.class); + MAPPER.readValue(generateJson("string", 6_000_000), StringWrapper.class); fail("expected JsonMappingException"); } catch (DatabindException e) { final String message = e.getMessage(); // this test fails when the TextBuffer is being resized, so we don't yet know just how big the string is - // so best not to assert that the String length value in the message is the full 2000000 value + // so best not to assert that the String length value in the message is the full 6000000 value assertTrue("unexpected exception message: " + message, message.startsWith("String length")); - assertTrue("unexpected exception message: " + message, message.contains("exceeds the maximum length (1000000)")); + assertTrue("unexpected exception message: " + message, message.contains("exceeds the maximum length (5000000)")); } } public void testUnlimitedString() throws Exception { - final int len = 1_001_000; + final int len = 5_001_000; StringWrapper sw = newJsonMapperWithUnlimitedStringSizeSupport() .readValue(generateJson("string", len), StringWrapper.class); assertEquals(len, sw.string.length());