Skip to content

Commit a0c9a20

Browse files
committed
Polishing
1 parent 8f21137 commit a0c9a20

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

Diff for: spring-test/src/test/java/org/springframework/test/web/servlet/assertj/MockMvcTesterIntegrationTests.java

+3-12
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@
4040
import org.springframework.http.HttpStatus;
4141
import org.springframework.http.MediaType;
4242
import org.springframework.stereotype.Controller;
43-
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
44-
import org.springframework.test.context.web.WebAppConfiguration;
43+
import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig;
4544
import org.springframework.test.web.Person;
4645
import org.springframework.test.web.servlet.ResultMatcher;
4746
import org.springframework.ui.Model;
@@ -72,8 +71,7 @@
7271
* @author Brian Clozel
7372
* @author Stephane Nicoll
7473
*/
75-
@SpringJUnitConfig
76-
@WebAppConfiguration
74+
@SpringJUnitWebConfig
7775
public class MockMvcTesterIntegrationTests {
7876

7977
private final MockMvcTester mvc;
@@ -148,7 +146,6 @@ void statusOk() {
148146
void statusSeries() {
149147
assertThat(mvc.get().uri("/greet")).hasStatus2xxSuccessful();
150148
}
151-
152149
}
153150

154151
@Nested
@@ -169,7 +166,6 @@ private Consumer<HttpHeaders> textContent(String charset) {
169166
return headers -> assertThat(headers).containsEntry(
170167
"Content-Type", List.of("text/plain;charset=%s".formatted(charset)));
171168
}
172-
173169
}
174170

175171
@Nested
@@ -205,7 +201,6 @@ void hasAttributeErrors() {
205201
void hasAttributeErrorsCount() {
206202
assertThat(mvc.post().uri("/persons")).model().extractingBindingResult("person").hasErrorsCount(1);
207203
}
208-
209204
}
210205

211206
@Nested
@@ -252,7 +247,6 @@ void jsonContentUsingResourceLoaderClass() {
252247
assertThat(mvc.get().uri("/message")).bodyJson().withResourceLoadClass(MockMvcTesterIntegrationTests.class)
253248
.isLenientlyEqualTo("message.json");
254249
}
255-
256250
}
257251

258252
@Nested
@@ -278,7 +272,6 @@ void isInvokedOn() {
278272
assertThat(mvc.get().uri("/callable")).handler()
279273
.isInvokedOn(AsyncController.class, AsyncController::getCallable);
280274
}
281-
282275
}
283276

284277
@Nested
@@ -411,7 +404,6 @@ private void testAssertionFailureWithUnresolvableException(Consumer<MvcTestResul
411404
ServletException.class.getName(), IllegalStateException.class.getName(),
412405
"Expected");
413406
}
414-
415407
}
416408

417409
@Test
@@ -446,8 +438,7 @@ void resultMatcherFailsWithDedicatedException() {
446438
ResultMatcher matcher = result -> assertThat(result.getResponse().getStatus())
447439
.isEqualTo(HttpStatus.NOT_FOUND.value());
448440
assertThatExceptionOfType(AssertionError.class)
449-
.isThrownBy(() -> assertThat(mvc.get().uri("/greet"))
450-
.matches(matcher))
441+
.isThrownBy(() -> assertThat(mvc.get().uri("/greet")).matches(matcher))
451442
.withMessageContaining("expected: 404").withMessageContaining(" but was: 200");
452443
}
453444

0 commit comments

Comments
 (0)