unit-test-parameterized
Provides parameterized testing patterns with JUnit 5, generates data-driven unit tests using @ParameterizedTest, @ValueSource, @CsvSource, @MethodSource. Creates tests that run the same logic with multiple input values. Use when writing data-driven Java tests, multiple test cases from single method, or boundary value analysis.
Security Assessment
About unit-test-parameterized
Unit Test Parameterized is a Java testing-guidance skill that provides patterns for writing data-driven unit tests with JUnit 5's parameterized testing support. It solves the problem of test duplication: instead of copying the same test method for each input, it shows how to run one test body across many inputs, which is ideal for boundary-value analysis and covering multiple scenarios from a single method.
The skill covers the full range of JUnit 5 argument sources — @ValueSource for simple primitives, strings, and enums; @CsvSource for tabular data; @MethodSource for complex objects and multi-argument cases; @EnumSource for enum values; and a custom @ArgumentsSource via an ArgumentsProvider implementation. It demonstrates readable custom display names using placeholders like {0}, error-condition testing with assertThatThrownBy, and integration with AssertJ assertions. It also documents best practices (descriptive display names, testing min/max/zero/edge cases, one focused assertion per parameter set) and constraints and warnings, such as matching parameter counts to the method signature, the primitives-only limitation of @ValueSource, CSV escaping rules for commas, and the requirement that @MethodSource factory methods be static.
It targets Java developers using JUnit 5 who want cleaner, more thorough tests. Use cases include validating input across many combinations (for example, email-validation truth tables), boundary analysis on numeric ranges, exercising all enum values, and asserting exceptions for invalid input. It is standard test-authoring guidance with no risky behavior.
FAQ
Which JUnit 5 argument sources are covered?
@ValueSource, @CsvSource, @MethodSource, @EnumSource, and a custom @ArgumentsSource implemented via an ArgumentsProvider, plus custom display names.
When should I use each source?
@ValueSource for simple values, @CsvSource for tabular data, @MethodSource for complex objects or multi-argument cases, and @EnumSource for enum values; a custom ArgumentsProvider handles anything more specialized.
What dependency is required?
The junit-jupiter artifact, which already includes junit-jupiter-params; the examples also use assertj-core for fluent assertions.
What are the main pitfalls to watch for?
The number of parameters from the source must match the test method signature, @ValueSource supports only primitives, strings, and enums (not objects or null directly), CSV strings containing commas must be single-quoted, and @MethodSource factory methods must be static in the same test class.
Can it test error conditions?
Yes. It shows using assertThatThrownBy to confirm invalid inputs (such as empty, blank, or null strings) throw the expected exception type.
Install unit-test-parameterized
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
giuseppe-trisciuoglio/developer-kit