Files
openide/java/java-impl/resources/inspectionDescriptions/MaskedAssertion.html
Leonid Shalupov 40795fe787 IJI-2422: community/java: move resources under resources root
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
2025-02-05 04:43:28 +00:00

43 lines
973 B
HTML

<html>
<body>
Reports <code>assert</code> statements and test framework assertions that are suppressed by a surrounding catch block.
Such assertions will never fail, as the thrown <code>AssertionError</code> will be caught and silently ignored.
<p><b>Example 1:</b></p>
<pre><code>
void javaAssertion() {
try {
...
assert 1 == 2;
} catch (AssertionError e) {
// the assertion is silently ignored
}
}
</code></pre>
<p><b>Example 2:</b></p>
<pre><code>
@Test
void testWithAssertJ() {
try {
...
assertThat(1).as("test").isEqualTo(2);
} catch (AssertionError e) {
// the assertion is silently ignored
}
}
</code></pre>
<p><b>Example 3:</b></p>
<pre><code>
@Test
void testWithJunit() {
try {
...
assertEquals(1, 2);
} catch (AssertionError e) {
// the assertion is silently ignored
}
}
</code></pre>
<!-- tooltip end -->
<p><small>New in 2020.3</small></p>
</body>
</html>