rspec/rules/S3658/java/rule.adoc
Alban Auzeill 2c306d110e Fix code block ambiguity with old header style
Ensure blank line before list and clean the one leading space
2020-06-30 17:16:12 +02:00

16 lines
517 B
Plaintext

When the code under test in a unit test throws an exception, the test itself fails. Therefore, there is no need to surround the tested code with a <code>try</code>-<code>catch</code> structure to detect failure. Instead, you can simply move the exception type to the method signature.
This rule raises an issue when there is a fail assertion inside a <code>catch</code> block.
Supported frameworks:
* JUnit3
* JUnit4
* JUnit5
* Fest assert
* AssertJ
include::../noncompliant.adoc[]
include::../compliant.adoc[]