Generates JUnit 5 parameterized tests so you can run the same test logic against multiple input combinations without duplicating code. Covers @ValueSource for primitives and strings, @CsvSource for tabular test cases, @MethodSource when you need complex objects, and @EnumSource for enum exhaustiveness checks. Good for boundary value testing, email validation with known good and bad inputs, that sort of thing. The examples show readable patterns with custom display names and proper assertion structure. Watch out for the parameter count matching requirement and remember @MethodSource factory methods must be static. Honestly just saves you from writing fifteen nearly identical test methods when you could write one with fifteen parameter sets.

skills.sh installs
3.9K
GitHub stars
369
last updated
Aug 21, 2026

Install

$ npx -y skills add giuseppe-trisciuoglio/developer-kit --skill unit-test-parameterized --agent claude-code

Installs into .claude/skills of the current project.

Files

Parameterized Unit Tests with JUnit 5

Overview

Provides patterns for parameterized unit tests in Java using JUnit 5. Covers @ValueSource, @CsvSource, @MethodSource, @EnumSource, @ArgumentsSource, and custom display names. Reduces test duplication by running the same test logic with multiple input values.

When to Use

  • Writing JUnit tests with multiple input combinations
  • Implementing data-driven tests in Java
  • Running same test with different values (boundary analysis)
  • Testing multiple scenarios from single test method

Instructions

  1. Add dependency: Ensure junit-jupiter-params is on test classpath (included in junit-jupiter)
  2. Choose source: @ValueSource for simple values, @CsvSource for tabular data, @MethodSource for complex objects
  3. Match parameters: Test method parameters must match data source types
  4. Set display names: Use name = "{0}..." for readable output
  5. Validate: Run ./gradlew test --info or mvn test and verify all parameter combinations execute

Examples

Maven / Gradle Dependency

JUnit 5 parameterized tests require junit-jupiter (includes params). Add assertj-core for assertions:

Sponsors

Details

Repository
github.com/giuseppe-trisciuoglio/developer-kit
Categories
Testing & QA, Documentation, Java & JVM
First seen
May 16, 2026

More from giuseppe-trisciuoglio/developer-kit

All 102
1giuseppe-trisciuoglio avatarunit-test-json-serializationgiuseppe-trisciuoglio/developer-kitProvides patterns for unit testing JSON serialization/deserialization with Jackson and `@JsonTest`. Validates JSON mapping, custom serializers, date formats, an3.9Kskills.sh installs
2giuseppe-trisciuoglio avatarunit-test-security-authorizationgiuseppe-trisciuoglio/developer-kitProvides patterns for unit testing Spring Security with `@PreAuthorize`, `@Secured`, `@RolesAllowed`. Validates role-based access control and authorization poli3.9Kskills.sh installs
3giuseppe-trisciuoglio avatarunit-test-scheduled-asyncgiuseppe-trisciuoglio/developer-kitProvides patterns for unit testing Spring `@Scheduled` and `@Async` methods using JUnit 5, CompletableFuture, Awaitility, and Mockito. Covers mocking task execu3.9Kskills.sh installs
4giuseppe-trisciuoglio avatarunit-test-utility-methodsgiuseppe-trisciuoglio/developer-kitProvides patterns for testing utility classes, static methods, and helper functions. Validates pure functions, null handling, edge cases, and boundary condition3.9Kskills.sh installs
5giuseppe-trisciuoglio avatarunit-test-exception-handlergiuseppe-trisciuoglio/developer-kitProvides patterns for unit testing `@ExceptionHandler` and `@ControllerAdvice` in Spring Boot applications. Validates error response formatting, mocks exception3.9Kskills.sh installs
6giuseppe-trisciuoglio avatarunit-test-config-propertiesgiuseppe-trisciuoglio/developer-kitProvides patterns for unit testing `@ConfigurationProperties` classes with `@ConfigurationPropertiesTest`. Validates property binding, tests validation constrai3.8Kskills.sh installs