mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
43 lines
973 B
HTML
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> |