Withdrawn: CODETOOLS-7902838: JMH: Don't use fail() inside a try-catch catching an AssertionError

Aleksey Shipilev shade at openjdk.java.net
Tue Mar 9 15:33:13 UTC 2021


On Tue, 9 Mar 2021 13:59:19 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> SonarCloud instance reports a bug in our tests:
>  "Don't use fail() inside a try-catch catching an AssertionError."
> 
>     @Test
>     public void invokeAPI() throws RunnerException {
>         try {
>             ...
>             new Runner(opt).run();
> 
>             Assert.fail("Should have failed"); // <--- here
>         } catch (RunnerException e) {
>             // expected
>         }
>     }
> 
> Indeed, that does not look correct.

This pull request has been closed without being integrated.

-------------

PR: https://git.openjdk.java.net/jmh/pull/25


More information about the jmh-dev mailing list