- Home
- Skills
- Giuseppe Trisciuoglio
- Developer Kit
- Unit Test Boundary Conditions
unit-test-boundary-conditions_skill
- Python
99
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill giuseppe-trisciuoglio/developer-kit --skill unit-test-boundary-conditions- SKILL.md13.3 KB
Overview
This skill provides patterns and ready-made approaches for unit testing boundary conditions and edge cases using pure JUnit 5. It focuses on numeric limits, null/empty strings, collection sizes, floating-point precision, date/time edges, array indexing, and basic concurrent scenarios. Use it to make tests explicit about limits and to prevent silent failures like overflow or NaN surprises.
How this skill works
The skill inspects common boundary categories (min/max values, zero, null, empty, whitespace, tiny/huge floats, first/last indices, out-of-bounds, leap dates, timezone transitions, and basic concurrency cases). It recommends parameterized tests, tolerance-based float assertions, and explicit checks just below, at, and just above boundaries. Examples show JUnit 5 annotations, AssertJ assertions, and techniques such as Math.addExact() to detect overflow and CopyOnWrite collections to exercise concurrency behavior.
When to use it
- Validating behavior at API or library boundaries
- Ensuring functions handle null, empty, and whitespace inputs
- Checking numeric overflow/underflow and precision issues
- Verifying collection handling for empty, single, and large sets
- Testing date/time edge cases like leap years and timezone transitions
Best practices
- List and document domain-specific boundaries before writing tests
- Use @ParameterizedTest to cover multiple boundary values succinctly
- Test values just below, at, and just above each boundary
- Use tolerance-based assertions for floating point comparisons
- Use Math.addExact()/subtractExact to reveal integer overflow
- Keep large-collection tests mindful of memory and runtime costs
Example use cases
- Unit tests for input validation functions covering null, empty, whitespace, and length limits
- Numeric algorithms that must behave correctly at Integer.MIN_VALUE/MAX_VALUE and near-zero thresholds
- Collection utilities that must return sensible values for empty, single, and large lists
- Date utilities that must handle leap days, min/max LocalDate and DST transitions
- Array and index-access code verifying first, last, and out-of-bounds behavior
FAQ
Prioritize domain-critical boundaries: test just below, at, and just above each limit rather than every possible value.
How should I compare floating point results?
Never use exact equality; assert with a tolerance (for example AssertJ's isCloseTo within a small delta) appropriate to the domain.