Top "Mockmvc" questions

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

MockRestServiceServer simulate backend timeout in integration test

I am writing some kind of integration test on my REST controller using MockRestServiceServer to mock backend behaviour. What I …

java spring mocking mockito mockmvc
Integration Testing Spring Boot With MockMVC

I'm having some trouble testing a Spring Boot application with MockMvc. I have the following test class: @RunWith(SpringJUnit4ClassRunner.…

spring-security spring-boot spring-test spring-test-mvc mockmvc
How to extract value from JSON response when using Spring MockMVC

I have an endpoint that accepts a POST request. I want to get the ID of the newly created entity …

java spring spring-boot integration-testing mockmvc
Run unit tests on controllers that require authentication

I have a spring boot application which requires login for some actions. I am trying to test them using MockMvc, …

java spring-mvc spring-security spring-boot mockmvc
Check Map key/values with jsonPath

I'm testing a controller that returns a Map @RequestMapping("/") @ResponseBody public Map<String, String> getMessages(@RequestBody String foo) { …

java jsonpath mockmvc
Autowired HttpServletRequest in Spring-test integration tests

I am trying to do a test to cover login functionality. Version of Spring is 3.2.12. I have a session bean, …

java spring spring-mvc spring-test mockmvc
Getting httpServletRequest attribute with MockMvc

I have a really simple controller defined in this way: @RequestMapping(value = "/api/test", method = RequestMethod.GET, produces = "application/json") …

java spring spring-mvc junit mockmvc
How to PUT multipart/form-data using Spring MockMvc?

I have a controller's method with a PUT method, which receives multipart/form-data: @RequestMapping(value = "/putIn", method = RequestMethod.PUT) public …

java spring multipartform-data spring-test-mvc mockmvc
How to prevent NestedServletException when testing Spring endpoints?

I am trying to test the security configuration of some of my endpoints which are secured with @PreAuthorize(#oauth2.hasScope(…

spring unit-testing integration-testing mockmvc
WebMvcTest in Spring Boot

I have a basic SpringBoot app., embedded Tomcat, Thymeleaf template engine, and package as an executable JAR file. I have …

spring spring-mvc spring-boot junit4 mockmvc