Skip to content

Commit 13ea2cd

Browse files
Improved skills
1 parent eb91581 commit 13ea2cd

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

.claude/skills/migrate-groovy-to-java/SKILL.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ Migrate test Groovy files to Java using JUnit 5
1616

1717
When converting Groovy code to Java code, make sure that:
1818
- The Java code generated is compatible with JDK 8
19-
- When translating Spock tests, favor using @TableTest. See detailed instructions in the "TableTest Usage" section of this document.
20-
- When usage of `@TableTest` impossible, use `@MethodSource`, and name the arguments method by appending `Arguments` using camelCase to the test method name (e.g. `testMethodArguments`) and return a `Stream` of arguments using `Stream.of(...)` and `arguments(...)` with static import.
19+
- When translating Spock tests, prefer `@TableTest` for data rows that are naturally tabular. See detailed guidance in the "TableTest usage" section.
20+
- `@TableTest` and `@MethodSource` may be combined on the same `@ParameterizedTest` when most cases are tabular but a few cases require programmatic setup.
21+
- In combined mode, keep table-friendly cases in `@TableTest`, and put only non-tabular/complex cases in `@MethodSource`.
22+
- If `@TableTest` is not viable for the test at all, use `@MethodSource` only.
23+
- For `@MethodSource`, name the arguments method `<testMethodName>Arguments` (camelCase, e.g. `testMethodArguments`) and return `Stream<Arguments>` using `Stream.of(...)` and `arguments(...)` with static import.
2124
- Ensure parameterized test names are human-readable (i.e. no hashcodes); instead add a description string as the first `Arguments.arguments(...)` value or index the test case
2225
- When converting tuples, create a light dedicated structure instead to keep the typing system
2326
- Instead of checking a state and throwing an exception, use JUnit asserts
@@ -48,7 +51,8 @@ TableTest usage
4851
- Collections: `[a, b]` = List/array, `{a, b}` = Set, `[k: v]` = Map.
4952

5053
Mixed eligibility:
51-
- Simple rows ⇒ @TableTest; complex rows (mocks, builders) ⇒ separate `@Test`(s) or small `@MethodSource`.
54+
- Prefer combining `@TableTest` + `@MethodSource` on one `@ParameterizedTest` when only some cases are complex.
55+
- Use `@MethodSource`-only only when tabular representation is not practical for the test.
5256

5357
Do NOT use @TableTest when:
5458
- Majority of rows require complex objects or custom converters.

.claude/skills/use-tabletest/SKILL.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ C) @MethodSource (convert only if values are representable as strings)
4848
- List: [a, b, ...]
4949
- Set: {a, b, ...}
5050
- Map: [k: v, ...]
51+
- `@TableTest` and `@MethodSource` may be combined on the same `@ParameterizedTest` when most cases are tabular but a few cases require programmatic setup.
52+
- In combined mode, keep table-friendly cases in `@TableTest`, and put only non-tabular/complex cases in `@MethodSource`.
53+
- If `@TableTest` is not viable for the test at all, use `@MethodSource` only.
54+
- For `@MethodSource`, name the arguments method `<testMethodName>Arguments` (camelCase, e.g. `testMethodArguments`) and return `Stream<Arguments>` using `Stream.of(...)` and `arguments(...)` with static import.
5155
- Blank cell = null (non-primitive).
5256
- '' = empty string.
5357
- For String params that start with '[' or '{', quote to avoid collection parsing (prefer '[]'/'{}').
@@ -59,9 +63,8 @@ Cleanup:
5963
- Delete now-unused @MethodSource provider methods and unused imports.
6064

6165
Mixed eligibility:
62-
- If only a few cases need complex construction, split:
63-
- Simple cases ⇒ @TableTest
64-
- Complex cases ⇒ separate @Test(s) (descriptive names) OR keep a small @MethodSource.
66+
- Prefer combining `@TableTest` + `@MethodSource` on one `@ParameterizedTest` when only some cases are complex.
67+
- Use `@MethodSource`-only only when tabular representation is not practical for the test.
6568

6669
Do NOT convert when:
6770
- Most rows require complex builders/mocks.

0 commit comments

Comments
 (0)