Top "Spring-mvc-test" questions

Mocking a Spring Validator when unit testing Controller

While writing unit tests postmortem to code that another project created, I came across this issue of how to mock …

java unit-testing spring-mvc mockito spring-mvc-test
Unit testing spring mvc controller with mockito

i'm using mockito and junit and run unit test against spring mvc my flow of code is: Service Layer -&…

spring unit-testing mockito spring-mvc-test
Isolated Controller Test can't instantiate Pageable

I have a Spring MVC Controller which uses Pagination Support of Spring-Data: @Controller public class ModelController { private static final int …

spring-mvc testing spring-data spring-mvc-test
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
Interrogation about Spring MVC test API's model().attribute() method

I am trying to test the following controller method using the Spring MVC test API: @RequestMapping(value = "/preference/email", method = …

spring spring-mvc mockito hamcrest spring-mvc-test
In Spring boot:Cannot find template location: class path resource [templates/] (please add some templates or check your Thymeleaf configuration)

I have gone through https://github.com/spring-projects/spring-boot/issues/424 but my project structure contains .html files at the /templates …

spring-boot spring-mvc-test
Runtime error while running a Spring Session + Spring Boot application

I am trying to run this Spring Session example available here but, I've used Maven instead of Gradle. I get …

spring maven spring-boot spring-mvc-test spring-session
@ExtendWith(SpringExtension.class) not working

I'm trying to use Junit 5 on a spring-boot 2.x project to test a Controller. The following works fine import static …

spring spring-boot junit5 spring-mvc-test spring-junit
cors not working for my spring boot application

Here is my webConfig @Configuration @EnableWebMvc public class WebConfig extends WebMvcConfigurerAdapter { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**"); } } I …

spring spring-mvc spring-boot cors spring-mvc-test
Unit Testing Spring MVC REST controllers when result Object/json contains a Long field type

I have a problem when trying to test the JSON output from a Spring REST Service using MockMvcResultMatchers where the …

java json rest spring-mvc spring-mvc-test