Unit testing your API
summary
Shows concrete unit tests for a Java Spring API: service layer for a signPlayer feature, using Mockito to mock player and team repositories and an offToken auth object, asserting calls, arguments and exception paths (player missing, retired, insufficient cap). Demonstrates a working demo service, incremental comment‑out approach, and a beforeEach setup that removes repetitive instantiation; code is ~90% complete and tests run green locally.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 2:27Unit testing for teams
- 7:00Good unit test traits
- 13:03Mocks in isolation
- 17:15Demo setup: NHL app
- 20:24Service layer testing
- 24:00Refactoring tests
- 25:45Running tests
- 26:28Closing
related talks
54mAutomated Tests: What Courses Won't Teach You
59mJava Testing Part 2: Mocks, Stubs, and Spies with Mockito 4
47mMicroservices Testing with Java
54mDirty Tests And How To Clean Them
44mAPI Testing following the Test Pyramid
02h 36mTesting Java Microservice
43mTest Driven Application Security
27mEffectively Testing Services
