-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Issue #159 Diffing a table with an empty list: Added two tests diffin… #1194
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Issue #159 Diffing a table with an empty list: Added two tests diffin… #1194
Conversation
…g with empty table to TableDifferTest
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.
Code looks clean. Formatting looks good.
Unfortunately neither test case ever reaches the assertion. You can avoid this by making the test fail first before making it pass. So rather then using assertEquals(expected, actual)
you could use an assertion that always fails assertEquals("notTheResultEver", actual)
.
Note that in case of empty_list_should_not_diff_with_empty_table
no assertion is needed but you might want to start of by adding a failing one nonetheless.
try { | ||
DataTable emptyTable = DataTable.create(Collections.emptyList()); | ||
table().diff(emptyTable); | ||
} catch (IndexOutOfBoundsException e) { |
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.
You are expecting the test to throw a TableDiffException but catching an IndexOutOfBoundsException. I don't think this is quite right.
List<List<String>> emptyList = new ArrayList<List<String>>(); | ||
DataTable emptyTable = DataTable.create(Collections.emptyList()); | ||
emptyTable.diff(emptyList); | ||
} catch (IndexOutOfBoundsException e) { |
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.
In this test case we want to compare the empty table another another empty table. This should not result in any exception.
@mpkorstanje Thanks for your feedback! Made some changes, hope it's ok now. |
@mlvandijk Hooray! |
Thank you! I've squashed your commits and somewhat edited the commit message for brevity and clarity. You can read How to Write a Git Commit Message and Why sqaush git commits for a more detailed explanation. We're not religious about it but it does improve communication. One more thing to do: Update History.md with your contribution. If the commit-bit-bot is working you should have been granted commit access. |
@mpkorstanje Updated History.md (with shorter/clearer commit message - I hope). Great links, thanks! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Added two tests for issue #159
Details
One test to verify that diffing a non-empty table with an empty table throws expected TableDiffException.
One test to verify that diffing an empty table with an empty list does not throw an Exception.
Motivation and Context
Show that the issue has been resolved
How Has This Been Tested?
Test code only, to show issue has been resolved.
Types of changes
Checklist: