SONARJAVA-6406 Create rule S8714 - Use assertThrows/assertDoesNotThrow instead of try-catch with fail()#5642
SONARJAVA-6406 Create rule S8714 - Use assertThrows/assertDoesNotThrow instead of try-catch with fail()#5642rombirli wants to merge 13 commits into
Conversation
Agentic Analysis: Early ResultsAgentic Analysis and Context Augmentation are available on your project. Here are some issues that could have been prevented. Follow the links to learn how to put them into action. 17 issue(s) found across 1 file(s):
Analyzed by SonarQube Agentic Analysis in 10.4 s |
✅ Code review updated (blocking issues remain unresolved).
319c62c to
0cb3ee1
Compare
|
Code Review ✅ Approved 4 resolved / 4 findingsImplements rule S8714 to replace try-catch blocks with JUnit assertions, resolving compilation errors in the test suite and refining the suggestion logic. ✅ 4 resolved✅ Bug: Test uses no-op check so verifyIssues() will always fail
✅ Bug: Method doesBlockFail does not exist; code won't compile
✅ Bug: Wrong suggestion: try-block fail() should recommend assertThrows
✅ Bug: Autoscan shows rule S8714 finds zero true positives (33 false negatives)
Tip Comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |




Summary by Gitar
java-S8714.jsonto the ruling test resources, documenting test case coverage and expectations for the new rule.This will update automatically on new commits.