Skip to content

feat(instructions): add Java JUnit 5 assertions best practices 🤖🤖🤖#1765

Open
burakkaygusuz wants to merge 2 commits into
github:stagedfrom
burakkaygusuz:feat/java-junit5-assertions
Open

feat(instructions): add Java JUnit 5 assertions best practices 🤖🤖🤖#1765
burakkaygusuz wants to merge 2 commits into
github:stagedfrom
burakkaygusuz:feat/java-junit5-assertions

Conversation

@burakkaygusuz
Copy link
Copy Markdown

This PR introduces a comprehensive instruction set for Java JUnit 5 (Jupiter) Assertions, optimized for GitHub Copilot.

🎯 Purpose

To provide GitHub Copilot with clear, technical, and performance-oriented guidelines for generating and refactoring Java test code using modern JUnit 5.8+ features.

🚀 Key Features:

  • Performance & Lazy Evaluation: Enforces Supplier<String> for expensive failure messages to avoid overhead in passing tests.
  • Modern Jupiter APIs: Explicitly covers assertThrowsExactly (JUnit 5.8+) and assertInstanceOf for better type safety and stricter testing.
  • SLA & Deadlines: Provides guidelines for assertTimeout vs assertTimeoutPreemptively with explicit warnings about ThreadLocal propagation.
  • Readability & Standards: Standardizes "Expected Value First" ordering and promotes grouping related assertions with assertAll.
  • Anti-Pattern Prevention: Actively prevents legacy JUnit 4 imports, suppressing assertions, and using weak boolean checks instead of semantic equality assertions.

🛠️ Verification & Quality:

  • Ran npm install and npm run build to update README.instructions.md.
  • Verified all technical content against official JUnit 5 documentation.
  • Normalized line endings to LF using bash eng/fix-line-endings.sh.
  • Followed lowercase-hyphenated naming convention: java-junit5-assertions.instructions.md.

This contribution aligns with the repository'''s standards for high-quality, actionable AI instructions. 🤖🤖🤖

@github-actions github-actions Bot added instructions PR touches instructions new-submission PR adds at least one new contribution labels May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

instructions PR touches instructions new-submission PR adds at least one new contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant