Skip to content
Back to skills

Junit Core

ASecurity

JUnit 5 core testing patterns with AAA structure, test organization, and coverage standards

  • 666 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added February 9, 2026
toolsjavatestingapi

Works with

  • api

Security analysis

A100/100

Scanned February 10, 2026

npx -y skills add majiayu000/claude-skill-registry --skill junit-core --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Junit Core?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Junit Core
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-junit-core/badge)](https://www.skillsdirectory.com/skills/majiayu000-junit-core)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: junit-core
description: JUnit 5 core testing patterns with AAA structure, test organization, and coverage standards
user-invocable: false
allowed-tools: Read, Grep, Glob
---

# JUnit Core Skill

**REFERENCE MODE**: This skill provides reference material. Load specific standards on-demand based on current task.

JUnit 5 testing standards for general Java projects. This skill covers test structure, naming conventions, coverage requirements, and the AAA (Arrange-Act-Assert) pattern.

## Prerequisites

This skill applies to Java projects using JUnit 5:
- `org.junit.jupiter:junit-jupiter` (JUnit 5)

## Workflow

### Step 1: Load Core Testing Standards

**CRITICAL**: Load this standard for any testing work.

```
Read: standards/testing-junit-core.md
```

This provides foundational rules for:
- Test class requirements (1:1 mapping with production classes)
- AAA pattern (Arrange-Act-Assert)
- Coverage requirements (80% line/branch minimum)
- @DisplayName usage

### Step 2: Load Coverage Analysis (As Needed)

**Coverage Analysis** (load for coverage work):
```
Read: standards/coverage-analysis-pattern.md
```

Use when: Analyzing test coverage or improving coverage metrics.

## Key Rules Summary

### Test Class Requirements
```java
// CORRECT - One test class per production class
// TokenValidator.java → TokenValidatorTest.java
// UserService.java → UserServiceTest.java
```

### AAA Pattern (Arrange-Act-Assert)
```java
@Test
@DisplayName("Should validate token with correct issuer")
void shouldValidateTokenWithCorrectIssuer() {
    // Arrange
    String issuer = "https://example.com";
    Token token = createTokenWithIssuer(issuer);

    // Act
    ValidationResult result = validator.validate(token);

    // Assert
    assertTrue(result.isValid());
    assertEquals(issuer, result.getIssuer());
}
```

### DisplayName Annotations
```java
// CORRECT - Descriptive test names
@Test
@DisplayName("Should throw exception when token is null")
void shouldThrowExceptionWhenTokenIsNull() { }

@Test
@DisplayName("Should return empty when no users found")
void shouldReturnEmptyWhenNoUsersFound() { }
```

### Coverage Requirements
- Minimum 80% line coverage
- Minimum 80% branch coverage
- Critical paths: 100% coverage
- All public APIs must be tested

## Related Skills

- `pm-dev-java:junit-integration` - Maven integration testing
- `pm-dev-java-cui:cui-testing` - CUI test generator framework
- `pm-dev-java:java-core` - Core Java patterns

## Standards Reference

| Standard | Purpose |
|----------|---------|
| testing-junit-core.md | Test structure, AAA pattern, naming |
| coverage-analysis-pattern.md | Coverage analysis and improvement |

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.