-
Notifications
You must be signed in to change notification settings - Fork 164
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
simplified some assertions by using #containsExactly #68
simplified some assertions by using #containsExactly #68
Conversation
4656149
to
62fb1fe
Compare
Hi @PascalSchumacher, thanks for the effort and changes. For same parts I really like to explicitly use the array and equals notation to make the test case clearer but at some you are perfectly correct to use "containsExactly" instead. Is there a way for me to change the pull request before merging? On the other hand I will thing about it before getting back to my laptop ;-) |
Thanks for the quick feedback. :) You can change everything about a (pull request) commit when you cherry-pick and then amend. It will still show me as the author and you as the committer of the commit. e.g.:
If you add You can also just comment on the changes you want me to undo and I will update the pull request myself. |
No, thanks for the pull request. I will have a closer look on the weekend as this is not urgent :-) |
Yes, it's not urgent at all. So take you time :-) |
@@ -323,8 +315,7 @@ public void testConvertShouldReturnOneElementForStringArrayWithOneElementSplitBy | |||
List<Object[]> result = underTest.convert(data, false, parameterTypes, dataProvider); | |||
|
|||
// Then: | |||
assertThat(result).hasSize(1); | |||
assertThat(result.get(0)).isEqualTo(new Object[] { "foo", true }); | |||
assertThat(result).containsExactly(new Object[] { "foo", true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we cloud use a helper for creating the array instead of using new Object[] { ... }
over and over.
Do you also think that it would be better for the test cases above to write down the data explicitly instead of reusing the test data somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a fan of creating helper methods for tests. So if it's possible to come up with a descriptive method name I'm for adding it. Maybe something like assertContainsOnlyObjectArrayWithValues(List, values...)
?
I agree that it would be better to write down the data explicitly in the test above.
simplified some assertions by using #containsExactly
After all thanks for the PR and the discussions :-) |
I think it is more readable and it gives a nicer failure message, but feel free to reject if you disagree. :)