Improve exception message when subsection is empty array

See gh-732
This commit is contained in:
ddaaac
2021-06-07 10:05:02 +09:00
committed by Andy Wilkinson
parent bae549c950
commit cbe6d775f3
2 changed files with 11 additions and 0 deletions

View File

@@ -183,4 +183,12 @@ public class FieldPathPayloadSubsectionExtractorTests {
.hasMessage("a.c does not identify a section of the payload");
}
@Test
public void extractEmptySubsection() throws JsonParseException, JsonMappingException, IOException {
assertThatThrownBy(() -> new FieldPathPayloadSubsectionExtractor("a")
.extractSubsection("{\"a\":[]}}".getBytes(), MediaType.APPLICATION_JSON))
.isInstanceOf(PayloadHandlingException.class)
.hasMessage("a identifies a section of payload, but the section is empty");
}
}