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

Incorrect unit test ComparisonFailure messages #56

Open
cr3ativ3 opened this issue Mar 22, 2018 · 2 comments
Open

Incorrect unit test ComparisonFailure messages #56

cr3ativ3 opened this issue Mar 22, 2018 · 2 comments
Labels

Comments

@cr3ativ3
Copy link
Contributor

Most of jspoon's unit tests (the ones not written by me) has assertEquals(arg1, arg2) with arguments switched places. They have first actual then expected, when it should be first expected then actual.
That results in misleading junit's error messages upon test failure:

String actual = "actual";
assertEquals(actual, "expected");

org.junit.ComparisonFailure: expected:<[actual]> but was:<[expected]>
@koral-- koral-- added the bug label Mar 22, 2018
@koral--
Copy link
Member

koral-- commented Mar 22, 2018

Good catch. We migth consider switching e.g. to assertJ. It uses assertThat("actual").isEqualTo("expected") so it is harder to make such mistakes.

@cr3ativ3
Copy link
Contributor Author

I don't know if its any harder to write assertThat("expected").isEqualTo("actual"). Though assertj's builder style assertions does make it easier if do multiple chained evaluations on the same instance, but haven't seen that many use-cases in jspoon.

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