unit-tests-java

Installation
SKILL.md

Adding Unit Tests (Java)

Use this skill when the user requests the creation or update of unit tests in a Java project using JUnit 5, Mockito, and AssertJ. For other languages, use the unit-tests skill.

Instructions

Follow these steps to generate unit tests:

  1. Naming Convention: Name the test class {ClassName}Test. Name methods should{Behavior}When{Condition} (camelCase).
  2. Structure:
    • Location: src/test/java/ mirroring the source package structure.
    • Use // Given, // When, // Then style comments in test methods.
    • NO OTHER COMMENTS/JAVADOCS: Do not add method-level or class-level Javadocs unless absolutely necessary.
  3. Dependencies:
    • Use JUnit 5 (@Test, @ExtendWith(MockitoExtension.class)).
    • Use Mockito for mocking (@Mock, @InjectMocks).
    • Use AssertJ for assertions (assertThat()).
    • Implement WithAssertions interface in the test class to avoid static imports for assertions.
  4. Select Pattern: Choose the appropriate testing pattern below based on the verification needs (Basic, Exception, Parameterized, etc.).
Installs
12
First Seen
Apr 13, 2026
unit-tests-java — andresnator/agents-orchestrator