Polish HttpHeadersAssertTests
This commit is contained in:
parent
aac4dbf420
commit
cecebd0ef1
|
@ -135,10 +135,10 @@ class HttpHeadersAssertTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void hasValueWithNonPresentHeader() {
|
void hasValueWithNonPresentHeader() {
|
||||||
HttpHeaders map = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
map.add("test-header", "a");
|
headers.add("test-header", "a");
|
||||||
assertThatExceptionOfType(AssertionError.class)
|
assertThatExceptionOfType(AssertionError.class)
|
||||||
.isThrownBy(() -> assertThat(map).hasValue("wrong-name", "a"))
|
.isThrownBy(() -> assertThat(headers).hasValue("wrong-name", "a"))
|
||||||
.withMessageContainingAll("HTTP headers", "test-header", "wrong-name");
|
.withMessageContainingAll("HTTP headers", "test-header", "wrong-name");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,19 +151,19 @@ class HttpHeadersAssertTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void hasValueWithLongMatchOnSecondaryValue() {
|
void hasValueWithLongMatchOnSecondaryValue() {
|
||||||
HttpHeaders map = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
map.addAll("header", List.of("123", "456", "789"));
|
headers.addAll("header", List.of("123", "456", "789"));
|
||||||
assertThatExceptionOfType(AssertionError.class)
|
assertThatExceptionOfType(AssertionError.class)
|
||||||
.isThrownBy(() -> assertThat(map).hasValue("header", 456))
|
.isThrownBy(() -> assertThat(headers).hasValue("header", 456))
|
||||||
.withMessageContainingAll("check primary long value for HTTP header 'header'", "123", "456");
|
.withMessageContainingAll("check primary long value for HTTP header 'header'", "123", "456");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void hasValueWithNoLongMatch() {
|
void hasValueWithNoLongMatch() {
|
||||||
HttpHeaders map = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
map.addAll("header", List.of("123", "456", "789"));
|
headers.addAll("header", List.of("123", "456", "789"));
|
||||||
assertThatExceptionOfType(AssertionError.class)
|
assertThatExceptionOfType(AssertionError.class)
|
||||||
.isThrownBy(() -> assertThat(map).hasValue("wrong-name", 456))
|
.isThrownBy(() -> assertThat(headers).hasValue("wrong-name", 456))
|
||||||
.withMessageContainingAll("HTTP headers", "header", "wrong-name");
|
.withMessageContainingAll("HTTP headers", "header", "wrong-name");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,20 +178,20 @@ class HttpHeadersAssertTests {
|
||||||
@Test
|
@Test
|
||||||
void hasValueWithNoInstantMatch() {
|
void hasValueWithNoInstantMatch() {
|
||||||
Instant instant = Instant.now();
|
Instant instant = Instant.now();
|
||||||
HttpHeaders map = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
map.setInstant("header", instant);
|
headers.setInstant("header", instant);
|
||||||
assertThatExceptionOfType(AssertionError.class)
|
assertThatExceptionOfType(AssertionError.class)
|
||||||
.isThrownBy(() -> assertThat(map).hasValue("wrong-name", instant.minusSeconds(30)))
|
.isThrownBy(() -> assertThat(headers).hasValue("wrong-name", instant.minusSeconds(30)))
|
||||||
.withMessageContainingAll("HTTP headers", "header", "wrong-name");
|
.withMessageContainingAll("HTTP headers", "header", "wrong-name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void hasValueWithNoInstantMatchOneSecOfDifference() {
|
void hasValueWithNoInstantMatchOneSecOfDifference() {
|
||||||
Instant instant = Instant.now();
|
Instant instant = Instant.now();
|
||||||
HttpHeaders map = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
map.setInstant("header", instant);
|
headers.setInstant("header", instant);
|
||||||
assertThatExceptionOfType(AssertionError.class)
|
assertThatExceptionOfType(AssertionError.class)
|
||||||
.isThrownBy(() -> assertThat(map).hasValue("wrong-name", instant.minusSeconds(1)))
|
.isThrownBy(() -> assertThat(headers).hasValue("wrong-name", instant.minusSeconds(1)))
|
||||||
.withMessageContainingAll("HTTP headers", "header", "wrong-name");
|
.withMessageContainingAll("HTTP headers", "header", "wrong-name");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue