Clean up tests.

- Simple syntax for array creation.
- Use better Collection APIs.
- Make test fixture a static class.
- Use number cache when possible.
This commit is contained in:
Gary Gregory 2022-03-04 08:56:42 -05:00
parent 505722c303
commit 5588a9bdee
34 changed files with 77 additions and 77 deletions

View File

@ -413,7 +413,7 @@ public class ClosureUtilsTest {
*/
@Test
public void testSingletonPatternInSerialization() {
final Object[] singletons = new Object[] {
final Object[] singletons = {
ExceptionClosure.INSTANCE,
NOPClosure.INSTANCE,
};

View File

@ -2022,7 +2022,7 @@ public class CollectionUtilsTest extends MockTestCase {
@Test
public void testSize_Array() {
final Object[] objectArray = new Object[0];
final Object[] objectArray = {};
assertEquals(0, CollectionUtils.size(objectArray));
final String[] stringArray = new String[3];
@ -2083,7 +2083,7 @@ public class CollectionUtilsTest extends MockTestCase {
@Test
public void testSize_PrimitiveArray() {
final int[] intArray = new int[0];
final int[] intArray = {};
assertEquals(0, CollectionUtils.size(intArray));
final double[] doubleArray = new double[3];
@ -2096,7 +2096,7 @@ public class CollectionUtilsTest extends MockTestCase {
@Test
public void testSizeIsEmpty_Array() {
final Object[] objectArray = new Object[0];
final Object[] objectArray = {};
assertTrue(CollectionUtils.sizeIsEmpty(objectArray));
final String[] stringArray = new String[3];
@ -2162,7 +2162,7 @@ public class CollectionUtilsTest extends MockTestCase {
@Test
public void testSizeIsEmpty_PrimitiveArray() {
final int[] intArray = new int[0];
final int[] intArray = {};
assertTrue(CollectionUtils.sizeIsEmpty(intArray));
final double[] doubleArray = new double[3];

View File

@ -240,7 +240,7 @@ public class FactoryUtilsTest {
*/
@Test
public void testSingletonPatternInSerialization() {
final Object[] singletons = new Object[] {
final Object[] singletons = {
ExceptionFactory.INSTANCE,
};

View File

@ -672,7 +672,7 @@ public class PredicateUtilsTest extends AbstractPredicateTest {
*/
@Test
public void testSingletonPatternInSerialization() {
final Object[] singletons = new Object[] {
final Object[] singletons = {
ExceptionPredicate.INSTANCE,
FalsePredicate.INSTANCE,
NotNullPredicate.INSTANCE,

View File

@ -419,7 +419,7 @@ public class TransformerUtilsTest {
*/
@Test
public void testSingletonPatternInSerialization() {
final Object[] singletons = new Object[] {
final Object[] singletons = {
ExceptionTransformer.INSTANCE,
NOPTransformer.INSTANCE,
StringValueTransformer.stringValueTransformer(),

View File

@ -53,7 +53,7 @@ public class TransformedBagTest<T> extends AbstractBagTest<T> {
final Bag<T> bag = TransformedBag.transformingBag(new HashBag<T>(),
(Transformer<T, T>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
assertTrue(bag.isEmpty());
final Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
final Object[] els = {"1", "3", "5", "7", "2", "4", "6"};
for (int i = 0; i < els.length; i++) {
bag.add((T) els[i]);
assertEquals(i + 1, bag.size());
@ -68,7 +68,7 @@ public class TransformedBagTest<T> extends AbstractBagTest<T> {
@SuppressWarnings("unchecked")
public void testTransformedBag_decorateTransform() {
final Bag<T> originalBag = new HashBag<>();
final Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
final Object[] els = {"1", "3", "5", "7", "2", "4", "6"};
for (final Object el : els) {
originalBag.add((T) el);
}

View File

@ -50,7 +50,7 @@ public class TransformedSortedBagTest<T> extends AbstractSortedBagTest<T> {
public void testTransformedBag() {
final SortedBag<T> bag = TransformedSortedBag.transformingSortedBag(new TreeBag<T>(), (Transformer<T, T>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
assertEquals(0, bag.size());
final Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
final Object[] els = {"1", "3", "5", "7", "2", "4", "6"};
for (int i = 0; i < els.length; i++) {
bag.add((T) els[i]);
assertEquals(i + 1, bag.size());
@ -63,7 +63,7 @@ public class TransformedSortedBagTest<T> extends AbstractSortedBagTest<T> {
public void testTransformedBag_decorateTransform() {
final TreeBag<T> originalBag = new TreeBag<>();
final Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
final Object[] els = {"1", "3", "5", "7", "2", "4", "6"};
for (final Object el : els) {
originalBag.add((T) el);
}

View File

@ -278,7 +278,7 @@ public abstract class AbstractBidiMapTest<K, V> extends AbstractIterableMapTest<
}
private void removeByKeySet(final BidiMap<?, ?> map, final Object key, final Object value) {
map.keySet().remove(key);
map.remove(key);
assertFalse("Key was not removed.", map.containsKey(key));
assertFalse("Value was not removed.", map.containsValue(value));

View File

@ -1093,7 +1093,7 @@ public abstract class AbstractCollectionTest<E> extends AbstractObjectTest {
*/
public void testCollectionToArray2() {
resetEmpty();
Object[] a = new Object[] { new Object(), null, null };
Object[] a = { new Object(), null, null };
Object[] array = getCollection().toArray(a);
assertEquals("Given array shouldn't shrink", array, a);
assertNull("Last element should be set to null", a[0]);

View File

@ -34,7 +34,7 @@ public class FixedOrderComparatorTest extends AbstractComparatorTest<String> {
/**
* Top cities of the world, by population including metro areas.
*/
private static final String topCities[] = new String[] {
private static final String topCities[] = {
"Tokyo",
"Mexico City",
"Mumbai",

View File

@ -25,7 +25,7 @@ import org.junit.Test;
public class ComparatorPredicateTest extends AbstractPredicateTest {
private class TestComparator<T extends Comparable<T>> implements Comparator<T> {
private static class TestComparator<T extends Comparable<T>> implements Comparator<T> {
@Override
public int compare(final T first, final T second) {
return first.compareTo(second);

View File

@ -87,9 +87,9 @@ public class ArrayListIteratorTest<E> extends ArrayIteratorTest<E> {
*/
@SuppressWarnings("unchecked")
public void testListIteratorSet() {
final String[] testData = new String[] { "a", "b", "c" };
final String[] testData = { "a", "b", "c" };
final String[] result = new String[] { "0", "1", "2" };
final String[] result = { "0", "1", "2" };
ListIterator<E> iter = makeArrayListIterator(testData);
int x = 0;

View File

@ -84,9 +84,9 @@ public class ObjectArrayListIteratorTest<E> extends ObjectArrayIteratorTest<E> {
*/
@SuppressWarnings("unchecked")
public void testListIteratorSet() {
final String[] testData = new String[] { "a", "b", "c" };
final String[] testData = { "a", "b", "c" };
final String[] result = new String[] { "0", "1", "2" };
final String[] result = { "0", "1", "2" };
ListIterator<E> iter = makeArrayListIterator((E[]) testData);
int x = 0;

View File

@ -120,7 +120,7 @@ public class MultiKeyTest {
@Test
public void testConstructorsByArray() throws Exception {
MultiKey<Integer> mk;
Integer[] keys = new Integer[] { THREE, FOUR, ONE, TWO };
Integer[] keys = { THREE, FOUR, ONE, TWO };
mk = new MultiKey<>(keys);
assertArrayEquals(new Object[]{THREE, FOUR, ONE, TWO}, mk.getKeys());
keys[3] = FIVE; // no effect
@ -246,7 +246,7 @@ public class MultiKeyTest {
@Test
public void testGetKeysArrayConstructorCloned() {
final Integer[] keys = new Integer[] { ONE, TWO };
final Integer[] keys = { ONE, TWO };
final MultiKey<Integer> mk = new MultiKey<>(keys, true);
final Object[] array = mk.getKeys();
assertNotSame(array, keys);
@ -258,7 +258,7 @@ public class MultiKeyTest {
@Test
public void testGetKeysArrayConstructorNonCloned() {
final Integer[] keys = new Integer[] { ONE, TWO };
final Integer[] keys = { ONE, TWO };
final MultiKey<Integer> mk = new MultiKey<>(keys, false);
final Object[] array = mk.getKeys();
assertNotSame(array, keys); // still not equal

View File

@ -1496,7 +1496,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
final ArrayList<String> list = new ArrayList<>();
final String prefix = "CursorableLinkedListTest";
final String bulk = ".bulkTestSubList";
final String[] ignored = new String[] {
final String[] ignored = {
".testEmptyListSerialization",
".testFullListSerialization",
".testEmptyListCompatibility",

View File

@ -61,18 +61,18 @@ public class SetUniqueListTest<E> extends AbstractListTest<E> {
Integer.valueOf(2),
"Three",
Integer.valueOf(4),
new Double(5),
new Float(6),
Double.valueOf(5),
Float.valueOf(6),
"Seven",
"Eight",
"Nine",
Integer.valueOf(10),
new Short((short) 11),
new Long(12),
Short.valueOf((short) 11),
Long.valueOf(12),
"Thirteen",
"14",
"15",
new Byte((byte) 16)
Byte.valueOf((byte) 16)
};
}
@ -234,7 +234,7 @@ public class SetUniqueListTest<E> extends AbstractListTest<E> {
}
public void testFactory() {
final Integer[] array = new Integer[] { Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(1) };
final Integer[] array = { Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(1) };
final ArrayList<Integer> list = new ArrayList<>(Arrays.asList(array));
final SetUniqueList<Integer> lset = SetUniqueList.setUniqueList(list);
@ -337,12 +337,12 @@ public class SetUniqueListTest<E> extends AbstractListTest<E> {
// override for set behavior
resetFull();
final int size = getCollection().size();
getCollection().set(0, (E) new Long(1000));
getCollection().set(0, (E) Long.valueOf(1000));
assertEquals(size, getCollection().size());
getCollection().set(2, (E) new Long(1000));
getCollection().set(2, (E) Long.valueOf(1000));
assertEquals(size - 1, getCollection().size());
assertEquals(new Long(1000), getCollection().get(1)); // set into 2, but shifted down to 1
assertEquals(Long.valueOf(1000), getCollection().get(1)); // set into 2, but shifted down to 1
}
@SuppressWarnings("unchecked")
@ -596,12 +596,12 @@ public class SetUniqueListTest<E> extends AbstractListTest<E> {
if (extraVerify) {
final int size = getCollection().size();
getCollection().add((E) new Long(1000));
getCollection().add((E) Long.valueOf(1000));
assertEquals(size + 1, getCollection().size());
getCollection().add((E) new Long(1000));
getCollection().add((E) Long.valueOf(1000));
assertEquals(size + 1, getCollection().size());
assertEquals(new Long(1000), getCollection().get(size));
assertEquals(Long.valueOf(1000), getCollection().get(size));
getCollection().remove(size);
}

View File

@ -109,7 +109,7 @@ public class TransformedListTest<E> extends AbstractListTest<E> {
public void testTransformedList_decorateTransform() {
final List<Object> originalList = new ArrayList<>();
final Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
final Object[] els = {"1", "3", "5", "7", "2", "4", "6"};
for (final Object el : els) {
originalList.add(el);
}

View File

@ -299,7 +299,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
*/
@SuppressWarnings("unchecked")
public K[] getSampleKeys() {
final Object[] result = new Object[] {
final Object[] result = {
"blah", "foo", "bar", "baz", "tmp", "gosh", "golly", "gee",
"hello", "goodbye", "we'll", "see", "you", "all", "again",
"key",
@ -354,7 +354,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
*/
@SuppressWarnings("unchecked")
public V[] getSampleValues() {
final Object[] result = new Object[] {
final Object[] result = {
"blahv", "foov", "barv", "bazv", "tmpv", "goshv", "gollyv", "geev",
"hellov", "goodbyev", "we'llv", "seev", "youv", "allv", "againv",
isAllowNullValue() && !JDK12 ? null : "nonnullvalue",
@ -377,7 +377,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
*/
@SuppressWarnings("unchecked")
public V[] getNewSampleValues() {
final Object[] result = new Object[] {
final Object[] result = {
isAllowNullValue() && !JDK12 && isAllowDuplicateValues() ? null : "newnonnullvalue",
"newvalue",
isAllowDuplicateValues() ? "newvalue" : "newvalue2",

View File

@ -39,7 +39,7 @@ import org.junit.Test;
@SuppressWarnings("boxing")
public class LazySortedMapTest<K, V> extends AbstractSortedMapTest<K, V> {
private class ReverseStringComparator implements Comparator<String> {
private static class ReverseStringComparator implements Comparator<String> {
@Override
public int compare(final String arg0, final String arg1) {
return arg1.compareTo(arg0);

View File

@ -121,8 +121,8 @@ public class MultiKeyMapTest<K, V> extends AbstractIterableMapTest<MultiKey<? ex
assertFalse(map.containsValue(null));
assertNull(map.remove(null));
assertFalse(map.entrySet().contains(null));
assertFalse(map.keySet().contains(null));
assertFalse(map.values().contains(null));
assertFalse(map.containsKey(null));
assertFalse(map.containsValue(null));
try {
map.put(null, null);
fail();

View File

@ -214,7 +214,7 @@ public class PassiveExpiringMapTest<K, V> extends AbstractMapTest<K, V> {
public void testKeySet() {
final Map<Integer, String> m = makeTestMap();
assertEquals(3, m.keySet().size());
assertEquals(3, m.size());
}
public void testPut() {
@ -234,7 +234,7 @@ public class PassiveExpiringMapTest<K, V> extends AbstractMapTest<K, V> {
public void testValues() {
final Map<Integer, String> m = makeTestMap();
assertEquals(3, m.values().size());
assertEquals(3, m.size());
}
public void testZeroTimeToLive() {

View File

@ -88,8 +88,8 @@ public class ReferenceMapTest<K, V> extends AbstractIterableMapTest<K, V> {
assertFalse(map.containsValue(null));
assertNull(map.remove(null));
assertFalse(map.entrySet().contains(null));
assertFalse(map.keySet().contains(null));
assertFalse(map.values().contains(null));
assertFalse(map.containsKey(null));
assertFalse(map.containsValue(null));
try {
map.put(null, null);
fail();

View File

@ -45,7 +45,7 @@ public class TransformedMapTest<K, V> extends AbstractIterableMapTest<K, V> {
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testTransformedMap() {
final Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" };
final Object[] els = { "1", "3", "5", "7", "2", "4", "6" };
Map<K, V> map = TransformedMap
.transformingMap(

View File

@ -65,7 +65,7 @@ public class TransformedSortedMapTest<K, V> extends AbstractSortedMapTest<K, V>
@SuppressWarnings("unchecked")
public void testTransformedMap() {
final Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" };
final Object[] els = { "1", "3", "5", "7", "2", "4", "6" };
SortedMap<K, V> map = TransformedSortedMap
.transformingSortedMap(

View File

@ -129,7 +129,7 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
*/
@SuppressWarnings("unchecked")
public K[] getSampleKeys() {
final Object[] result = new Object[] {
final Object[] result = {
"one", "one", "two", "two",
"three", "three"
};
@ -144,7 +144,7 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
*/
@SuppressWarnings("unchecked")
public V[] getSampleValues() {
final Object[] result = new Object[] {
final Object[] result = {
"uno", "un", "dos", "deux",
"tres", "trois"
};

View File

@ -51,7 +51,7 @@ public class TransformedMultiValuedMapTest<K, V> extends AbstractMultiValuedMapT
// -----------------------------------------------------------------------
@SuppressWarnings("unchecked")
public void testKeyTransformedMap() {
final Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" };
final Object[] els = { "1", "3", "5", "7", "2", "4", "6" };
final MultiValuedMap<K, V> map = TransformedMultiValuedMap.transformingMap(
new ArrayListValuedHashMap<K, V>(),
@ -75,7 +75,7 @@ public class TransformedMultiValuedMapTest<K, V> extends AbstractMultiValuedMapT
@SuppressWarnings("unchecked")
public void testValueTransformedMap() {
final Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" };
final Object[] els = { "1", "3", "5", "7", "2", "4", "6" };
final MultiValuedMap<K, V> map = TransformedMultiValuedMap.transformingMap(
new ArrayListValuedHashMap<K, V>(), null,

View File

@ -150,7 +150,7 @@ public class EmptyPropertiesTest {
@Test
public void testKeySet() {
assertTrue(PropertiesFactory.EMPTY_PROPERTIES.keySet().isEmpty());
assertTrue(PropertiesFactory.EMPTY_PROPERTIES.isEmpty());
}
@Test
@ -360,6 +360,6 @@ public class EmptyPropertiesTest {
@Test
public void testValues() {
assertTrue(PropertiesFactory.EMPTY_PROPERTIES.values().isEmpty());
assertTrue(PropertiesFactory.EMPTY_PROPERTIES.isEmpty());
}
}

View File

@ -65,7 +65,7 @@ public class TransformedQueueTest<E> extends AbstractQueueTest<E> {
final Queue<Object> queue = TransformedQueue.transformingQueue(new LinkedList<>(),
TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
assertEquals(0, queue.size());
final Object[] elements = new Object[] { "1", "3", "5", "7", "2", "4", "6" };
final Object[] elements = { "1", "3", "5", "7", "2", "4", "6" };
for (int i = 0; i < elements.length; i++) {
queue.add(elements[i]);
assertEquals(i + 1, queue.size());
@ -81,7 +81,7 @@ public class TransformedQueueTest<E> extends AbstractQueueTest<E> {
@SuppressWarnings({ "rawtypes", "unchecked" })
public void testTransformedQueue_decorateTransform() {
final Queue originalQueue = new LinkedList();
final Object[] elements = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
final Object[] elements = {"1", "3", "5", "7", "2", "4", "6"};
Collections.addAll(originalQueue, elements);
final Queue<?> queue = TransformedQueue.transformedQueue(originalQueue,
TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);

View File

@ -57,7 +57,7 @@ public class SequencesComparatorTest {
@Test
public void testMinimal() {
final String[] shadokAlph = new String[] {
final String[] shadokAlph = {
"GA",
"BU",
"ZO",
@ -109,7 +109,7 @@ public class SequencesComparatorTest {
@Test
public void testShadok() {
final int lgMax = 5;
final String[] shadokAlph = new String[] {
final String[] shadokAlph = {
"GA",
"BU",
"ZO",
@ -154,7 +154,7 @@ public class SequencesComparatorTest {
return list;
}
private class ExecutionVisitor<T> implements CommandVisitor<T> {
private static class ExecutionVisitor<T> implements CommandVisitor<T> {
private List<T> v;
private int index;

View File

@ -76,7 +76,7 @@ public class TransformedNavigableSetTest<E> extends AbstractNavigableSetTest<E>
public void testTransformedSet_decorateTransform() {
final Set<Object> originalSet = new TreeSet<>();
final Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
final Object[] els = {"1", "3", "5", "7", "2", "4", "6"};
Collections.addAll(originalSet, els);
final Set<?> set = TransformedSet.transformedSet(originalSet,
TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);

View File

@ -81,7 +81,7 @@ public class TransformedSetTest<E> extends AbstractSetTest<E> {
public void testTransformedSet_decorateTransform() {
final Set<Object> originalSet = new HashSet<>();
final Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
final Object[] els = {"1", "3", "5", "7", "2", "4", "6"};
Collections.addAll(originalSet, els);
final Set<?> set = TransformedSet.transformedSet(originalSet, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
assertEquals(els.length, set.size());

View File

@ -74,7 +74,7 @@ public class TransformedSortedSetTest<E> extends AbstractSortedSetTest<E> {
public void testTransformedSet_decorateTransform() {
final Set<Object> originalSet = new TreeSet<>();
final Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
final Object[] els = {"1", "3", "5", "7", "2", "4", "6"};
Collections.addAll(originalSet, els);
final Set<?> set = TransformedSet.transformedSet(originalSet, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
assertEquals(els.length, set.size());

View File

@ -50,8 +50,8 @@ public class TransformedSplitMapTest extends BulkTest {
final TransformedSplitMap<Integer, String, Object, Class<?>> map = TransformedSplitMap.transformingMap(
new HashMap<String, Class<?>>(), intToString, objectToClass);
final Integer[] k = new Integer[] { 0, 1, 2, 3, 4, 5, 6 };
final Object[] v = new Object[] { "", new Object(), new HashMap<>(), 0, BigInteger.TEN, null,
final Integer[] k = { 0, 1, 2, 3, 4, 5, 6 };
final Object[] v = { "", new Object(), new HashMap<>(), 0, BigInteger.TEN, null,
new Object[0] };
assertEquals(0, map.size());

View File

@ -61,7 +61,7 @@ public class PatriciaTrieTest<V> extends AbstractSortedMapTest<String, V> {
public void testPrefixMap() {
final PatriciaTrie<String> trie = new PatriciaTrie<>();
final String[] keys = new String[]{
final String[] keys = {
"",
"Albert", "Xavier", "XyZ", "Anna", "Alien", "Alberto",
"Alberts", "Allie", "Alliese", "Alabama", "Banane",
@ -289,7 +289,7 @@ public class PatriciaTrieTest<V> extends AbstractSortedMapTest<String, V> {
public void testPrefixMapRemoval() {
final PatriciaTrie<String> trie = new PatriciaTrie<>();
final String[] keys = new String[]{
final String[] keys = {
"Albert", "Xavier", "XyZ", "Anna", "Alien", "Alberto",
"Alberts", "Allie", "Alliese", "Alabama", "Banane",
"Blabla", "Amber", "Ammun", "Akka", "Akko", "Albertoo",
@ -338,15 +338,15 @@ public class PatriciaTrieTest<V> extends AbstractSortedMapTest<String, V> {
assertEquals("测试", aTree.prefixMap("").get("点评"));
assertFalse(aTree.prefixMap("").isEmpty());
assertEquals(1, aTree.prefixMap("").size());
assertEquals(1, aTree.prefixMap("").keySet().size());
assertEquals(1, aTree.prefixMap("").size());
assertEquals(1, aTree.prefixMap("").entrySet().size());
assertEquals(1, aTree.prefixMap("点评").values().size());
assertEquals(1, aTree.prefixMap("点评").size());
aTree.clear();
aTree.put("点评", "联盟");
aTree.put("点版", "定向");
assertEquals(2, aTree.prefixMap("").keySet().size());
assertEquals(2, aTree.prefixMap("").values().size());
assertEquals(2, aTree.prefixMap("").size());
assertEquals(2, aTree.prefixMap("").size());
}
public void testPrefixMapSizes2() {
@ -384,8 +384,8 @@ public class PatriciaTrieTest<V> extends AbstractSortedMapTest<String, V> {
prefixMap.clear();
assertTrue(prefixMap.isEmpty());
assertTrue(prefixMap.keySet().isEmpty());
assertTrue(prefixMap.values().isEmpty());
assertTrue(prefixMap.isEmpty());
assertTrue(prefixMap.isEmpty());
assertEquals(new HashSet<>(Arrays.asList("Anael", "Analu", "Anatole", "Anna")), trie.keySet());
assertEquals(Arrays.asList(2, 3, 7, 1), new ArrayList<>(trie.values()));
}
@ -398,8 +398,8 @@ public class PatriciaTrieTest<V> extends AbstractSortedMapTest<String, V> {
prefixMap.clear();
assertTrue(prefixMap.isEmpty());
assertTrue(prefixMap.keySet().isEmpty());
assertTrue(prefixMap.values().isEmpty());
assertTrue(prefixMap.isEmpty());
assertTrue(prefixMap.isEmpty());
assertEquals(new HashSet<String>(), trie.keySet());
assertEquals(new ArrayList<Integer>(0), new ArrayList<>(trie.values()));
}
@ -421,8 +421,8 @@ public class PatriciaTrieTest<V> extends AbstractSortedMapTest<String, V> {
for (final String key : keys) {
prefixMap.remove(key);
}
assertTrue(prefixMap.keySet().isEmpty());
assertTrue(prefixMap.values().isEmpty());
assertTrue(prefixMap.isEmpty());
assertTrue(prefixMap.isEmpty());
assertEquals(new HashSet<>(Arrays.asList("Anael", "Analu", "Anatole", "Anna")), trie.keySet());
assertEquals(Arrays.asList(2, 3, 7, 1), new ArrayList<>(trie.values()));
}