Skip to content

Commit

Permalink
Latest docs on successful build 6848 auto-pushed to gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
copybara-service[bot] committed Nov 8, 2024
1 parent aa58aef commit 197e468
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bugpattern/MissingFail.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ To make changes, edit the @BugPattern annotation or the explanation in docs/bugp
_Alternate names: missing-fail_

## The problem
When testing for exceptions in junit, it is easy to forget the call to `fail()`:
When testing for exceptions in JUnit, it is easy to forget the call to `fail()`:

```java
try {
Expand All @@ -32,7 +32,7 @@ import static org.junit.Assert.fail;

try {
someOperationThatShouldThrow();
fail()
fail();
} catch (SomeException expected) {
assertThat(expected).hasMessage("Operation failed");
}
Expand Down Expand Up @@ -97,8 +97,8 @@ characteristics are present:

* A field assignment in the catch block.
* A call to `assertTrue/False(boolean variable or field)` in the catch block.
* The last statement in the `try` block is an `assert*()` (that is not a noop:
`assertFalse(false)`, `assertTrue(true))` or `Mockito.verify()` call.
* The last statement in the `try` block is an `assert*()` (that is not a
noop): `assertFalse(false)`, `assertTrue(true))` or `Mockito.verify()` call.

## Suppression
Suppress false positives by adding the suppression annotation `@SuppressWarnings("MissingFail")` to the enclosing element.

0 comments on commit 197e468

Please sign in to comment.