Checking the validity of input ListIterators#259
Conversation
|
Thanks @emopers! However, after seeing the same sorts of changes in #236 and #260, I am beginning to think this sort of change might become annoying to people reading the tests. Adding these tests to every place where cursors are used bogs down the logic of the tests. Properly, we should be testing the cursor iteration in its own test method, and then in other tests, we can assume the iteration works properly. In other words: it is not the job of every test to test every piece of logic used in the execution of that test. @emopers Did you find all these places using some code linting tool? I'm not sure I agree that the lack of @tpietzsch What do you think? Should we merge #236, #259 and #260? Or close them without merge? |
|
@ctrueden I would close #259 and #260 without merge. |
Partition.java calls of
j.previous()onjava.util.ListIterator jandi.next()onjava.util.ListIterator iwithout checking if there are any elements to iterate over. Because the method is public and the iterators are obtained from inputs, they could be invalid (e.g., an empty list). This could lead to an exception. This pull request adds a 'hasNext()' and 'hasPrevious()' check. * This PR is a sequel of PR #236 *