Skip to content

giuseppe-trisciuoglio/developer-kit / plugins/developer-kit-java/skills/unit-test-boundary-conditions

unit-test-boundary-conditions

Verified

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.

FileKindSize
SKILL.mdskill md8.8 KB
references/concurrent-testing.mdmarkdown1.3 KB
references/parameterized-patterns.mdmarkdown1.9 KB

references/concurrent-testing.md

View on GitHub
# Concurrent Boundary Testing Reference

## Null and Race Conditions

```java
import java.util.concurrent.*;

class ConcurrentBoundaryTest {

  @Test
  void shouldHandleNullInConcurrentMap() {
    ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>();

    map.put("key", "value");
    assertThat(map.get("nonexistent")).isNull();
  }

  @Test
  void shouldHandleConcurrentModification() {
    List<Integer> list = new CopyOnWriteArrayList<>(List.of(1, 2, 3, 4, 5));

    for (int num : list) {
      if (num == 3) {
        list.add(6);
      }
    }

    assertThat(list).hasSize(6);
  }

  @Test
  void shouldHandleEmptyBlockingQueue() throws InterruptedException {
    BlockingQueue<String> queue = new LinkedBlockingQueue<>();

    assertThat(queue.poll()).isNull();
  }
}
```

## Thread Safety Patterns

```java
class ThreadSafetyBoundaryTest {

  @Test
  void shouldHandleAtomicOperations() {
    AtomicInteger counter = new AtomicInteger(0);

    counter.incrementAndGet();
    counter.addAndGet(Integer.MAX_VALUE);

    assertThat(counter.get()).isGreaterThan(0);
  }

  @Test
  void shouldHandleSynchronizedBlocks() {
    Object lock = new Object();
    int[] count = {0};

    synchronized (lock) {
      count[0]++;
    }

    assertThat(count[0]).isEqualTo(1);
  }
}
```
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
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: 198kUpdated Claude CodeCodexVerifiedInstall