@@ -243,30 +243,33 @@ void endWhenNotStartedThrowsException() {
243
243
244
244
@ Test
245
245
void illegalStateExceptionShouldBeThrownWhenCollectionExceededNestingDepth () {
246
+ JsonValueWriter writer = new JsonValueWriter (new StringBuilder (), 128 );
246
247
List <Object > list = new ArrayList <>();
247
248
list .add (list );
248
- doWrite ((valueWriter ) -> assertThatIllegalStateException ().isThrownBy (() -> valueWriter .write (list ))
249
+ doWrite ((valueWriter ) -> assertThatIllegalStateException ().isThrownBy (() -> writer .write (list ))
249
250
.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]" ));
251
252
}
252
253
253
254
@ Test
254
255
void illegalStateExceptionShouldBeThrownWhenMapExceededNestingDepth () {
256
+ JsonValueWriter writer = new JsonValueWriter (new StringBuilder (), 128 );
255
257
Map <String , Object > map = new LinkedHashMap <>();
256
258
map .put ("foo" , Map .of ("bar" , map ));
257
- doWrite ((valueWriter ) -> assertThatIllegalStateException ().isThrownBy (() -> valueWriter .write (map ))
259
+ doWrite ((valueWriter ) -> assertThatIllegalStateException ().isThrownBy (() -> writer .write (map ))
258
260
.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" ));
260
262
}
261
263
262
264
@ Test
263
265
void illegalStateExceptionShouldBeThrownWhenIterableExceededNestingDepth () {
266
+ JsonValueWriter writer = new JsonValueWriter (new StringBuilder (), 128 );
264
267
List <Object > list = new ArrayList <>();
265
268
list .add (list );
266
269
doWrite ((valueWriter ) -> assertThatIllegalStateException ()
267
- .isThrownBy (() -> valueWriter .write ((Iterable <Object >) list ::iterator ))
270
+ .isThrownBy (() -> writer .write ((Iterable <Object >) list ::iterator ))
268
271
.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]" ));
270
273
}
271
274
272
275
private <V > String write (V value ) {
0 commit comments