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

Add similarity to haveKeys and haveKey (#47) #3930

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AlexCue987
Copy link
Contributor

add search for similar keys in case of mismatch for haveKey and haveKeys, such as:

           shouldThrow<AssertionError> {
               mapOf(
                  sweetGreenApple to 1,
                  sweetRedApple to 2,
                  sourYellowLemon to 3
               ).shouldContainKey(sweetGreenPear)
            }.message.shouldBe("""
            |Map should contain key Fruit(name=pear, color=green, taste=sweet)
            |Possible matches for missing key:
            |
            | expected: Fruit(name=apple, color=green, taste=sweet),
            |  but was: Fruit(name=pear, color=green, taste=sweet),
            |  The following fields did not match:
            |    "name" expected: <"apple">, but was: <"pear">
            """.trimMargin())

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

Successfully merging this pull request may close these issues.

None yet

1 participant