Skip to content

Conversation

@Keval-Gandevia
Copy link

  1. For EnumerationIterator.java in org.apache.commons.collections4.iterators
  • A test case for remove method is added.
  1. For ListIteratorWrapper.java in org.apache.commons.collections4.iterators
  • A test case for add method is added.
  1. For UnmodifiableEntrySet.java in org.apache.commons.collections4.map
  • A test case for toArray method is added.
  1. For ArrayStack.java in org.apache.commons.collections4
  • A test case for peek method is added.

Copy link
Member

@garydgregory garydgregory left a 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);});
Copy link
Member

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);});
Copy link
Member

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"));
Copy link
Member

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.*;
Copy link
Member

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();
Copy link
Member

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;
Copy link
Member

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};
Copy link
Member

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);});
Copy link
Member

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-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.81%. Comparing base (229425c) to head (6a787c4).
Report is 15 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants