Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

displayActual is not working properly #513

Open
Nokinori opened this issue Feb 7, 2024 · 1 comment
Open

displayActual is not working properly #513

Nokinori opened this issue Feb 7, 2024 · 1 comment

Comments

@Nokinori
Copy link

Nokinori commented Feb 7, 2024

I suspect that displayActual property is working incorrectly. Or it's function is not obvious without the documentation.
Can you explain is this expected behaviour is currently actual? If yes, how can I specify custom error message?

Reproduce:

    @Test
    fun `fail test message`() {
        assertThat(
            actual = listOf("1"),
            name = "my name",
            displayActual = { "display actual" },
        ).contains("2")
    }

Actual:
org.opentest4j.AssertionFailedError: expected [my name] to contain:<"2"> but was:<["1"]>

Expected:
org.opentest4j.AssertionFailedError: expected [my name] to contain:<"2"> but was:<["display actual"]>]

Lib version verified: "0.26.1", "0.28.0"

@evant
Copy link
Collaborator

evant commented May 2, 2024

Finally got around explaining this here, displayActual actually controls the rendering of the subject, which is only shown when you have chained assertions. As I point out int the link this behavior is not clear and should probably be rethought.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants