rspec/rules/S2186/java/rule.adoc

11 lines
412 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
JUnit assertions should not be made from the ``++run++`` method of a ``++Runnable++``, because failed assertions result in ``++AssertionError++``s being thrown. If the error is thrown from a thread other than the one that ran the test, the thread will exit but the test won't fail.
== Noncompliant Code Example
----
public void run() {
// ...
Assert.assertEquals(expected, actual); // Noncompliant
}
----