-
Notifications
You must be signed in to change notification settings - Fork 509
Test cases for iterators package, map package, and collection4 package #460
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
Conversation
Keval-Gandevia
commented
Mar 3, 2024
- For EnumerationIterator.java in org.apache.commons.collections4.iterators
- A test case for remove method is added.
- For ListIteratorWrapper.java in org.apache.commons.collections4.iterators
- A test case for add method is added.
- For UnmodifiableEntrySet.java in org.apache.commons.collections4.map
- A test case for toArray method is added.
- For ArrayStack.java in org.apache.commons.collections4
- A test case for peek method is added.
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.
Hello @Keval-Gandevia
Thank you for your PR.
Please see my comments.
Run mvn by itself and fix the current build errors.
| // check for valid index | ||
| assertEquals("Second", stack.peek(1)); | ||
| // check for invalid index | ||
| assertThrows(EmptyStackException.class, () -> {stack.peek(5);}); |
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.
Lambda block is not needed.
| // check for invalid index | ||
| assertThrows(EmptyStackException.class, () -> {stack.peek(5);}); | ||
| // check if stack is empty. | ||
| assertThrows(EmptyStackException.class, () -> {emptyStack.peek(1);}); |
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.
Lambda block is not needed.
| @Test | ||
| public void testRemove() { | ||
| // arrange | ||
| List<String> list = new ArrayList<>(Arrays.asList("First", "Second", "Third")); |
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.
Use final.
| import org.apache.commons.collections4.map.UnmodifiableEntrySet; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.*; |
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.
Please don't change the import style, we do not use star imports.
| @Test | ||
| public void testToArray() { | ||
| // arrange | ||
| Set<Map.Entry<K, V>> x = makeCustomFullMap(); |
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.
Use final.
| */ | ||
| package org.apache.commons.collections4.iterators; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; |
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.
Please don't change the import style, we do not use star imports.
| // arrange part starts | ||
| final ResettableListIterator<E> iter1 = makeCustomObject(); | ||
| final ResettableListIterator<E> iter2 = makeObject(); | ||
| int[] x = new int[]{1}; |
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.
Use final where you can.
|
|
||
| // act and assert starts | ||
| // check for no exception | ||
| assertDoesNotThrow(()->{iter1.add((E) x);}); |
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.
Missing space around arrow, block not needed.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #460 +/- ##
============================================
+ Coverage 81.60% 81.81% +0.21%
- Complexity 4745 4758 +13
============================================
Files 295 295
Lines 13751 13751
Branches 2022 2022
============================================
+ Hits 11222 11251 +29
+ Misses 1929 1899 -30
- Partials 600 601 +1 ☔ View full report in Codecov by Sentry. |