Skip to content

failNotSame message could emphasize reference equality #1626

Closed as not planned
@sabi0

Description

@sabi0

When calling assertSame for two different instances of identical objects the failure message will be quite confusing: "expected same:<[1, 2]> was not:<[1, 2]>".
See

fail(formatted + "expected same:<" + expected + "> was not:<" + actual

I think the clarity could be improved by adding identityHashCode to the message, like this:
"expected same:<[1, 2]@ba38e> was not:<[1, 2]@de440>"
Or maybe even with the class name:
"expected same:<java.util.List@ba38e [1, 2]> was not:<java.util.List@de440 [1, 2]>"

Metadata

Metadata

Assignees

No one assigned

    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