Skip to content

Commit 5bd6dc9

Browse files
committed
Refactor tests to call testWebEndpoints()
Remove the @test helper in AbstractWebMvcAutoConfigurationTest and its unused Test import, and update concrete test classes to invoke super.testWebEndpoints() instead of super.test(). Also update the WebMvcAutoConfigurationAllDisabledTest Javadoc to indicate disabled components. This moves the test entrypoints into subclasses so each can perform additional assertions after running the shared web endpoint checks.
1 parent 2345783 commit 5bd6dc9

4 files changed

Lines changed: 4 additions & 10 deletions

File tree

microsphere-spring-boot-webmvc/src/test/java/io/microsphere/spring/boot/webmvc/autoconfigure/AbstractWebMvcAutoConfigurationTest.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import jakarta.servlet.ServletException;
2525
import org.junit.jupiter.api.BeforeEach;
2626
import org.junit.jupiter.api.Disabled;
27-
import org.junit.jupiter.api.Test;
2827
import org.springframework.beans.factory.annotation.Autowired;
2928
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
3029
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
@@ -71,11 +70,6 @@ void setUp() {
7170
this.mockMvc = webAppContextSetup(this.context).build();
7271
}
7372

74-
@Test
75-
void test() throws Exception {
76-
testWebEndpoints();
77-
}
78-
7973
/**
8074
* Test the Web Endpoints
8175
*

microsphere-spring-boot-webmvc/src/test/java/io/microsphere/spring/boot/webmvc/autoconfigure/WebMvcAutoConfigurationAllDisabledTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import static org.junit.jupiter.api.Assertions.assertTrue;
3939

4040
/**
41-
* {@link WebMvcAutoConfiguration} Test with all enabled components
41+
* {@link WebMvcAutoConfiguration} Test with all disalbed components
4242
*
4343
* @author <a href="mailto:mercyblitz@gmail.com">Mercy</a>
4444
* @see WebMvcAutoConfiguration
@@ -82,7 +82,7 @@ public void setUp() {
8282

8383
@Test
8484
void test() throws Exception {
85-
super.test();
85+
super.testWebEndpoints();
8686
assertContentNegotiationManager(this.contentNegotiationManager);
8787
}
8888

microsphere-spring-boot-webmvc/src/test/java/io/microsphere/spring/boot/webmvc/autoconfigure/WebMvcAutoConfigurationAllEnabledTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public void setUp() {
8989

9090
@Test
9191
void test() throws Exception {
92-
super.test();
92+
super.testWebEndpoints();
9393
assertContentNegotiationManager(this.contentNegotiationManager);
9494
}
9595

microsphere-spring-boot-webmvc/src/test/java/io/microsphere/spring/boot/webmvc/autoconfigure/WebMvcAutoConfigurationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class WebMvcAutoConfigurationTest extends AbstractWebMvcAutoConfigurationTest {
5858

5959
@Test
6060
void test() throws Exception {
61-
super.test();
61+
super.testWebEndpoints();
6262
assertNotNull(this.webMvcExtensionConfiguration);
6363
assertNotNull(this.contentCachingFilter);
6464
assertNotNull(this.webMvcConfigurer);

0 commit comments

Comments
 (0)