Skip to content

assertEquals with a diff #3192

Open
Open
@delanym

Description

@delanym

When I compare two strings
Assertions.assertEquals(expected, fb.toString());
there's no indication from the error what the difference is if its only whitespace.

So I need to compare the byte arrays instead.
Assertions.assertArrayEquals(expected.getBytes(), fb.toString().getBytes());

If there's a failure I'd like to see the string version (to make sure its roughly the correct string) AND the byte values, but I don't want to waste time comparing both of them to satisfy the test condition.

I guess there are many way to solve this. Maybe its possible to compare the values like assertEquals, and if the test fails, output as usual, but append a diff. "assertNoDiff", "assertEqualsDiff" etc.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions