Top "Spring-test" questions

`spring-test` is the testing module of the Spring Framework, providing support for unit and integration testing with JUnit and TestNG, including various mocks for unit testing and the Spring TestContext Framework & the Spring MVC Test Framework for integration testing Spring-based applications.

@RunWith(SpringRunner.class) vs @RunWith(MockitoJUnitRunner.class)

I was using @RunWith(MockitoJUnitRunner.class) for my junit test with mockito. But now i am working with spring boot …

junit mockito spring-test
Spring boot 1.4 Testing : Configuration error: found multiple declarations of @BootstrapWith

By following the official doc here: http://docs.spring.io/spring-boot/docs/1.4.0.M2/reference/htmlsingle/#Testing i wanted to test …

java spring spring-mvc spring-boot spring-test
Spring Boot: @TestConfiguration Not Overriding Bean During Integration Test

I have a Bean defined in a class decorated with @Configuration: @Configuration public class MyBeanConfig { @Bean public String configPath() { return "../…

java spring-boot spring-test
spring boot test unable to inject TestRestTemplate and MockMvc

I am using spring boot 1.4.0.RELEASE. I am writing tests for my controller class. I get the following exception. org.…

spring-mvc spring-boot spring-test
Using Spring mockMvc to test optional path variables

I have a method in Spring MVC with optional path variable. I am trying to test it for a scenario …

java spring spring-mvc spring-test spring-test-mvc
How to use @ComponentScan together with test-specific ContextConfigurations in SpringJunit4TestRunner?

I am testing a Spring Boot application. I have several test classes, each of which needs a different set of …

spring spring-boot spring-test
Reload or refresh a Spring application context inside a test method?

I need to change the Spring profiles that are active in my applicationContext within a single method of my test …

java spring testng applicationcontext spring-test
Spring Integration Testing: Could not detect default resource locations

I am running integration tests for my Spring Boot application with Maven's Failsafe plugin. When I create a simple test …

java spring spring-boot spring-test
Spring boot test @Transactional not saving

I'am trying to do a simple Integration test using Spring Boot Test in order to test the e2e use …

java spring spring-boot spring-test