diff --git a/testing-modules/spring-testing/pom.xml b/testing-modules/spring-testing/pom.xml
index 630aed0c81..10d34f169b 100644
--- a/testing-modules/spring-testing/pom.xml
+++ b/testing-modules/spring-testing/pom.xml
@@ -44,6 +44,11 @@
spring-context
LATEST
+
+ org.springframework
+ spring-webmvc
+ ${spring.version}
+
org.eclipse.persistence
javax.persistence
@@ -66,6 +71,11 @@
${awaitility.version}
test
+
+ javax.servlet
+ javax.servlet-api
+ ${servlet.api.version}
+
@@ -84,6 +94,8 @@
2.0.0.0
3.1.6
5.4.0
+ 5.1.4.RELEASE
+ 4.0.1
\ No newline at end of file
diff --git a/testing-modules/spring-testing/src/main/java/com/baeldung/config/WebConfig.java b/testing-modules/spring-testing/src/main/java/com/baeldung/config/WebConfig.java
new file mode 100644
index 0000000000..eca0aed57f
--- /dev/null
+++ b/testing-modules/spring-testing/src/main/java/com/baeldung/config/WebConfig.java
@@ -0,0 +1,17 @@
+package com.baeldung.config;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+
+import javax.servlet.ServletContext;
+
+@EnableWebMvc
+@Configuration
+@ComponentScan(basePackages = {"com.baeldung.controller.parameterized"})
+public class WebConfig {
+
+ @Autowired
+ private ServletContext ctx;
+}
diff --git a/testing-modules/spring-testing/src/main/java/com/baeldung/controller/parameterized/EmployeeRoleController.java b/testing-modules/spring-testing/src/main/java/com/baeldung/controller/parameterized/EmployeeRoleController.java
new file mode 100644
index 0000000000..0f1ed9e61d
--- /dev/null
+++ b/testing-modules/spring-testing/src/main/java/com/baeldung/controller/parameterized/EmployeeRoleController.java
@@ -0,0 +1,32 @@
+package com.baeldung.controller.parameterized;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Controller
+public class EmployeeRoleController {
+
+ private static Map userRoleCache = new HashMap<>();
+
+ static {
+ userRoleCache.put("John", Role.ADMIN);
+ userRoleCache.put("Doe", Role.EMPLOYEE);
+ }
+
+ @RequestMapping(value = "/role/{name}", method = RequestMethod.GET, produces = "application/text")
+ @ResponseBody
+ public String getEmployeeRole(@PathVariable("name") String employeeName) {
+
+ return userRoleCache.get(employeeName).toString();
+ }
+
+ private enum Role {
+ ADMIN, EMPLOYEE
+ }
+}
diff --git a/testing-modules/spring-testing/src/test/java/com/baeldung/controller/parameterized/RoleControllerIntegrationTest.java b/testing-modules/spring-testing/src/test/java/com/baeldung/controller/parameterized/RoleControllerIntegrationTest.java
new file mode 100644
index 0000000000..c362067cc0
--- /dev/null
+++ b/testing-modules/spring-testing/src/test/java/com/baeldung/controller/parameterized/RoleControllerIntegrationTest.java
@@ -0,0 +1,49 @@
+package com.baeldung.controller.parameterized;
+
+import com.baeldung.config.WebConfig;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
+import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+
+import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@WebAppConfiguration
+@ContextConfiguration(classes = WebConfig.class)
+public class RoleControllerIntegrationTest {
+
+ @Autowired
+ private WebApplicationContext wac;
+
+ private MockMvc mockMvc;
+
+ private static final String CONTENT_TYPE = "application/text;charset=ISO-8859-1";
+
+ @Before
+ public void setup() throws Exception {
+ this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
+ }
+
+ @Test
+ public void givenEmployeeNameJohnWhenInvokeRoleThenReturnAdmin() throws Exception {
+ this.mockMvc.perform(MockMvcRequestBuilders.get("/role/John")).andDo(print()).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(CONTENT_TYPE))
+ .andExpect(MockMvcResultMatchers.content().string("ADMIN"));
+ }
+
+ @Test
+ public void givenEmployeeNameDoeWhenInvokeRoleThenReturnEmployee() throws Exception {
+ this.mockMvc.perform(MockMvcRequestBuilders.get("/role/Doe")).andDo(print()).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(CONTENT_TYPE))
+ .andExpect(MockMvcResultMatchers.content().string("EMPLOYEE"));
+ }
+
+}
\ No newline at end of file
diff --git a/testing-modules/spring-testing/src/test/java/com/baeldung/controller/parameterized/RoleControllerParameterizedClassRuleIntegrationTest.java b/testing-modules/spring-testing/src/test/java/com/baeldung/controller/parameterized/RoleControllerParameterizedClassRuleIntegrationTest.java
new file mode 100644
index 0000000000..eca294a742
--- /dev/null
+++ b/testing-modules/spring-testing/src/test/java/com/baeldung/controller/parameterized/RoleControllerParameterizedClassRuleIntegrationTest.java
@@ -0,0 +1,73 @@
+package com.baeldung.controller.parameterized;
+
+import com.baeldung.config.WebConfig;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
+import org.junit.runners.Parameterized.Parameters;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestContextManager;
+import org.springframework.test.context.junit4.rules.SpringClassRule;
+import org.springframework.test.context.junit4.rules.SpringMethodRule;
+import org.springframework.test.context.web.WebAppConfiguration;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
+
+@RunWith(Parameterized.class)
+@WebAppConfiguration
+@ContextConfiguration(classes = WebConfig.class)
+public class RoleControllerParameterizedClassRuleIntegrationTest {
+
+ private static final String CONTENT_TYPE = "application/text;charset=ISO-8859-1";
+
+ @ClassRule
+ public static final SpringClassRule scr = new SpringClassRule();
+
+ @Rule
+ public final SpringMethodRule smr = new SpringMethodRule();
+
+ @Autowired
+ private WebApplicationContext wac;
+
+ private MockMvc mockMvc;
+
+ @Parameter(value = 0)
+ public String name;
+
+ @Parameter(value = 1)
+ public String role;
+
+ @Parameters
+ public static Collection