/mainframe-natural-adabas-classic:java-junitfrom mainframe-natural-adabas-classic
Apply JUnit 5 best practices for Java tests: Maven/Gradle setup, parameterized tests, lifecycle hooks, assertions, Mockito isolation, tags, nested tests, and test commands.
Ships in mainframe-natural-adabas-classic. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Guide Java test implementation by turning behavior requirements into focused JUnit 5 tests that use idiomatic project structure, per-test lifecycle hooks, data-driven parameterized data, assertions, mocking, human-readable organization, and build-tool validation.
@ParameterizedTest."| Concern | Rule |
|---|---|
| Structure | Use standard Maven or Gradle layout; put tests in src/test/java. |
| Dependencies | Include junit-jupiter-api, junit-jupiter-engine, and junit-jupiter-params for parameterized tests. |
| Commands | Run mvn test or gradle test; narrow with build-tool filters when needed. |
| Class names | Use a Test suffix, for example CalculatorTest for Calculator. |
| Feature | Use | Notes |
|---|---|---|
@Test | Standard test methods. | One behavior per test. |
| Arrange-Act-Assert | Test body shape. | Keep setup, action, and verification clear. |
methodName_should_expectedBehavior_when_scenario | Descriptive naming. | Match existing project style if stronger. |
@BeforeEach / @AfterEach | Per-test setup and teardown. | Reset mutable state. |
@BeforeAll / @AfterAll | Per-class setup and teardown. | Static by default unless using a per-class lifecycle. |
@DisplayName | Human-readable class or method names. | Useful for business-readable scenarios. |
@Nested | Group related scenarios. | Keeps context-specific setup close to tests. |
| Source | Use it for | Notes |
|---|---|---|
@ParameterizedTest | Any test run with multiple input rows. | Pair with exactly one source. |
@ValueSource | Simple literal strings, ints, longs, doubles, classes, or booleans. | Best for one-parameter tests. |
@MethodSource | Factory method returning Stream, Collection, iterable, or arguments. | Best for computed or named cases. |
@CsvSource | Small inline comma-separated rows. | Keep rows readable. |
@CsvFileSource | CSV file from the classpath. | Use for larger stable datasets. |
@EnumSource | Enum constants. | Filter modes are useful for subsets. |
| Need | Assertion |
|---|---|
| Equality | assertEquals(expected, actual); baseline form assertEquals. |
| Truthiness | assertTrue, assertFalse. |
| Nullability | assertNotNull, assertNull. |
| Exception path | assertThrows. |
| No exception path | assertDoesNotThrow. |
| Multiple related checks | assertAll so all assertions run before failure. |
| Fluent style | AssertJ assertThat(...).is... only if the project already uses or accepts AssertJ. |
Import static methods from org.junit.jupiter.api.Assertions. Add descriptive messages when they make failure diagnostics clearer.
| Technique | Use when | Avoid |
|---|---|---|
| Mockito | Collaborators need isolation. | Mocking value objects or the class under test. |
@Mock | Declare mock dependencies. | Manual mock setup repeated across tests. |
@InjectMocks | Construct class under test from mocks. | Hiding complex construction that should be explicit. |
| Interfaces | Facilitate mocking and substitutions. | Introducing interfaces solely for trivial classes. |
| Packages | Group tests by feature or component. | Dumping all tests into one utility package. |
@Tag("fast"), @Tag("integration") | Categorize suites; baseline shorthand @Tag. | Using tags to hide slow tests instead of fixing scope. |
@TestMethodOrder(MethodOrderer.OrderAnnotation.class) and @Order | Only when order is strictly necessary. | Routine unit tests; independence is preferred. |
@Disabled | Temporary skip with a reason. | Permanent silent skips. |
@TestMethodOrder only for rare ordered workflows, not normal unit tests.@SpringBootTest for ordinary unit tests: prefer plain JUnit and Mockito unless a Spring context is required.@Disabled: include a reason and track follow-up work.## JUnit 5 test plan
**Target:** `<class or behavior>`
**Command:** `mvn test` or `gradle test`
| Test | Annotation | Data source | Behavior verified |
| --- | --- | --- | --- |
| `<methodName_should_expectedBehavior_when_scenario>` | `@Test` or `@ParameterizedTest` | `<none / ValueSource / MethodSource / CsvSource / CsvFileSource / EnumSource>` | `<single behavior>` |
### Notes
- Lifecycle: `<BeforeEach/AfterEach/BeforeAll/AfterAll or none>`
- Assertions: `<Assertions or AssertJ>`
- Isolation: `<Mockito mocks or real collaborators>`
src/test/java and run with mvn test or gradle test.junit-jupiter-api, junit-jupiter-engine, and junit-jupiter-params when parameterized tests are used.@Test or @ParameterizedTest appropriately and follow Arrange-Act-Assert.assertThrows or assertDoesNotThrow where relevant.@Nested are used only when they clarify the test suite.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
junit5, java-testing, unit-testing, mockito, parameterized-tests
npx claudepluginhub gbb-acelerators/awesome-harness-primitives --plugin mainframe-natural-adabas-classic25 skills in this plugin
/adabas-postgresql-migrationModel Adabas files, DDM and FDT definitions, MU and PE structures, packed and unpacked numerics, descriptors, and ISN identity as a PostgreSQL schema, then prove equivalence with recorded reconciliation numbers. Use when designing or reviewing an Adabas to PostgreSQL data migration, mapping legacy field formats to column types, deciding child-table versus array storage, or verifying that migrated data matches the legacy source./code-modernizationUse this skill when the user asks to modernize legacy code with a disciplined GitHub Copilot workflow: brief, assess, map, extract business rules, reimagine architecture, transform modules, and harden with tests and security review. Trigger for COBOL, JCL, legacy Java, .NET, C++, classic ASP, monolith modernization, behavior-preserving rewrite, business-rule extraction, modernization assessment, or legacy-to-modern transformation./create-architectural-decision-recordCreate an Architectural Decision Record (ADR) as a structured Markdown document with front matter, coded consequences, alternatives, implementation notes, and references. Use when the user asks to document an architecture decision, create an ADR, capture alternatives and trade-offs, or save a decision under docs/adr./github-actions-hardeningReview, audit, author, and harden GitHub Actions workflows against Actions-specific threats: untrusted-input script injection, privileged trigger escalation, mutable action references, over-scoped GITHUB_TOKEN permissions, unsafe GITHUB_ENV/GITHUB_OUTPUT writes, secret exposure, OIDC misuse, and self-hosted runner risk. Use for .github/workflows/*.yml, secure my CI, pull_request_target danger, SHA pinning, or permissions lockdown./java-springbootApply Spring Boot best practices for project structure, dependency injection, configuration, REST controllers, DTO validation, services, transactions, Spring Data JPA, logging, testing, and security. Use when asked for Spring Boot guidance or to implement Java backend code./legacy-business-rule-extractionExtract cited business-rule cards from legacy code, batch jobs, database definitions, screens, and process documents while separating observed behavior from inferred intent. Use when requirements, target design, or behavior-preserving modernization need an evidence-backed rule catalog.Other plugins' skills for the same job