Skip to content

Commit 0b0891b

Browse files
committed
Add AbstractControllerTest for shared test utilities
Introduce an abstract base test class to centralize and simplify common test setup for controller tests. This includes MockMvc auto-configuration to streamline testing in Spring WebMvcTest contexts.
1 parent 2d6a0a9 commit 0b0891b

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.mpc.springboot.shared;
2+
3+
import org.springframework.beans.factory.annotation.Autowired;
4+
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
5+
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
6+
import org.springframework.test.web.servlet.MockMvc;
7+
8+
@WebMvcTest
9+
@AutoConfigureMockMvc
10+
public abstract class AbstractControllerTest {
11+
12+
@Autowired
13+
protected MockMvc mockMvc;
14+
}

0 commit comments

Comments
 (0)