Top "Spring-boot-test" questions

Unable to start ReactiveWebApplicationContext due to missing ReactiveWebServerFactory bean

I have a new springboot application I am attempting to get started. The error I receive is org.springframework.context.…

java spring-boot spring-boot-test
Difference between junit-vintage-engine and junit-jupiter-engine?

It's a two-fold question. What is the difference between junit-vintage-engine and junit-jupiter-engine? SpringBoot starter projects come with an exclusion for …

java spring-boot junit spring-boot-test
How to fix the null value response of RestTemplate.exchange in a Mockito Test?

My Service class is below, followed by its test - @Service public class MyServiceImpl implements MyService { @Autowired private RestTemplate restTemplate; @…

spring-boot junit mockito spring-test spring-boot-test
What is the use of contextLoads method in Spring Boot Junit Testcases?

This method is empty in all my JUnit test cases. What is the use of this method? Sonarqube is complaining "…

java spring-boot junit testcase spring-boot-test
How to set environment variable dynamically in spring test

I am trying to run spring-test cases with spring-boot. My test class looks like as follows @ContextConfiguration(initializers = TestContextInitializer.class) @…

java spring spring-mvc spring-boot spring-boot-test
How execute `schema.sql` during spring boot test without embeded datasource configuration?

There is spring boot application with h2 database which is used as primary database. Also there is a resource/schema.…

java spring spring-boot embedded-database spring-boot-test
How to prevent spring boot from auto creating instance of bean 'entityManagerFactory' at startup?

I am working on a Spring boot application that uses Spring JPA with PostgreSQL. I am using @SpringBootTest(classes = <…

java spring unit-testing spring-boot spring-boot-test
How to test a Spring Boot handler Interceptor

we are trying to do an intergration test our interceptors in our spring boot application using spring boot version 1.4.0, but …

java spring spring-mvc spring-boot spring-boot-test
Spring Boot: Disable security for Spring Boot Unit Test

Spring Boot version: 2.0.4.RELEASE For the Spring Boot Test below, the test returns an unwanted 401 response: "401" status, "error": "unauthorized" What …

java spring-boot spring-security spring-boot-test spring-security-test