From a3e6aec03d8abb065f4941a4a2b8690f56c58039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=A4r?= Date: Wed, 13 May 2026 13:58:56 +0200 Subject: [PATCH] Enhance Java test rules with exception and parameterization guidelines Added new Java test rules for exception handling and parameterized tests. --- doc/spec/design/quality_requirements.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/spec/design/quality_requirements.md b/doc/spec/design/quality_requirements.md index a781d398..80972ae7 100644 --- a/doc/spec/design/quality_requirements.md +++ b/doc/spec/design/quality_requirements.md @@ -115,6 +115,9 @@ The following rules are written for both human contributors and coding agents. T 1. Use Hamcrest matchers for assertions. 2. Extract repeated complex assertions into dedicated matcher classes when that improves readability. +3. Declare only the specific checked exceptions that are directly thrown by the code under test. Do not use generic exceptions (e.g., Exception, Throwable) in test method signatures. +4. When asserting exceptions, the assertion should invoke exactly one method call—the method under test. Avoid nesting additional method calls inside the assertion. Prepare all inputs outside the assertion so the failure is attributable to a single call. +5. Prefer @ParameterizedTest for testing multiple input variations instead of generating or mutating test data within a single test method (e.g., loops or inline variations). ## Dependency Policy