Loading tutorials
spring-boot-starter-test on your test classpath, as covered in the previous chapter.2 min read@SpringBootTest test and know how Spring beans, application.properties, and profiles work. It shows three ways to change configuration for a test: properties, profiles, and extra beans.2 min readwhen(...).thenReturn(...) in a plain unit test. Here you will use the same mocking ideas inside a Spring context.2 min read@SpringBootTest, understand beans and auto-configuration, and know what a unit test with Mockito looks like. It explains what a test slice is and how to choose one.2 min readspring-boot-starter-test. Testcontainers gets its own chapter, so here it appears only as the database provider.3 min read@DataJpaTest before. You also need Docker running on your machine.2 min read@SpringBootTest. It also assumes you know how slice tests such as @WebMvcTest work. A full-stack test sits at the top of the test pyramid. It starts the whole application, including the embedded web server, and calls it3 min read@WebMvcTest controller test with MockMvc and mock beans, and that you know the basics of Spring Security filters and authorities. It adds the Spring Security test support that lets those tests run as an authenticated user.2 min readRestClient or RestTemplate to call another service. It also assumes you have seen test slices such as @WebMvcTest. Two more slices cover code that sits at the edges of your application: @JsonTest for 2 min read@SpringBootTest and slice tests, and that you know what a Spring bean and an ApplicationContext are. It explains why some test suites start the application once and others start it dozens of times.3 min read@SpringBootTest tests, and that you know the test context cache reuses a started application context between test classes. Here you apply that knowledge to keep a growing suite quick and trustworthy.2 min read