Skip to content

Nested assumption failures should not cause assertion failures for enclosing assertThrows() #1689

@chrisvest

Description

@chrisvest

Overview

The effect of the org.junit.jupiter.api.Assumptions.assume*() family of methods depends on whether or not the call is inside an assertThrows() lambda or not. I think a failed assumption should always behave the same, i.e. cause the test to be aborted. I think this is a failure of assertThrows() to not propagate the TestAbortedException exception.

Steps to reproduce

The following test fails on the thrown exception being different from the expected, while I think it should instead be ignored:

@Test
void example() {
    assertThrows(IOException.class, () -> assumeTrue(false));
}

Context

  • Used versions (Jupiter/Vintage/Platform): JUnit Jupiter version 5.2.0.
  • Build Tool/IDE: Maven 3.5.4, Intellij 2018.3.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions