Skip to content

assertThatThrownBy.doesNotThrowAnyException() fails when no exception is thrown #2517

@TheBestPessimist

Description

@TheBestPessimist

Summary

Duplicate of #1787 because that is closed:

Example

    fun thisFunctionDoesNothing() {
        println("i did nothing")
    }

    @Test
    fun `this test should not fail, unfortunately it does`() {
        assertThatThrownBy { thisFunctionDoesNothing() }.doesNotThrowAnyException()
    }

And i get the exception:

Expecting code to raise a throwable.
java.lang.AssertionError: 
Expecting code to raise a throwable.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions