File tree 1 file changed +17
-0
lines changed
spring-restdocs-core/src/test/java/org/springframework/restdocs/payload 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -378,6 +378,23 @@ public void mapResponseWithVaryingKeysMatchedUsingWildcard() throws IOException
378
378
.build ());
379
379
}
380
380
381
+ @ Test
382
+ public void responseWithSomeNullOcurrencesOfAField () throws IOException {
383
+ this .snippets .expectResponseFields ()
384
+ .withContents (tableWithHeader ("Path" , "Type" , "Description" )
385
+ .row ("`assets[].name`" , "`String`" , "one" ));
386
+ new ResponseFieldsSnippet (Arrays .asList (
387
+ fieldWithPath ("assets[].name" ).description ("one" )))
388
+ .document (this .operationBuilder .response ()
389
+ .content (
390
+ "{\" assets\" : [" +
391
+ "{\" name\" : \" sample1\" }, " +
392
+ "{\" name\" : null}, " +
393
+ "{\" name\" : \" sample2\" }]}" )
394
+ .build ());
395
+ }
396
+
397
+
381
398
private String escapeIfNecessary (String input ) {
382
399
if (this .templateFormat .equals (TemplateFormats .markdown ())) {
383
400
return input ;
You can’t perform that action at this time.
0 commit comments