Category "spring-boot-test"

Strict @MockBean in a Spring Boot Test

I am developing a Spring Boot application. For my regular service class unit tests, I am able to extend my test class with MockitoExtension, and the mocks are s

DataJPATest attempts to load everything

I have my application, with a lot of components. I'd like to test my queries so I annotated my tests with: @DataJPATest Problem is that it also tries to load e

org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: FQPropretyName, could not initialize proxy - no Session

I am trying a ManyToOne Bi-Directional Association using SpringBoot, SpringDataJpa along with a unit test using SpringBootTest. However the test fails with the

Column not found when running unit tests in Spring Boot

I have this problem when testing a JPA repository: Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Column "CREATED_AT" not found; SQL statement: ins

@webMvcTest is not excluding and loading beans marked as @Repository

I've a @RestController which has only one dependency in field @Autowire that dependency is @component, that component Class definition has some autowired field

How to resolve the Exception from WebTestClient?

How can I achieve the following with WebTestClient? @Autowired private MockMvc mvc; mvc.perform(req) .andExpect(status) .andReturn().getResolve

Using @TestConfiguration doesn't work as Context for @SpringBootTest

I've written an integration test that uses @SpringBootTest annotation. Since my app has many beans, I want to load in the integration test only the beans that a

@DataMongoTest is creating a null MongoTemplate

I have been trying to follow the instructions in the link below to try to add an automatically configured Embedded MongoDB Instance for Cucumber Integration tes

Junit 5 @SpringBootTest executable jar

I am trying to create an executable jar with my test. I cannot use maven to run the tests so I am trying to create a jer that will execute them. I have a jar w