rspec/rules/S3477/rule.adoc

20 lines
445 B
Plaintext
Raw Normal View History

== Why is this an issue?
If a ``++RuntimeException++`` is thrown while code is unit tested, it's likely to be thrown again in production. Therefore, test methods should be allowed to ``++throw RuntimeException++``s so you're alerted early to problems in the code.
=== Noncompliant code example
2022-02-04 17:28:24 +01:00
[source,text]
----
@Test
public void testTheThing() {
try {
// ...
} catch (RuntimeException e) { // Noncompliant
// ...
}
}
----