
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
46 lines
1.2 KiB
Plaintext
46 lines
1.2 KiB
Plaintext
== Why is this an issue?
|
|
|
|
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
|
|
|
|
[source,java]
|
|
----
|
|
public void run() {
|
|
// ...
|
|
Assert.assertEquals(expected, actual); // Noncompliant
|
|
}
|
|
----
|
|
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Remove this assertion.
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 22 Oct 2014, 19:20:32 Ann Campbell wrote:
|
|
Note that Applicability is marked only for Tests
|
|
|
|
=== on 24 Nov 2014, 19:33:09 Nicolas Peru wrote:
|
|
I am guessing here and so the answer should probably part of the RSPEC : The run method is a run method of a Thread class ?
|
|
|
|
=== on 22 Apr 2015, 11:01:15 Ann Campbell wrote:
|
|
Since you're already implementing this [~nicolas.peru], I'm guessing it's okay.
|
|
|
|
=== on 22 Apr 2015, 11:20:20 Nicolas Peru wrote:
|
|
\[~ann.campbell.2]yes, more especially with the the mention of ``++Runnable++``
|
|
|
|
endif::env-github,rspecator-view[]
|