
Springboot Tdd
A solid TDD scaffold for Spring Boot that actually enforces the discipline with JaCoCo coverage gates and gives you the full testing stack: JUnit 5 for units, MockMvc for controllers, Testcontainers for persistence. The workflow is classic red-green-refactor with concrete examples for each layer, from mocked services to full integration tests hitting a real Postgres container. It pushes you toward AssertJ assertions and test data builders, which keeps things readable. Use this when you want guardrails that make it harder to skip tests or ship undertested code. The 80% coverage threshold isn't negotiable, which is either discipline or annoying depending on your project phase.
- skills.sh installs
- 6K
- GitHub stars
- 229.1K
- last updated
- Jul 14, 2026
Install
$ npx -y skills add affaan-m/everything-claude-code --skill springboot-tdd --agent claude-codeInstalls into .claude/skills of the current project.
Files
Spring Boot TDD Workflow
TDD guidance for Spring Boot services with 80%+ coverage (unit + integration).
When to Use
- New features or endpoints
- Bug fixes or refactors
- Adding data access logic or security rules
Workflow
- Write tests first (they should fail)
- Implement minimal code to pass
- Refactor with tests green
- Enforce coverage (JaCoCo)
Unit Tests (JUnit 5 + Mockito)
@ExtendWith(MockitoExtension.class)
class MarketServiceTest {
@Mock MarketRepository repo;
@InjectMocks MarketService service;
@Test
void createsMarket() {
CreateMarketRequest req = new CreateMarketRequest("name", "desc", Instant.now(), List.of("cat"));
when(repo.save(any())).thenAnswer(inv -> inv.getArgument(0));
Market result = service.create(req);
assertThat(result.name()).isEqualTo("name");
verify(repo).save(any());
}
}
Patterns:
- Arrange-Act-Assert
- Avoid partial mocks; prefer explicit stubbing
- Use
@ParameterizedTestfor variants
Web Layer Tests (MockMvc)
@WebMvcTest(MarketController.class)
class MarketControllerTest {
@Autowired MockMvc mockMvc;
@MockBean MarketService marketService;
Sponsors
Details
- Repository
- github.com/affaan-m/everything-claude-code
- Categories
- Testing & QA, Java & JVM
More from affaan-m/everything-claude-code
All 256- Continuous Learning5.9K
- Database Migrations5.9K
- Django Tdd5.9K
- E2e Testing5.9K
- Liquid Glass Design5.9K
- Security Scan5.9K
- Deployment Patterns5.8K
- Jpa Patterns5.8K
- Laravel Patterns5.8K
- Clickhouse Io5.7K
- Eval Harness5.7K
- Laravel Security5.7K
- Cpp Testing5.6K
- Iterative Retrieval5.6K
- Agent Harness Construction5.5K
- Configure Ecc5.5K
- Nutrient Document Processing5.5K
- Search First5.5K
- Verification Loop5.5K
- Agentic Engineering5.4K
- Cost Aware Llm Pipeline5.4K
- Django Verification5.4K
- Springboot Verification5.4K
- Codebase Onboarding5.3K