Skip to content

Commit 21ed8aa

Browse files
committed
Add missing test
1 parent 7211db9 commit 21ed8aa

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

spring-test/src/test/java/org/springframework/test/web/reactive/server/HeaderAssertionTests.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,17 @@ void valueMatches() {
105105
"[.*ISO-8859-1.*]"));
106106
}
107107

108+
@Test
109+
void valueMatchesWithNonexistentHeader() {
110+
HttpHeaders headers = new HttpHeaders();
111+
headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
112+
HeaderAssertions assertions = headerAssertions(headers);
113+
114+
assertThatExceptionOfType(AssertionError.class)
115+
.isThrownBy(() -> assertions.valueMatches("Content-XYZ", ".*ISO-8859-1.*"))
116+
.withMessage("Response header 'Content-XYZ' not found");
117+
}
118+
108119
@Test
109120
void valuesMatch() {
110121
HttpHeaders headers = new HttpHeaders();

0 commit comments

Comments
 (0)