Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Test-driven development for Spring Boot using JUnit 5, Mockito, MockMvc, Testcontainers, and JaCoCo. Use when adding features, fixing bugs, or refactoring.
.claude/skills/loulanyue-springboot-tdd/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | -19% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 44% | 0% |
| case-08 | ✓→✓ | = Same ✓ | 34% | 0% |
| case-01 | ✓→✓ | = Same ✓ | 16% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 5% | 0% |
TDD guidance for Spring Boot services with 80%+ coverage (unit + integration).
1) Write tests first (they should fail) 2) Implement minimal code to pass 3) Refactor with tests green 4) Enforce coverage (JaCoCo)
java@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:
@ParameterizedTest for variantsjava@WebMvcTest(MarketController.class) class MarketControllerTest { @Autowired MockMvc mockMvc; @MockBean MarketService marketService; @Test void returnsMarkets() throws Exception { when(marketService.list(any())).thenReturn(Page.empty()); mockMvc.perform(get("/api/markets")) .andExpect(status().isOk()) .andExpect(jsonPath("$.content").isArray()); } }
java@SpringBootTest @AutoConfigureMockMvc @ActiveProfiles("test") class MarketIntegrationTest { @Autowired MockMvc mockMvc; @Test void createsMarket() throws Exception { mockMvc.perform(post("/api/markets") .contentType(MediaType.APPLICATION_JSON) .content(""" {"name":"Test","description":"Desc","endDate":"2030-01-01T00:00:00Z","categories":["general"]} """)) .andExpect(status().isCreated()); } }
java@DataJpaTest @AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE) @Import(TestContainersConfig.class) class MarketRepositoryTest { @Autowired MarketRepository repo; @Test void savesAndFinds() { MarketEntity entity = new MarketEntity(); entity.setName("Test"); repo.save(entity); Optional<MarketEntity> found = repo.findByName("Test"); assertThat(found).isPresent(); } }
@DynamicPropertySource to inject JDBC URLs into Spring contextMaven snippet:
xml<plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.8.14</version> <executions> <execution> <goals><goal>prepare-agent</goal></goals> </execution> <execution> <id>report</id> <phase>verify</phase> <goals><goal>report</goal></goals> </execution> </executions> </plugin>
assertThat) for readabilityjsonPathassertThatThrownBy(...)javaclass MarketBuilder { private String name = "Test"; MarketBuilder withName(String name) { this.name = name; return this; } Market build() { return new Market(null, name, MarketStatus.ACTIVE); } }
mvn -T 4 test or mvn verify./gradlew test jacocoTestReportRemember: Keep tests fast, isolated, and deterministic. Test behavior, not implementation details.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-08 | pass→pass | 11,306 | 8,437 | -25% | 1 | 1 | 0% | 1,923 | 2,569 | +34% | 0 | 0 | — |
case-01 | pass→pass | 15,396 | 11,738 | -24% | 1 | 1 | 0% | 3,163 | 3,674 | +16% | 0 | 0 | — |
case-02 | fail→pass | 21,663 | 12,984 | -40% | 1 | 1 | 0% | 4,839 | 3,896 | -19% | 0 | 0 | — |
case-03 | pass→pass | 15,381 | 11,654 | -24% | 1 | 1 | 0% | 3,197 | 3,344 | +5% | 0 | 0 | — |
case-04 | pass→pass | 16,211 | 12,835 | -21% | 1 | 1 | 0% | 3,072 | 3,701 | +20% | 0 | 0 | — |
case-05 | pass→pass | 20,454 | 14,483 | -29% | 1 | 1 | 0% | 4,136 | 3,964 | -4% | 0 | 0 | — |
case-06 | pass→pass | 10,818 | 7,336 | -32% | 1 | 1 | 0% | 2,027 | 2,516 | +24% | 0 | 0 | — |
case-07 | pass→pass | 10,584 | 7,473 | -29% | 1 | 1 | 0% | 1,886 | 2,427 | +29% | 0 | 0 | — |
case-09 | pass→pass | 12,252 | 7,167 | -42% | 1 | 1 | 0% | 2,261 | 2,334 | +3% | 0 | 0 | — |
case-10 | pass→pass | 14,195 | 11,534 | -19% | 1 | 1 | 0% | 2,609 | 3,362 | +29% | 0 | 0 | — |
case-11 | fail→pass | 7,537 | 4,894 | -35% | 1 | 1 | 0% | 1,461 | 2,107 | +44% | 0 | 0 | — |
case-12 | pass→pass | 14,097 | 7,124 | -49% | 1 | 1 | 0% | 2,352 | 2,359 | +0% | 0 | 0 | — |
case-13 | pass→pass | 11,850 | 9,056 | -24% | 1 | 1 | 0% | 2,190 | 2,694 | +23% | 0 | 0 | — |
case-14 | pass→pass | 13,763 | 4,461 | -68% | 1 | 1 | 0% | 2,281 | 1,866 | -18% | 0 | 0 | — |
case-15 | pass→pass | 7,860 | 2,453 | -69% | 1 | 1 | 0% | 1,270 | 1,415 | +11% | 0 | 0 | — |
case-16 | pass→pass | 12,392 | 8,322 | -33% | 1 | 1 | 0% | 2,604 | 2,862 | +10% | 0 | 0 | — |
case-17 | pass→pass | 8,223 | 5,320 | -35% | 1 | 1 | 0% | 1,605 | 2,021 | +26% | 0 | 0 | — |
case-18 | pass→pass | 9,062 | 7,081 | -22% | 1 | 1 | 0% | 1,710 | 2,328 | +36% | 0 | 0 | — |
case-19 | pass→pass | 12,793 | 12,222 | -4% | 1 | 1 | 0% | 2,331 | 3,339 | +43% | 0 | 0 | — |
case-20 | pass→pass | 7,706 | 4,177 | -46% | 1 | 1 | 0% | 1,411 | 1,822 | +29% | 0 | 0 | — |
case-21 | pass→pass | 13,571 | 6,716 | -51% | 1 | 1 | 0% | 2,197 | 2,296 | +5% | 0 | 0 | — |
case-22 | pass→pass | 8,866 | 5,872 | -34% | 1 | 1 | 0% | 1,659 | 2,217 | +34% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +9 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.