Testing Spring Boot Applications
summary
Starts with a slow full integration test hitting MySQL and a WireMock endpoint, then shows concrete moves to faster, clearer tests: use Spring Boot 1.4’s TestRestTemplate with random port, replace real DB with an in‑memory one via @DataJpaTest and TestEntityManager, stub REST calls with MockRestServiceServer and verify 404 handling, swap real services for Mockito mocks with @MockBean, and use JacksonTester/AssertJ for JSON checks. Examples run and pass, and each change measurably speeds tests and narrows surface under test.
AI-written summary · about
chapters (59)
- 0:00Intro
- 3:02Remote Service
- 4:01Controller
- 4:41Repository
- 5:18Ymock
- 6:23Integration Test
- 7:04Configuration
- 8:01Upgrading
- 10:46Moving to Spring Boot
- 11:24Annotations
- 11:52Web Environment
- 12:36Spring Boot Test
- 12:51Dropback Classes
- 15:13Upgrade to assertJ
- 16:23What to import
- 17:45Remove autowire annotation
- 18:23Why use constructor injection
- 19:12Expecting exceptions
- 20:00Testing the message
- 20:31Consistent naming
- 21:25Mockito
- 22:23Constructor Style
- 22:56Testing
- 23:18Auto Configuration
- 23:56Vehicle Identification Number
- 24:21Naming Suggestions
- 24:33DataJPA
- 26:30Spring Data Repository
- 27:25Auto Configure
- 27:54Auto Configure with Existing Tests
- 28:12Shut Down MySQL
- 28:33Auto Configure Test Database
- 29:31Remote Services
- 30:13Rest Template Recap
- 30:34Protected Method
- 30:49Rest Service Server
- 31:19Happy Path
- 32:01Mocking
- 33:41JSON Test Setup
- 35:45Remote Service Test
- 35:59Testing Mocks
- 36:17Testing Integration
- 36:29Testing Service
- 37:53MockBean
- 38:25Mock injected
- 38:56Test results
- 39:12New features
- 39:41Web MVC annotation
- 40:38Mock MVC annotation
- 41:02Getting a vehicle
- 42:27Service Test
- 43:01Mock MVC Test
- 43:50Spring Boot MVC
- 45:24Compulsive Notation
- 46:33Balancing
- 47:02Mock Bean
- 47:14MachBeam
- 47:50Other Applications
- 48:07MetaAnnotations
related talks
53mTesting Spring Boot Applications Demystified
48mTesting Spring Boot Applications Demystified
01h 49mSpring Boot testing: Zero to Hero
02h 43mSpring Boot testing: Zero to Hero
51mTesting Spring Boot Applications
13mSpeed up writing tests with Wiremock Spring Boot
44mTesting Web Apps with Spring Framework
56mLearning Spring Boot with TDD
