Add missing @Override

- Use final
- Sort members
This commit is contained in:
Gary Gregory 2024-11-01 18:43:38 -04:00
parent 3a22be2c1c
commit 0b698389ab
4 changed files with 28 additions and 27 deletions

View File

@ -185,6 +185,7 @@ public class CartesianProductIteratorTest extends AbstractIteratorTest<List<Char
/**
* test that all tuples are provided to consumer
*/
@Override
@Test
public void testForEachRemaining() {
final List<Character[]> resultsList = new ArrayList<>();

View File

@ -153,7 +153,7 @@ public class LinkedMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
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;
@ -250,7 +250,7 @@ public class LinkedMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
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<>();

View File

@ -195,7 +195,7 @@ public class ArrayListValuedLinkedHashMapTest<K, V> extends AbstractMultiValuedM
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());

View File

@ -40,6 +40,11 @@ public class LinkedHashSetValuedLinkedHashMapTest<K, V> extends AbstractMultiVal
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;
@ -60,30 +65,6 @@ public class LinkedHashSetValuedLinkedHashMapTest<K, V> extends AbstractMultiVal
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);
@ -119,6 +100,25 @@ public class LinkedHashSetValuedLinkedHashMapTest<K, V> extends AbstractMultiVal
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() {