Skip to content

Commit

Permalink
Add missing @OverRide
Browse files Browse the repository at this point in the history
- Use final
- Sort members
  • Loading branch information
garydgregory committed Nov 1, 2024
1 parent 3a22be2 commit 0b69838
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ public void testExhaustivityWithSameList() {
/**
* test that all tuples are provided to consumer
*/
@Override
@Test
public void testForEachRemaining() {
final List<Character[]> resultsList = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public void testGetValueByIndex() {
assertThrows(IndexOutOfBoundsException.class, () -> getMap().getValue(0));
assertThrows(IndexOutOfBoundsException.class, () -> getMap().getValue(-1));
resetFull();
LinkedMap<K, V> lm = getMap();
final LinkedMap<K, V> lm = getMap();
assertThrows(IndexOutOfBoundsException.class, () -> lm.getValue(-1));
assertThrows(IndexOutOfBoundsException.class, () -> lm.getValue(lm.size()));
int i = 0;
Expand Down Expand Up @@ -250,7 +250,7 @@ public void testRemoveByIndex() {
assertThrows(IndexOutOfBoundsException.class, () -> getMap().remove(0));
assertThrows(IndexOutOfBoundsException.class, () -> getMap().remove(-1));
resetFull();
LinkedMap<K, V> lm = getMap();
final LinkedMap<K, V> lm = getMap();
assertThrows(IndexOutOfBoundsException.class, () -> lm.remove(-1));
assertThrows(IndexOutOfBoundsException.class, () -> lm.remove(lm.size()));
final List<K> list = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public void testPreservesKeyInsertionOrder() {
map.put((K) Integer.valueOf(5), (V) "five");
map.put((K) Integer.valueOf(1), (V) "one");
map.put((K) Integer.valueOf(5), (V) "vijf"); // "vijf" = "five" in Dutch
MapIterator<K, V> mapIterator = map.mapIterator();
final MapIterator<K, V> mapIterator = map.mapIterator();
assertEquals(5, mapIterator.next());
assertEquals("five", mapIterator.getValue());
assertEquals(5, mapIterator.next());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ public LinkedHashSetValuedLinkedHashMapTest() {
super(LinkedHashSetValuedLinkedHashMapTest.class.getSimpleName());
}

@Override
public String getCompatibilityVersion() {
return "4.5"; // LinkedHashSetValuedLinkedHashMap was added in version 4.5
}

@Override
protected int getIterationBehaviour() {
return AbstractCollectionTest.UNORDERED;
Expand All @@ -60,30 +65,6 @@ public SetValuedMap<K, V> makeObject() {
return new LinkedHashSetValuedLinkedHashMap<>();
}

@Override
public String getCompatibilityVersion() {
return "4.5"; // LinkedHashSetValuedLinkedHashMap was added in version 4.5
}

@Test
public void testLinkedHashSetValuedLinkedHashMap_2() {
final Map<K, V> map = new HashMap<>();
final SetValuedMap<K, V> map1;
final SetValuedMap<K, V> map2;

map.put((K) "A", (V) "W");
map.put((K) "B", (V) "X");
map.put((K) "C", (V) "F");
map1 = new LinkedHashSetValuedLinkedHashMap<>(map);
assertEquals(1, map1.get((K) "A").size());

map.remove("A");
map.remove("B");
map.remove("C");
map2 = new LinkedHashSetValuedLinkedHashMap<>(map);
assertEquals("{}", map2.toString());
}

@Test
public void testHashSetValueHashMap() {
final SetValuedMap<K, V> setMap = new LinkedHashSetValuedLinkedHashMap<>(4);
Expand Down Expand Up @@ -119,6 +100,25 @@ public void testHashSetValueHashMap_1() {
assertEquals("{}", map3.toString());
}

@Test
public void testLinkedHashSetValuedLinkedHashMap_2() {
final Map<K, V> map = new HashMap<>();
final SetValuedMap<K, V> map1;
final SetValuedMap<K, V> map2;

map.put((K) "A", (V) "W");
map.put((K) "B", (V) "X");
map.put((K) "C", (V) "F");
map1 = new LinkedHashSetValuedLinkedHashMap<>(map);
assertEquals(1, map1.get((K) "A").size());

map.remove("A");
map.remove("B");
map.remove("C");
map2 = new LinkedHashSetValuedLinkedHashMap<>(map);
assertEquals("{}", map2.toString());
}

@Test
@SuppressWarnings("unchecked")
public void testSetValuedMapAdd() {
Expand Down

0 comments on commit 0b69838

Please sign in to comment.