giuseppe-trisciuoglio/developer-kit / plugins/developer-kit-java/skills/unit-test-boundary-conditions
unit-test-boundary-conditions
VerifiedProvides edge case, corner case, boundary condition, and limit testing patterns for Java unit tests. Validates minimum/maximum values, null cases, empty collections, numeric overflow/underflow, floating-point precision, and off-by-one scenarios using JUnit 5 and AssertJ. Use when writing .java test files to ensure code handles limits, corner cases, and special inputs correctly.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 8.8 KB |
| references/concurrent-testing.md | markdown | 1.3 KB |
| references/parameterized-patterns.md | markdown | 1.9 KB |
references/parameterized-patterns.md
View on GitHub# Parameterized Boundary Testing Reference
## Multiple Boundary Cases
```java
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
class ParameterizedBoundaryTest {
@ParameterizedTest
@CsvSource({
"null, false",
"'', false",
"' ', false",
"a, true",
"abc, true"
})
void shouldValidateStringBoundaries(String input, boolean expected) {
boolean result = StringValidator.isValid(input);
assertThat(result).isEqualTo(expected);
}
@ParameterizedTest
@ValueSource(ints = {Integer.MIN_VALUE, 0, 1, -1, Integer.MAX_VALUE})
void shouldHandleNumericBoundaries(int value) {
assertThat(value).isNotNull();
}
static Stream<Arguments> edgeCaseProvider() {
return Stream.of(
Arguments.of(Integer.MIN_VALUE, "min"),
Arguments.of(-1, "negative"),
Arguments.of(0, "zero"),
Arguments.of(1, "positive"),
Arguments.of(Integer.MAX_VALUE, "max")
);
}
@ParameterizedTest
@MethodSource("edgeCaseProvider")
void shouldTestAllEdgeCases(int value, String description) {
assertThat(value).isNotNull();
}
}
```
## Off-By-One Testing
```java
class OffByOneBoundaryTest {
@ParameterizedTest
@CsvSource({
"-1, false",
"0, true",
"1, true",
"99, true",
"100, false",
"101, false"
})
void shouldValidateRangeBoundaries(int value, boolean expected) {
boolean inRange = value >= 0 && value <= 100;
assertThat(inRange).isEqualTo(expected);
}
@Test
void shouldHandleArrayIndexOffByOne() {
int[] array = {1, 2, 3};
assertThat(array.length).isEqualTo(3);
assertThat(array[0]).isEqualTo(1);
assertThat(array[array.length - 1]).isEqualTo(3);
}
}
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |