Spring Boot 4 Testing / Part 1YOUTUBE PLAYER LOADS ON PLAYThe App, HTTP and Spring Boot 3
Springboot Testing #1
Spring Boot Testing Tutorial for Beginners: The App, HTTP and Boot 3 vs 4
In this lesson
Before we write a single test, let's meet the app we will test, and see it running. A small cinema booking app: pick a show, give your name and the number of seats, and it books them.
Episode 0 of Spring Boot Testing: the complete guide. Start here.
- The app: a cinema booking service (Starfall, 7:30 PM, Rs 200 a seat, 4 or more seats get 10% off)
- Inside it, four floors: controller, service, repository, database
- HTTP in plain words: method, path, body, status code
- No screen of its own: a website or app would send the request; we send it with curl
- The real app on PostgreSQL 17: 201 Created, 200 OK, 400 Bad Request, 404 Not Found, 409 Conflict
- The versions in every episode: Java 21, Spring Boot 4.1.2, Spring Framework 7.0, JUnit 6, AssertJ, Mockito 5, Testcontainers 2, PostgreSQL 17, Maven 3.9
- Spring Boot 3 vs 4: Framework 7, Jakarta EE 11, spring-boot-starter-webmvc, @MockBean is gone (@MockitoBean), the split test starters, new packages for test annotations
- The plan for Episodes 1 to 7
Built and run on Spring Boot 4.1, Java 21, JUnit 6, Mockito 5, Testcontainers 2.0, PostgreSQL 17.
Chapters
Spring Boot 4 Testing, 9 out
1Spring Boot Testing Tutorial for Beginners: The App, HTTP and Boot 3 vs 43:312Why Write Tests? The Test Pyramid Explained with One Real Bug3:123JUnit 6 Tutorial for Beginners: First Unit Test with AssertJ and @ParameterizedTest3:544Mockito Tutorial for Beginners: Test a Spring Boot Service Without a Database3:405Spring Boot 4 Controller Test: @WebMvcTest and MockMvc Tutorial3:256Spring Boot @DataJpaTest Tutorial: Test JPA Queries on a Real Database4:197Spring Boot Testcontainers Tutorial: Test the Whole App on Real Postgres4:4983 Spring Boot Testing Mistakes: The Test Passes but the Price Is Wrong4:149Test a Spring Boot Controller: @WebMvcTest + MockMvc0:57Keep going
More walkthroughs.
3 Spring Boot Testing Mistakes: The Test Passes but the Price Is Wrong, Video.
Spring Boot Testcontainers Tutorial: Test the Whole App on Real Postgres, Video.
Spring Boot @DataJpaTest Tutorial: Test JPA Queries on a Real Database, Video.
Spring Boot 4 Controller Test: @WebMvcTest and MockMvc Tutorial, Video.
