131-java-testing-unit-testing — скилл для Claude Code: как установить
Скилл помогает писать и рефакторить модульные тесты на Java по стандартам JUnit 5, AssertJ и Mockito. Он находит антипаттерны вроде общего состояния и проверяет граничные условия.
npx skills add jabrena/plinth --skill 131-java-testing-unit-testing -a claude-codeЧто делает 131-java-testing-unit-testing
Скилл задаёт правила рефакторинга и написания юнит-тестов для Java. Он помогает перейти с JUnit 4 на JUnit 5. Стандартные проверки заменяются на методы AssertJ через assertThat, а зависимости изолируются через Mockito. Тесты строятся по шаблону Given-When-Then с проверкой граничных условий по RIGHT-BICEP и CORRECT.
Внутри заложен строгий рабочий процесс. Сначала агент запускает сборку через ./mvnw compile или mvn compile. Если проект не компилируется, скилл блокирует любые правки в тестах до устранения ошибок. Это страхует от пустой работы на заведомо сломанной кодовой базе.
После компиляции скилл сверяется со справочником references/131-java-testing-unit-testing.md, настраивает аннотации JSpecify и параметризованные тесты. Завершается цикл контрольным прогоном ./mvnw clean verify.
Какие задачи решает
- обновить тесты с JUnit 4 на JUnit 5
- переписать проверки на AssertJ и
assertThatThrownBy - настроить моки зависимостей через Mockito без общего состояния
- добавить параметризованные тесты через
@ValueSourceили@CsvSource - устранить использование рефлексии в тестовых классах
Примеры запросов агенту
- Проверь модульные тесты в этом модуле и переведи их с JUnit 4 на JUnit 5
- Перепиши тесты для сервиса с использованием AssertJ и изолируй зависимости через Mockito
- Добавь параметризованные тесты с
@MethodSourceдля проверки граничных условий
Как установить 131-java-testing-unit-testing
1Через Skills CLI (Vercel)
npx skills add jabrena/plinth --skill 131-java-testing-unit-testing -a claude-code2Вручную: положить файлы
~/.claude/skills/131-java-testing-unit-testing/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/131-java-testing-unit-testing/
1Через Skills CLI (Vercel)
npx skills add jabrena/plinth --skill 131-java-testing-unit-testing -a codex2Вручную: положить файлы
.agents/skills/131-java-testing-unit-testing/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add jabrena/plinth --skill 131-java-testing-unit-testing -a cursor2Вручную: положить файлы
.cursor/skills/131-java-testing-unit-testing/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install jabrena/plinth 131-java-testing-unit-testing2Вручную: положить файлы
.github/skills/131-java-testing-unit-testing/SKILL.md1Через Skills CLI (Vercel)
npx skills add jabrena/plinth --skill 131-java-testing-unit-testing -a gemini-cli2Командой платформы
gemini skills install https://github.com/jabrena/plinth --path skills/131-java-testing-unit-testingВручную: положить файлы
.devin/skills/131-java-testing-unit-testing/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add jabrena/plinth --skill 131-java-testing-unit-testing -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Из того же набора40
Похожие
Рядом в теме «Тесты и QA»
Всё по теме «Тесты и QA» →Вопросы о 131-java-testing-unit-testing
Как установить 131-java-testing-unit-testing в Claude Code?
Выполните команду npx skills add jabrena/plinth --skill 131-java-testing-unit-testing -a claude-code в терминале.
Что делает скилл 131-java-testing-unit-testing?
Скилл направляет агента при рефакторинге и написании Java-тестов, внедряя JUnit 5, AssertJ, Mockito и аннотации JSpecify. Он также помогает избавиться от тестов на рефлексии и общего изменяемого состояния.
Что требуется для запуска правок по этому скиллу?
Проект обязан успешно компилироваться: перед внесением любых изменений запускается ./mvnw compile или mvn compile. При ошибке сборки скилл немедленно останавливает работу.
Исходный текст
SKILL.md · Apache-2.0
--- name: 131-java-testing-unit-testing description: Use when you need to review, improve, or write Java unit tests — including migrating from JUnit 4 to JUnit 5, adopting AssertJ for fluent assertions, structuring tests with Given-When-Then, ensuring test independence, applying parameterized tests, mocking dependencies with Mockito, verifying boundary conditions (RIGHT-BICEP, CORRECT, A-TRIP), leveraging JSpecify null-safety annotations, or eliminating testing anti-patterns such as reflection-based tests or shared mutable state. This should trigger for requests such as Review Java code for unit tests; Apply best practices for unit tests in Java code; Write fast JUnit unit tests for Java code; Improve Mockito-based Java unit tests; Refactor Java tests to isolate collaborators. Part of Plinth Toolkit license: Apache-2.0 metadata: author: Juan Antonio Breña Moral version: 0.19.0 --- # Java Unit testing guidelines Review and improve Java unit tests using modern JUnit 5, AssertJ, and Mockito best practices. **What is covered in this Skill?** - JUnit 5 annotations: `@Test`, `@BeforeEach`, `@AfterEach`, `@DisplayName`, `@Nested`, `@ParameterizedTest` - AssertJ fluent assertions: `assertThat`, `assertThatThrownBy` - Given-When-Then test structure, descriptive test naming, single-responsibility tests - Test independence and isolated state - Parameterized tests: `@ValueSource`/`@CsvSource`/`@MethodSource` - Mockito dependency mocking: `@Mock`, `@InjectMocks`, `MockitoExtension` - Code coverage guidance (JaCoCo), package-private test visibility - Testing anti-patterns: reflection, shared state, hard-coded values, testing implementation details - Error handling: `assertThatThrownBy`, exception messages - JSpecify null-safety: `@NullMarked`, `@Nullable` - RIGHT-BICEP coverage principles, A-TRIP test quality, CORRECT boundary condition verification **Scope:** The reference is organized by examples (good/bad code patterns) for each core area. Apply recommendations based on applicable examples. ## Constraints Before applying any unit test changes, ensure the project compiles. If compilation fails, stop immediately — do not proceed until resolved. After applying improvements, run full verification. - **MANDATORY**: Run `./mvnw compile` or `mvn compile` before applying any change - **SAFETY**: If compilation fails, stop immediately and do not proceed — compilation failure is a blocking condition - **VERIFY**: Run `./mvnw clean verify` or `mvn clean verify` after applying improvements - **BEFORE APPLYING**: Read the reference for detailed examples, good/bad patterns, and constraints ## When to use this skill - Review Java code for unit tests - Apply best practices for unit tests in Java code - Write fast JUnit unit tests for Java code - Improve Mockito-based Java unit tests - Refactor Java tests to isolate collaborators ## Workflow 1. **Compile project before unit-test changes** Run `./mvnw compile` or `mvn compile` and stop immediately if compilation fails. 2. **Read unit-testing reference and evaluate coverage** Read `references/131-java-testing-unit-testing.md` and identify modernization and quality gaps in current tests. 3. **Apply unit-testing best practices** Implement or refactor tests using JUnit 5, AssertJ, Mockito, parameterization, and stronger boundary checks. 4. **Verify with full build** Run `./mvnw clean verify` or `mvn clean verify` after applying improvements. ## Reference For detailed guidance, examples, and constraints, see [references/131-java-testing-unit-testing.md](references/131-java-testing-unit-testing.md).
© Juan Antonio Breña Moral · Apache-2.0 · jabrena/plinth