LogoAwesome Skills
  • Search
  • Category
  • Tag
  • Blog
LogoAwesome Skills
LogoAwesome Skills

Discover Open-Source Agent Skills for AI Coding Assistants

Product

  • Search
  • Category
  • Tag
  • Blog

Resources

  • Claude Skill Docs
  • Antigravity Skills Docs

Tools

  • Claude Code
  • OpenCode
  • Cursor
  • Codex
  • Antigravity

Company

  • Privacy Policy
  • Terms of Service
  • Sitemap

©2026 Awesome Skills. All rights reserved.

Privacy PolicyTerms
Back to Skills

unit-test-boundary-conditions

Provides 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.

303stars34forksUpdated 7/9/2026
Developer Tools#assertj#edge-cases#junit5#unit-testing#java#boundary-testing

Security Assessment

Safe(100/100)
Security Score100/100

About unit-test-boundary-conditions

Provides systematic patterns for testing boundary conditions, corner cases, and limit values in Java using JUnit 5 and AssertJ. It targets the inputs where defects cluster: numeric minimums and maximums, zero, null, empty and whitespace strings, empty and single-element collections, arithmetic overflow and underflow, floating-point precision, date/time edges, off-by-one errors, and array index limits. The recommended process starts by cataloguing the relevant boundaries, such as numeric limits like Integer.MIN_VALUE and MAX_VALUE, string states, and collection sizes of 0, 1, and many. Parameterized tests using @ParameterizedTest with @ValueSource or @CsvSource drive many boundary values through a single test, and each boundary is exercised on both sides: just below, at, and just above. Tests are run after each boundary category so issues surface early, and failures are used to discover further untested edges to cover. Concrete example suites are included for each category. Integer tests cover the full min/max range and use Math.addExact() and Math.subtractExact() to detect silent overflow and underflow via ArithmeticException. String tests reject empty and whitespace inputs and handle null, single characters, and very long strings. Collection tests explicitly cover empty, single, and large lists plus nulls inside collections. Floating-point tests avoid exact equality, instead asserting closeness with isCloseTo(expected, within(tolerance)), and verify special values like POSITIVE_INFINITY, NEGATIVE_INFINITY, and NaN. Date/time tests check LocalDate.MIN and MAX, leap-year handling, and invalid dates such as Feb 29 in a non-leap year. Array tests confirm first and last element access and expected ArrayIndexOutOfBoundsException on negative, out-of-range, and empty-array access. Intended for use when writing .java test files, it requires the junit-jupiter, junit-jupiter-params, and assertj-core dependencies. Emphasized best practices include testing null and empty separately from valid inputs, verifying error messages for invalid boundaries, documenting why each boundary matters for the domain, and never relying on random testing to reach edge cases.

FAQ

Which frameworks and libraries are needed?

JUnit 5 (junit-jupiter), JUnit's parameter support (junit-jupiter-params), and AssertJ (assertj-core).

How should floating-point values be asserted?

Never with exact equality. Use AssertJ's tolerance-based isCloseTo(expected, within(tolerance)), and account for special values such as NaN, POSITIVE_INFINITY, and NEGATIVE_INFINITY.

How does it catch integer overflow?

By using Math.addExact() and Math.subtractExact(), which throw ArithmeticException on overflow or underflow instead of silently wrapping around.

What collection states are recommended for testing?

Empty (0), single (1), and many (greater than 1) elements, plus collections that contain null values.

How are multiple boundary values tested efficiently?

With parameterized tests using @ParameterizedTest and @ValueSource or @CsvSource, covering values just below, at, and just above each boundary.

All Files

3 files
SKILL.md8.8 KB
View
references/parameterized-patterns.md1.9 KB
View
references/concurrent-testing.md1.3 KB
View

Install unit-test-boundary-conditions

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill

Repository

giuseppe-trisciuoglio/developer-kit

Related Skills

dbt-sf-to-bq-translator

21,076

build-models

102

html-prototype

3,588

doc

448