Skip to content

Commit cecebd0

Browse files
committed
Polish HttpHeadersAssertTests
1 parent aac4dbf commit cecebd0

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

spring-test/src/test/java/org/springframework/test/http/HttpHeadersAssertTests.java

+15-15
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ void hasValueWithNoStringMatch() {
135135

136136
@Test
137137
void hasValueWithNonPresentHeader() {
138-
HttpHeaders map = new HttpHeaders();
139-
map.add("test-header", "a");
138+
HttpHeaders headers = new HttpHeaders();
139+
headers.add("test-header", "a");
140140
assertThatExceptionOfType(AssertionError.class)
141-
.isThrownBy(() -> assertThat(map).hasValue("wrong-name", "a"))
141+
.isThrownBy(() -> assertThat(headers).hasValue("wrong-name", "a"))
142142
.withMessageContainingAll("HTTP headers", "test-header", "wrong-name");
143143
}
144144

@@ -151,19 +151,19 @@ void hasValueWithLongMatch() {
151151

152152
@Test
153153
void hasValueWithLongMatchOnSecondaryValue() {
154-
HttpHeaders map = new HttpHeaders();
155-
map.addAll("header", List.of("123", "456", "789"));
154+
HttpHeaders headers = new HttpHeaders();
155+
headers.addAll("header", List.of("123", "456", "789"));
156156
assertThatExceptionOfType(AssertionError.class)
157-
.isThrownBy(() -> assertThat(map).hasValue("header", 456))
157+
.isThrownBy(() -> assertThat(headers).hasValue("header", 456))
158158
.withMessageContainingAll("check primary long value for HTTP header 'header'", "123", "456");
159159
}
160160

161161
@Test
162162
void hasValueWithNoLongMatch() {
163-
HttpHeaders map = new HttpHeaders();
164-
map.addAll("header", List.of("123", "456", "789"));
163+
HttpHeaders headers = new HttpHeaders();
164+
headers.addAll("header", List.of("123", "456", "789"));
165165
assertThatExceptionOfType(AssertionError.class)
166-
.isThrownBy(() -> assertThat(map).hasValue("wrong-name", 456))
166+
.isThrownBy(() -> assertThat(headers).hasValue("wrong-name", 456))
167167
.withMessageContainingAll("HTTP headers", "header", "wrong-name");
168168
}
169169

@@ -178,20 +178,20 @@ void hasValueWithInstantMatch() {
178178
@Test
179179
void hasValueWithNoInstantMatch() {
180180
Instant instant = Instant.now();
181-
HttpHeaders map = new HttpHeaders();
182-
map.setInstant("header", instant);
181+
HttpHeaders headers = new HttpHeaders();
182+
headers.setInstant("header", instant);
183183
assertThatExceptionOfType(AssertionError.class)
184-
.isThrownBy(() -> assertThat(map).hasValue("wrong-name", instant.minusSeconds(30)))
184+
.isThrownBy(() -> assertThat(headers).hasValue("wrong-name", instant.minusSeconds(30)))
185185
.withMessageContainingAll("HTTP headers", "header", "wrong-name");
186186
}
187187

188188
@Test
189189
void hasValueWithNoInstantMatchOneSecOfDifference() {
190190
Instant instant = Instant.now();
191-
HttpHeaders map = new HttpHeaders();
192-
map.setInstant("header", instant);
191+
HttpHeaders headers = new HttpHeaders();
192+
headers.setInstant("header", instant);
193193
assertThatExceptionOfType(AssertionError.class)
194-
.isThrownBy(() -> assertThat(map).hasValue("wrong-name", instant.minusSeconds(1)))
194+
.isThrownBy(() -> assertThat(headers).hasValue("wrong-name", instant.minusSeconds(1)))
195195
.withMessageContainingAll("HTTP headers", "header", "wrong-name");
196196
}
197197

0 commit comments

Comments
 (0)