@@ -243,30 +243,33 @@ void endWhenNotStartedThrowsException() {
243243
244244 @ Test
245245 void illegalStateExceptionShouldBeThrownWhenCollectionExceededNestingDepth () {
246+ JsonValueWriter writer = new JsonValueWriter (new StringBuilder (), 128 );
246247 List <Object > list = new ArrayList <>();
247248 list .add (list );
248- doWrite ((valueWriter ) -> assertThatIllegalStateException ().isThrownBy (() -> valueWriter .write (list ))
249+ doWrite ((valueWriter ) -> assertThatIllegalStateException ().isThrownBy (() -> writer .write (list ))
249250 .withMessageStartingWith (
250- "JSON nesting depth (1001 ) exceeds maximum depth of 1000 (current path: [0][0][0][0][0][0][0][0][0][0][0][0]" ));
251+ "JSON nesting depth (129 ) exceeds maximum depth of 128 (current path: [0][0][0][0][0][0][0][0][0][0][0][0]" ));
251252 }
252253
253254 @ Test
254255 void illegalStateExceptionShouldBeThrownWhenMapExceededNestingDepth () {
256+ JsonValueWriter writer = new JsonValueWriter (new StringBuilder (), 128 );
255257 Map <String , Object > map = new LinkedHashMap <>();
256258 map .put ("foo" , Map .of ("bar" , map ));
257- doWrite ((valueWriter ) -> assertThatIllegalStateException ().isThrownBy (() -> valueWriter .write (map ))
259+ doWrite ((valueWriter ) -> assertThatIllegalStateException ().isThrownBy (() -> writer .write (map ))
258260 .withMessageStartingWith (
259- "JSON nesting depth (1001 ) exceeds maximum depth of 1000 (current path: foo.bar.foo.bar.foo.bar.foo" ));
261+ "JSON nesting depth (129 ) exceeds maximum depth of 128 (current path: foo.bar.foo.bar.foo.bar.foo" ));
260262 }
261263
262264 @ Test
263265 void illegalStateExceptionShouldBeThrownWhenIterableExceededNestingDepth () {
266+ JsonValueWriter writer = new JsonValueWriter (new StringBuilder (), 128 );
264267 List <Object > list = new ArrayList <>();
265268 list .add (list );
266269 doWrite ((valueWriter ) -> assertThatIllegalStateException ()
267- .isThrownBy (() -> valueWriter .write ((Iterable <Object >) list ::iterator ))
270+ .isThrownBy (() -> writer .write ((Iterable <Object >) list ::iterator ))
268271 .withMessageStartingWith (
269- "JSON nesting depth (1001 ) exceeds maximum depth of 1000 (current path: [0][0][0][0][0][0][0][0][0][0][0][0]" ));
272+ "JSON nesting depth (129 ) exceeds maximum depth of 128 (current path: [0][0][0][0][0][0][0][0][0][0][0][0]" ));
270273 }
271274
272275 private <V > String write (V value ) {
0 commit comments