What problem does it solve?
Migrating Spock/Groovy test suites to Java by hand is slow and error-prone: Spock interactions, where: blocks, and Groovy idioms like map literals and lazy initialization have no direct Java equivalents, and naive translations silently weaken assertions. This Skill automates the conversion while enforcing quality rules that preserve the original test semantics.
Core Features & Use Cases
- Spock-to-JUnit 5 conversion: Translates Groovy test files into JDK 8-compatible JUnit 5 tests, mapping
where: blocks to @TableTest or @MethodSource parameterized tests.
- Assertion and mock modernization: Replaces Spock interactions with Mockito verifications or concrete collections, upgrades
assertTrue(x instanceof Y) to assertInstanceOf, and prevents relaxed matchers like any() from weakening pinned assertions.
- Quality rule enforcement: Applies a catalog of BLOCKER, WARNING, and STYLE rules covering imports, collection simplification, typed tag getters,
@WithConfig usage, and test structure.
- Use Case: A Gradle module in dd-trace-java still contains
.groovy test files. Run the Skill to generate equivalent .java tests, verify the test count is unchanged and all tests pass, then delete the Groovy sources.
Quick Start
Migrate all Groovy test files in the current Gradle module to JUnit 5 Java tests and confirm the test count stays the same.