unit-test-scheduled-async

Installation
SKILL.md

Unit Testing @Scheduled and @Async Methods

Overview

Patterns for unit testing Spring @Scheduled and @Async methods with JUnit 5. Test CompletableFuture results, use Awaitility for race conditions, mock scheduled task execution, and validate error handling — without waiting for real scheduling intervals.

When to Use

  • Testing @Scheduled method logic
  • Testing @Async method behavior
  • Verifying CompletableFuture results
  • Testing async error handling
  • Testing cron expression logic without waiting for actual scheduling
  • Validating thread pool behavior and execution counts
  • Testing background task logic in isolation

Instructions

  1. Call @Async methods directly — bypass Spring's async proxy; the annotation is irrelevant in unit tests
Related skills

More from giuseppe-trisciuoglio/developer-kit-claude-code

Installs
19
GitHub Stars
246
First Seen
Feb 21, 2026