← ClaudeAtlas

test-qualitylisted

Write high-quality JUnit 5 tests with AssertJ assertions. Use when user says "add tests", "write tests", "improve test coverage", or when reviewing/creating test classes for Java code.
decebals/claude-code-java · ★ 599 · Testing & QA · score 82
Install: claude install-skill decebals/claude-code-java
# Test Quality Skill (JUnit 5 + AssertJ) Write high-quality, maintainable tests for Java projects using modern best practices. ## When to Use - Writing new test classes - Reviewing/improving existing tests - User asks to "add tests" / "improve test coverage" - Code review mentions missing tests ## Framework Preferences ### JUnit 5 (Jupiter) ```java import org.junit.jupiter.api.Test; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; import static org.assertj.core.api.Assertions.*; ``` ### AssertJ over standard assertions ✅ **Use AssertJ**: ```java assertThat(plugin.getState()) .as("Plugin should be started after initialization") .isEqualTo(PluginState.STARTED); assertThat(plugins) .hasSize(3) .extracting(Plugin::getId) .containsExactly("plugin1", "plugin2", "plugin3"); ``` ❌ **Avoid JUnit assertions**: ```java assertEquals(PluginState.STARTED, plugin.getState()); // Less readable assertTrue(plugins.size() == 3); // Less descriptive failures ``` ## Test Structure (AAA Pattern) Always use Arrange-Act-Assert pattern: ```java @Test @DisplayName("Should load plugin from valid directory") void shouldLoadPluginFromValidDirectory() { // Arrange - Setup test data and dependencies Path pluginDir = Paths.get("test-plugins/valid-plugin"); PluginLoader loader = new DefaultPluginLoader(); // Act - Execute the behavior being tested Plugin plugin = loader.load(pluginDir