Top "Mockmvc" questions

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

Mock a ConstraintValidator of a @Validated annotated controller method on Spring

Using Spring Boot 1.3.6.RELEASE, i am trying to unit test a controller method using Junit, Mockito and MockMvc. I have …

spring spring-mvc spring-boot mockmvc spring-validator
Unit test Springboot MockMvc returns 403 Forbidden

I wrote one unit test that tests UsersController. UsersControllerTest.findUser is working fine, but UsersControllerTest.insertGetModifyDelete it doesn't. In the …

java mockmvc
RestFuse vs Rest Assured vs MockMVC Rest Service Unit Test Framework

I've been trying to find a simple all purpose unit test framework for Spring MVC based Rest Services I've written. …

rest spring-mvc rest-assured mockmvc restfuse
I need to create methods get () and status () to create a test controller with mockmvc?

I am trying to test my first controller, followed a few examples on the internet, but is in error in …

controller spring-boot mockmvc
Spring MockMvc test: Null pointer Exception

I'm following tutorials for integrating Spring docs into my project but i'm running into nullpointerexception when I run my test. …

spring-mvc nullpointerexception mockmvc spring-restdocs
@RequestMapping java.lang.AssertionError: Status Expected :200 Actual :404

Assertion error using @RequestMapping annotation outside of the class I am getting this error message: java.lang.AssertionError: Status Expected :200 …

java spring spring-boot junit mockmvc
Spring MockMvc: match a collection of JSON objects in any order

I have an API endpoint which, when called with GET, returns an array of JSON objects in the body, like …

java spring spring-mvc hamcrest mockmvc
Add csrf token with mockmvc and junit

I have a view with two metas (I'm using thymeleaf): <meta name="_csrf" th:content="${_csrf.token}" /> <…

spring junit spring-security mockito mockmvc
Spring Security, JUnit: @WithUserDetails for user created in @Before

In JUnit tests with Spring MockMVC, there are two methods for authenticating as a Spring Security user: @WithMockUser creates a …

java spring junit spring-security mockmvc
Mock controller with an object parameter

I'm trying to test a method with this signature: @RequestMapping(value="/Employee/{id}", method=RequestMethod.PUT, consumes="application/json") @Transactional …

spring spring-mvc junit controller mockmvc