Add missing test

This commit is contained in:
Sam Brannen
2024-03-13 10:47:34 +01:00
parent 7211db9262
commit 21ed8aad74

View File

@@ -105,6 +105,17 @@ class HeaderAssertionTests {
"[.*ISO-8859-1.*]"));
}
@Test
void valueMatchesWithNonexistentHeader() {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
HeaderAssertions assertions = headerAssertions(headers);
assertThatExceptionOfType(AssertionError.class)
.isThrownBy(() -> assertions.valueMatches("Content-XYZ", ".*ISO-8859-1.*"))
.withMessage("Response header 'Content-XYZ' not found");
}
@Test
void valuesMatch() {
HttpHeaders headers = new HttpHeaders();