Why this matters
Explicit exception and time boundaries reduce flakiness and hangs.
Use assertThrows for exception cases and annotate long-running tests with @Timeout to bound execution; use @TempDir for file I/O.
Explicit exception and time boundaries reduce flakiness and hangs.
Side-by-side examples engineers can pattern-match during review.
@Test void parses(){ new Parser().parse(null); / no assertion / }@Test @Timeout(2)
void parses(){
assertThrows(NullPointerException.class, () -> new Parser().parse(null));
}assertThrows(IllegalArgumentException.class, () -> f())@Test void x(){ f(); } // no assertsFrom the same buckets as this rule.
Reject PRs adding real PAN/CVV in fixtures, seeds, or mocks. Only use Luhn-valid test PANs from the gateway or opaque tokens (e.g., tok_) and never include CVV. Add a check to fail if a PAN regex is matched. (PCI DSS data minimization)