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-code

Installs 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

  1. Write tests first (they should fail)
  2. Implement minimal code to pass
  3. Refactor with tests green
  4. 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 @ParameterizedTest for 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
1affaan-m avatardjango-tddaffaan-m/everything-claude-codedjango tdd5.9Kskills.sh installs
2openai avatarplaywright-interactiveopenai/skillsPersistent browser and Electron interaction through `js_repl` for fast iterative UI debugging.5.7Kskills.sh installs
3affaan-m avatarcpp-testingaffaan-m/everything-claude-codecpp testing5.6Kskills.sh installs
4affaan-m avatarrust-testingaffaan-m/everything-claude-coderust testing5.3Kskills.sh installs
5affaan-m avatarlaravel-tddaffaan-m/everything-claude-codelaravel tdd5.1Kskills.sh installs
6affaan-m avatarai-regression-testingaffaan-m/everything-claude-codeai regression testing4.8Kskills.sh installs