ResponseModifyingPreprocessors { public static OperationPreprocessor limitJsonArrayLength(ObjectMapper objectMapper) { return new ContentModifyingOperationPreprocessor( new ArrayLimitingJsonContentModifier(objectMapper)); }  static OperationResponsePreprocessor shortenContent(ObjectMapper objectMapper); static OperationPreprocessor replaceBinaryContent(); static OperationPreprocessor replaceMultipartBinaryContent(); static OperationPreprocessor limitJsonArrayLength(ObjectMapper objectMapper);  }
@Test public void shouldShortenJsonArrays() { preprocessorTest(new TestData() .content("[1,2,3,4]") .contentType(APPLICATION_JSON_VALUE) .preprocessor( ResponseModifyingPreprocessors.limitJsonArrayLength(mapper)) .expectedResult("[1,2,3]")); }
@Test public void shouldShortenNestedJsonArrays() { preprocessorTest(new TestData() .content("{\"x\":{\"y\":[1,2,3,4,5]}}") .contentType(APPLICATION_JSON_VALUE) .preprocessor(ResponseModifyingPreprocessors.limitJsonArrayLength(mapper)) .expectedResult("{\"x\":{\"y\":[1,2,3]}}")); }