unit-test-boundary-conditions

Validate boundary and edge-case behaviors in JUnit 5 tests.

Updated Apr 5, 2026
One-click install
npx skills add https://github.com/rizaldiem/digital-invitation-web_V2 --skill unit-test-boundary-conditions-rizaldiem
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: unit-test-boundary-conditions
Source: https://github.com/rizaldiem/digital-invitation-web_V2/tree/main/.windsurf/skills/unit-test-boundary-conditions
Command: npx skills add https://github.com/rizaldiem/digital-invitation-web_V2 --skill unit-test-boundary-conditions-rizaldiem

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides systematic patterns and examples to catch boundary-related defects that commonly escape unit tests, helping teams avoid crashes, incorrect calculations, and data corruption caused by limits and special inputs.

Core Features & Use Cases

  • Numeric boundaries: Tests for Integer.MIN_VALUE/MAX_VALUE, overflow/underflow detection, zero handling, and off-by-one checks.
  • String and collection edges: Tests for null, empty, whitespace-only, single-item, large collections, duplicates, and nulls inside collections.
  • Floating point and dates: Guidance for tolerance-based floating point assertions, NaN/Infinity handling, leap years, min/max dates, and timezone edge cases.
  • Arrays and concurrency: Patterns for index bounds, empty arrays, concurrent collection behavior, and race-condition resilience.
  • Use Case: Validate a payment calculation library against integer overflows, floating point rounding, empty input collections, and date boundary transitions.

Quick Start

Run a parameterized JUnit 5 test that checks Integer.MIN_VALUE, 0, and Integer.MAX_VALUE along with a floating-point comparison using a tolerance to verify boundary behavior.

Frequently Asked Questions about unit-test-boundary-conditions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test integer overflow and underflow in JUnit 5?▼

Test integer overflow and underflow in JUnit 5 by applying explicit checks using Math.addExact and Math.subtractExact to catch numeric limit exceptions. Parameterized tests validate behavior across Integer.MIN_VALUE, zero, and Integer.MAX_VALUE.

What is the best way to handle floating-point precision in JUnit parameterized tests?▼

Handle floating-point precision in JUnit parameterized tests by using tolerance-based assertions. This ensures accurate comparisons for edge cases involving NaN and Infinity, preventing rounding errors from failing valid numeric calculations.

How do I cover null and empty string edge cases in Java unit tests?▼

Cover null and empty string edge cases in Java unit tests by applying parameterized patterns for null, empty, and whitespace-only inputs. This systematically catches string boundary defects that commonly escape standard test coverage.

Can I use parameterized tests for date and timezone extremes in Java?▼

You can use parameterized tests for date and timezone extremes in Java to validate leap years, min/max dates, and timezone transitions. This ensures date calculations remain reliable across critical temporal boundaries.

Does JUnit 5 support testing concurrent collection behavior and race conditions?▼

JUnit 5 supports testing concurrent collection behavior and race conditions through specific patterns targeting thread safety. These tests validate resilience against concurrent modification and verify array index bounds under simultaneous access.