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

Iterable assertions always fail #538

Open
shaposhnyk-maxym opened this issue May 10, 2024 · 1 comment
Open

Iterable assertions always fail #538

shaposhnyk-maxym opened this issue May 10, 2024 · 1 comment
Labels

Comments

@shaposhnyk-maxym
Copy link

shaposhnyk-maxym commented May 10, 2024

I'm encountering an issue with iterable assertions in AssertK version com.willowtreeapps.assertk:assertk-jvm:0.28.0.

The problem arises when I try to assert that two lists contain the same elements. The assertion fails, and the error message suggests that one of the lists is being treated as a two-dimensional array. Here's a minimal example that reproduces the issue:

        val firstList = listOf(1, 2)
        val secondList = listOf(2, 1)
        assertThat(firstList).containsExactlyInAnyOrder(secondList)
org.opentest4j.AssertionFailedError: expected to contain exactly in any order:<[[2, 1]]> but was:<[1, 2]>
 elements not found:<[[2, 1]]>
 extra elements found:<[1, 2]>
@evant evant added the question label May 10, 2024
@evant
Copy link
Collaborator

evant commented May 10, 2024

containsExactlyInAnyOrder takes a vararg so the correct way would be:

assertThat(firstList).containsExactlyInAnyOrder(1, 2)

See #428 (comment)

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

No branches or pull requests

2 participants