Skip to content

Commit

Permalink
Fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
Family authored and Family committed Oct 6, 2020
1 parent d01324a commit e2abfce
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.apache.commons.collections4;

import org.apache.commons.collections4.map.HashedMap;
import org.junit.Assert;
import org.junit.jupiter.api.Test;

Expand All @@ -38,10 +39,9 @@ void setComparator() {
myMap.put("X", 24);
myMap.put("B", 2);
myMap.put("Y", 26);
Map<String, Integer> builderMap = new MapBuilder().setData(myMap).setComparator(null).build();

// Reverse comparator
builderMap = new MapBuilder().setData(myMap).setIterationOrder(MapBuilder.KeyOrder.COMPARATOR_ORDER).setComparator(Comparator.reverseOrder()).build();
Map<String, Integer> builderMap = new MapBuilder().setData(myMap).setIterationOrder(MapBuilder.KeyOrder.COMPARATOR_ORDER).setComparator(Comparator.reverseOrder()).build();
Assert.assertEquals(builderMap.keySet().stream().findFirst().get(), "Y");
Assert.assertEquals(builderMap.keySet().stream().skip(1).findFirst().get(), "X");
Assert.assertEquals(builderMap.keySet().stream().skip(2).findFirst().get(), "B");
Expand All @@ -57,7 +57,7 @@ void setIterationOrder() {
myMap.put("B", 2);
myMap.put("Y", 26);
Map<String, Integer> builderMap = new MapBuilder().setData(myMap).setIterationOrder(MapBuilder.KeyOrder.UNORDERED).build();
Assert.assertTrue(builderMap instanceof HashMap);
Assert.assertTrue(builderMap instanceof HashedMap);

//Key Order = INSERTION ORDER
builderMap = new MapBuilder().setIterationOrder(MapBuilder.KeyOrder.INSERTION_ORDER).build();
Expand Down

0 comments on commit e2abfce

Please sign in to comment.