Top "Mockmvc" questions

MockMVC is the key part of the Spring MVC Test framework is.

Using Spring's mockMvc, how do I check if the returned data contains part of a string?

I’m using Spring 3.2.11.RELEASE and JUnit 4.11. Using the Spring mockMvc framework, how do I check if a method returning …

json spring junit return mockmvc
Register @ControllerAdvice annotated Controller in JUnitTest with MockMVC

My @ControllerAdvice annotated Controller looks like this: @ControllerAdvice public class GlobalControllerExceptionHandler { @ResponseStatus(value = HttpStatus.UNAUTHORIZED) @ExceptionHandler(AuthenticationException.class) public void …

java spring spring-mvc junit mockmvc
MockMvc configure a header for all requests

In my tests I setup the MockMvc object in the @Before like this mockMvc = MockMvcBuilders.webAppContextSetup(context) .apply(springSecurity()) .build(); …

spring spring-test mockmvc
Access request body and request header in spring mvc test

I have created a spring boot application and this is how my controller looks like. I am using postman to …

spring spring-boot model-view-controller junit mockmvc
@ModelAttribute controller spring-mvc mocking

I want to test a controller which is using @ModelAttribute for one of its method arguments. public String processSaveAction(@ModelAttribute("…

unit-testing spring-mvc mocking spring-test-mvc mockmvc
SpringBootTest : No qualifying bean of type 'org.springframework.test.web.servlet.MockMvc' available:

Hey i have started learing spring-boot junit testing using spring boot Test framework at the time of creating the test …

java spring-boot junit4 spring-boot-test mockmvc
MockMVC in junit tests - checking result for List<Object> and Map<Enum, Object>

I have problems with mockMVC and test written with that. My tests fails. I have two tests methods: @Test public …

java spring testing junit mockmvc
Unit Testing /login in Spring MVC using MockMvc

I have a very simple REST application created using Spring MVC. (Code is available at GitHub.) It has a simple …

java spring unit-testing spring-mvc mockmvc
Test HTTP status code of redirected URL with MockMvc

I want to test the login process in a Spring Boot Application using MockMvc. After the successful login, the user …

java spring-mvc spring-boot mockmvc spring-mvc-test
HttpRequestMethodNotSupportedException: Request method 'POST' not supported

Creating a unit test with MockMvc I am running into: HttpRequestMethodNotSupportedException: Request method 'POST' not supported Which causes the test …

spring spring-mvc junit mockmvc spring-restdocs