commit
cee61e4b76
|
@ -291,6 +291,9 @@
|
|||
<action type="update" dev="kinow" due-to="Dependabot">
|
||||
Bump easymock from 4.2 to 4.3 #226.
|
||||
</action>
|
||||
<action issue="COLLECTIONS-793" type="update" dev="kinow" due-to="Arturo Bernal">
|
||||
Simplify Assertion.
|
||||
</action>
|
||||
</release>
|
||||
<release version="4.4" date="2019-07-05" description="Maintenance release.">
|
||||
<action issue="COLLECTIONS-710" dev="ggregory" type="fix" due-to="Yu Shi, Gary Gregory">
|
||||
|
|
|
@ -104,7 +104,7 @@ public abstract class AbstractObjectTest extends BulkTest {
|
|||
|
||||
public void testEqualsNull() {
|
||||
final Object obj = makeObject();
|
||||
assertEquals(false, obj.equals(null)); // make sure this doesn't throw NPE either
|
||||
assertFalse(obj.equals(null)); // make sure this doesn't throw NPE either
|
||||
}
|
||||
|
||||
public void testObjectHashCodeEqualsSelfHashCode() {
|
||||
|
@ -124,9 +124,7 @@ public abstract class AbstractObjectTest extends BulkTest {
|
|||
assertEquals(
|
||||
"[2] When two objects are equal, their hashCodes should be also.",
|
||||
obj1.hashCode(), obj2.hashCode());
|
||||
assertTrue(
|
||||
"When obj1.equals(obj2) is true, then obj2.equals(obj1) should also be true",
|
||||
obj2.equals(obj1));
|
||||
assertEquals("When obj1.equals(obj2) is true, then obj2.equals(obj1) should also be true", obj2, obj1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ public class ArrayStackTest<E> extends AbstractArrayListTest<E> {
|
|||
final ArrayStack<E> stack = makeObject();
|
||||
|
||||
stack.push((E) "First Item");
|
||||
assertTrue("Stack is not empty", !stack.empty());
|
||||
assertFalse("Stack is not empty", stack.empty());
|
||||
assertEquals("Stack size is one", 1, stack.size());
|
||||
assertEquals("Top item is 'First Item'",
|
||||
"First Item", (String) stack.peek());
|
||||
|
|
|
@ -311,12 +311,12 @@ public class CollectionUtilsTest extends MockTestCase {
|
|||
public void collect() {
|
||||
final Transformer<Number, Long> transformer = TransformerUtils.constantTransformer(2L);
|
||||
Collection<Number> collection = CollectionUtils.<Integer, Number>collect(iterableA, transformer);
|
||||
assertTrue(collection.size() == collectionA.size());
|
||||
assertEquals(collection.size(), collectionA.size());
|
||||
assertCollectResult(collection);
|
||||
|
||||
ArrayList<Number> list;
|
||||
list = CollectionUtils.collect(collectionA, transformer, new ArrayList<Number>());
|
||||
assertTrue(list.size() == collectionA.size());
|
||||
assertEquals(list.size(), collectionA.size());
|
||||
assertCollectResult(list);
|
||||
|
||||
Iterator<Integer> iterator = null;
|
||||
|
@ -324,12 +324,12 @@ public class CollectionUtilsTest extends MockTestCase {
|
|||
|
||||
iterator = iterableA.iterator();
|
||||
list = CollectionUtils.collect(iterator, transformer, list);
|
||||
assertTrue(collection.size() == collectionA.size());
|
||||
assertEquals(collection.size(), collectionA.size());
|
||||
assertCollectResult(collection);
|
||||
|
||||
iterator = collectionA.iterator();
|
||||
collection = CollectionUtils.<Integer, Number>collect(iterator, transformer);
|
||||
assertTrue(collection.size() == collectionA.size());
|
||||
assertEquals(collection.size(), collectionA.size());
|
||||
assertTrue(collection.contains(2L) && !collection.contains(1));
|
||||
collection = CollectionUtils.collect((Iterator<Integer>) null, (Transformer<Integer, Number>) null);
|
||||
assertTrue(collection.isEmpty());
|
||||
|
@ -2140,9 +2140,9 @@ public class CollectionUtilsTest extends MockTestCase {
|
|||
@Test
|
||||
public void testSizeIsEmpty_Map() {
|
||||
final Map<String, String> map = new HashMap<>();
|
||||
assertEquals(true, CollectionUtils.sizeIsEmpty(map));
|
||||
assertTrue(CollectionUtils.sizeIsEmpty(map));
|
||||
map.put("1", "a");
|
||||
assertEquals(false, CollectionUtils.sizeIsEmpty(map));
|
||||
assertFalse(CollectionUtils.sizeIsEmpty(map));
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
|
|
@ -57,7 +57,7 @@ public class EnumerationUtilsTest {
|
|||
} catch (final IndexOutOfBoundsException e) {
|
||||
// expected
|
||||
}
|
||||
assertTrue(!en.hasMoreElements());
|
||||
assertFalse(en.hasMoreElements());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -75,13 +75,13 @@ public abstract class AbstractOrderedBidiMapTest<K, V> extends AbstractBidiMapTe
|
|||
public void testNextKey() {
|
||||
resetEmpty();
|
||||
OrderedBidiMap<K, V> bidi = (OrderedBidiMap<K, V>) map;
|
||||
assertEquals(null, bidi.nextKey(getOtherKeys()[0]));
|
||||
assertNull(bidi.nextKey(getOtherKeys()[0]));
|
||||
if (!isAllowNullKey()) {
|
||||
try {
|
||||
assertEquals(null, bidi.nextKey(null)); // this is allowed too
|
||||
assertNull(bidi.nextKey(null)); // this is allowed too
|
||||
} catch (final NullPointerException ex) {}
|
||||
} else {
|
||||
assertEquals(null, bidi.nextKey(null));
|
||||
assertNull(bidi.nextKey(null));
|
||||
}
|
||||
|
||||
resetFull();
|
||||
|
@ -93,7 +93,7 @@ public abstract class AbstractOrderedBidiMapTest<K, V> extends AbstractBidiMapTe
|
|||
assertEquals(confirmedObject, bidi.nextKey(confirmedLast));
|
||||
confirmedLast = confirmedObject;
|
||||
}
|
||||
assertEquals(null, bidi.nextKey(confirmedLast));
|
||||
assertNull(bidi.nextKey(confirmedLast));
|
||||
|
||||
if (!isAllowNullKey()) {
|
||||
try {
|
||||
|
@ -101,20 +101,20 @@ public abstract class AbstractOrderedBidiMapTest<K, V> extends AbstractBidiMapTe
|
|||
fail();
|
||||
} catch (final NullPointerException ex) {}
|
||||
} else {
|
||||
assertEquals(null, bidi.nextKey(null));
|
||||
assertNull(bidi.nextKey(null));
|
||||
}
|
||||
}
|
||||
|
||||
public void testPreviousKey() {
|
||||
resetEmpty();
|
||||
OrderedBidiMap<K, V> bidi = getMap();
|
||||
assertEquals(null, bidi.previousKey(getOtherKeys()[0]));
|
||||
assertNull(bidi.previousKey(getOtherKeys()[0]));
|
||||
if (!isAllowNullKey()) {
|
||||
try {
|
||||
assertEquals(null, bidi.previousKey(null)); // this is allowed too
|
||||
assertNull(bidi.previousKey(null)); // this is allowed too
|
||||
} catch (final NullPointerException ex) {}
|
||||
} else {
|
||||
assertEquals(null, bidi.previousKey(null));
|
||||
assertNull(bidi.previousKey(null));
|
||||
}
|
||||
|
||||
resetFull();
|
||||
|
@ -128,7 +128,7 @@ public abstract class AbstractOrderedBidiMapTest<K, V> extends AbstractBidiMapTe
|
|||
assertEquals(confirmedObject, bidi.previousKey(confirmedLast));
|
||||
confirmedLast = confirmedObject;
|
||||
}
|
||||
assertEquals(null, bidi.previousKey(confirmedLast));
|
||||
assertNull(bidi.previousKey(confirmedLast));
|
||||
|
||||
if (!isAllowNullKey()) {
|
||||
try {
|
||||
|
@ -136,7 +136,7 @@ public abstract class AbstractOrderedBidiMapTest<K, V> extends AbstractBidiMapTe
|
|||
fail();
|
||||
} catch (final NullPointerException ex) {}
|
||||
} else {
|
||||
assertEquals(null, bidi.previousKey(null));
|
||||
assertNull(bidi.previousKey(null));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -851,7 +851,7 @@ public abstract class AbstractCollectionTest<E> extends AbstractObjectTest {
|
|||
resetEmpty();
|
||||
final E[] elements = getFullElements();
|
||||
for (final E element : elements) {
|
||||
assertTrue("Shouldn't remove nonexistent element", !getCollection().remove(element));
|
||||
assertFalse("Shouldn't remove nonexistent element", getCollection().remove(element));
|
||||
verify();
|
||||
}
|
||||
|
||||
|
@ -895,12 +895,10 @@ public abstract class AbstractCollectionTest<E> extends AbstractObjectTest {
|
|||
}
|
||||
|
||||
resetEmpty();
|
||||
assertTrue("Empty collection removeAll should return false for empty input",
|
||||
!getCollection().removeAll(Collections.EMPTY_SET));
|
||||
assertFalse("Empty collection removeAll should return false for empty input", getCollection().removeAll(Collections.EMPTY_SET));
|
||||
verify();
|
||||
|
||||
assertTrue("Empty collection removeAll should return false for nonempty input",
|
||||
!getCollection().removeAll(new ArrayList<>(getCollection())));
|
||||
assertFalse("Empty collection removeAll should return false for nonempty input", getCollection().removeAll(new ArrayList<>(getCollection())));
|
||||
verify();
|
||||
|
||||
resetFull();
|
||||
|
|
|
@ -334,9 +334,9 @@ public class CompositeCollectionTest<E> extends AbstractCollectionTest<E> {
|
|||
final Collection<E> removing = new ArrayList<>(one);
|
||||
c.addComposited(one, two);
|
||||
c.removeAll(removing);
|
||||
assertTrue(!c.contains("1"));
|
||||
assertTrue(!one.contains("1"));
|
||||
assertTrue(!two.contains("1"));
|
||||
assertFalse(c.contains("1"));
|
||||
assertFalse(one.contains("1"));
|
||||
assertFalse(two.contains("1"));
|
||||
c.removeAll(null);
|
||||
assertFalse(c.contains("1"));
|
||||
assertFalse(one.contains("1"));
|
||||
|
@ -356,13 +356,13 @@ public class CompositeCollectionTest<E> extends AbstractCollectionTest<E> {
|
|||
final Predicate<E> predicate = e -> e == "1";
|
||||
c.addComposited(one, two);
|
||||
c.removeIf(predicate);
|
||||
assertTrue(!c.contains("1"));
|
||||
assertTrue(!one.contains("1"));
|
||||
assertTrue(!two.contains("1"));
|
||||
assertFalse(c.contains("1"));
|
||||
assertFalse(one.contains("1"));
|
||||
assertFalse(two.contains("1"));
|
||||
c.removeIf(null);
|
||||
assertTrue(!c.contains("1"));
|
||||
assertTrue(!one.contains("1"));
|
||||
assertTrue(!two.contains("1"));
|
||||
assertFalse(c.contains("1"));
|
||||
assertFalse(one.contains("1"));
|
||||
assertFalse(two.contains("1"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -105,7 +105,7 @@ public abstract class AbstractIteratorTest<E> extends AbstractObjectTest {
|
|||
final Iterator<E> it = makeEmptyIterator();
|
||||
|
||||
// hasNext() should return false
|
||||
assertEquals("hasNext() should return false for empty iterators", false, it.hasNext());
|
||||
assertFalse("hasNext() should return false for empty iterators", it.hasNext());
|
||||
|
||||
// next() should throw a NoSuchElementException
|
||||
try {
|
||||
|
@ -129,7 +129,7 @@ public abstract class AbstractIteratorTest<E> extends AbstractObjectTest {
|
|||
final Iterator<E> it = makeObject();
|
||||
|
||||
// hasNext() must be true (ensure makeFullIterator is correct!)
|
||||
assertEquals("hasNext() should return true for at least one element", true, it.hasNext());
|
||||
assertTrue("hasNext() should return true for at least one element", it.hasNext());
|
||||
|
||||
// next() must not throw exception (ensure makeFullIterator is correct!)
|
||||
try {
|
||||
|
|
|
@ -95,9 +95,9 @@ public abstract class AbstractListIteratorTest<E> extends AbstractIteratorTest<E
|
|||
|
||||
final ListIterator<E> it = makeEmptyIterator();
|
||||
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
assertEquals(0, it.nextIndex());
|
||||
assertEquals(false, it.hasPrevious());
|
||||
assertFalse(it.hasPrevious());
|
||||
assertEquals(-1, it.previousIndex());
|
||||
|
||||
// next() should throw a NoSuchElementException
|
||||
|
@ -126,8 +126,8 @@ public abstract class AbstractListIteratorTest<E> extends AbstractIteratorTest<E
|
|||
}
|
||||
|
||||
// check state at end
|
||||
assertEquals(false, it.hasNext());
|
||||
assertEquals(true, it.hasPrevious());
|
||||
assertFalse(it.hasNext());
|
||||
assertTrue(it.hasPrevious());
|
||||
try {
|
||||
it.next();
|
||||
fail("NoSuchElementException must be thrown from next at end of ListIterator");
|
||||
|
@ -144,8 +144,8 @@ public abstract class AbstractListIteratorTest<E> extends AbstractIteratorTest<E
|
|||
}
|
||||
|
||||
// check state at start
|
||||
assertEquals(true, it.hasNext());
|
||||
assertEquals(false, it.hasPrevious());
|
||||
assertTrue(it.hasNext());
|
||||
assertFalse(it.hasPrevious());
|
||||
try {
|
||||
it.previous();
|
||||
fail("NoSuchElementException must be thrown from previous at start of ListIterator");
|
||||
|
@ -177,7 +177,7 @@ public abstract class AbstractListIteratorTest<E> extends AbstractIteratorTest<E
|
|||
// add at start should be OK, added should not be next
|
||||
it = makeObject();
|
||||
it.add(addValue);
|
||||
assertTrue(addValue != it.next());
|
||||
assertNotSame(addValue, it.next());
|
||||
|
||||
// add in middle and at end should be OK
|
||||
it = makeObject();
|
||||
|
|
|
@ -114,7 +114,7 @@ public abstract class AbstractMapIteratorTest<K, V> extends AbstractIteratorTest
|
|||
}
|
||||
|
||||
final MapIterator<K, V> it = makeEmptyIterator();
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
|
||||
// next() should throw a NoSuchElementException
|
||||
try {
|
||||
|
@ -161,9 +161,9 @@ public abstract class AbstractMapIteratorTest<K, V> extends AbstractIteratorTest
|
|||
|
||||
final MapIterator<K, V> it = makeObject();
|
||||
final Map<K, V> map = getMap();
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
final Set<K> set = new HashSet<>();
|
||||
while (it.hasNext()) {
|
||||
// getKey
|
||||
|
@ -193,7 +193,7 @@ public abstract class AbstractMapIteratorTest<K, V> extends AbstractIteratorTest
|
|||
final MapIterator<K, V> it = makeObject();
|
||||
final Map<K, V> map = getMap();
|
||||
final Map<K, V> confirmed = getConfirmedMap();
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
final K key = it.next();
|
||||
final V value = it.getValue();
|
||||
|
||||
|
@ -209,11 +209,11 @@ public abstract class AbstractMapIteratorTest<K, V> extends AbstractIteratorTest
|
|||
assertSame("Key must not change after setValue", key, it.getKey());
|
||||
assertSame("Value must be changed after setValue", newValue, it.getValue());
|
||||
assertSame("setValue must return old value", value, old);
|
||||
assertEquals("Map must contain key", true, map.containsKey(key));
|
||||
assertTrue("Map must contain key", map.containsKey(key));
|
||||
// test against confirmed, as map may contain value twice
|
||||
assertEquals("Map must not contain old value",
|
||||
confirmed.containsValue(old), map.containsValue(old));
|
||||
assertEquals("Map must contain new value", true, map.containsValue(newValue));
|
||||
assertTrue("Map must contain new value", map.containsValue(newValue));
|
||||
verify();
|
||||
|
||||
it.setValue(newValue); // same value - should be OK
|
||||
|
@ -234,7 +234,7 @@ public abstract class AbstractMapIteratorTest<K, V> extends AbstractIteratorTest
|
|||
final MapIterator<K, V> it = makeObject();
|
||||
final Map<K, V> map = getMap();
|
||||
final Map<K, V> confirmed = getConfirmedMap();
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
final K key = it.next();
|
||||
|
||||
if (!supportsRemove()) {
|
||||
|
@ -248,7 +248,7 @@ public abstract class AbstractMapIteratorTest<K, V> extends AbstractIteratorTest
|
|||
|
||||
it.remove();
|
||||
confirmed.remove(key);
|
||||
assertEquals(false, map.containsKey(key));
|
||||
assertFalse(map.containsKey(key));
|
||||
verify();
|
||||
|
||||
try {
|
||||
|
@ -266,7 +266,7 @@ public abstract class AbstractMapIteratorTest<K, V> extends AbstractIteratorTest
|
|||
final MapIterator<K, V> it = makeObject();
|
||||
final Map<K, V> confirmed = getConfirmedMap();
|
||||
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
final K key = it.next();
|
||||
|
||||
it.setValue(newValue);
|
||||
|
@ -288,7 +288,7 @@ public abstract class AbstractMapIteratorTest<K, V> extends AbstractIteratorTest
|
|||
final MapIterator<K, V> it = makeObject();
|
||||
final Map<K, V> confirmed = getConfirmedMap();
|
||||
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
final K key = it.next();
|
||||
|
||||
it.remove();
|
||||
|
@ -309,7 +309,7 @@ public abstract class AbstractMapIteratorTest<K, V> extends AbstractIteratorTest
|
|||
final MapIterator<K, V> it = makeObject();
|
||||
final Map<K, V> confirmed = getConfirmedMap();
|
||||
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
final K key = it.next();
|
||||
|
||||
it.remove();
|
||||
|
|
|
@ -65,7 +65,7 @@ public abstract class AbstractOrderedMapIteratorTest<K, V> extends AbstractMapIt
|
|||
super.testEmptyMapIterator();
|
||||
|
||||
final OrderedMapIterator<K, V> it = makeEmptyIterator();
|
||||
assertEquals(false, it.hasPrevious());
|
||||
assertFalse(it.hasPrevious());
|
||||
try {
|
||||
it.previous();
|
||||
fail();
|
||||
|
@ -86,8 +86,8 @@ public abstract class AbstractOrderedMapIteratorTest<K, V> extends AbstractMapIt
|
|||
final OrderedMapIterator<K, V> it = makeObject();
|
||||
final Map<K, V> map = getMap();
|
||||
|
||||
assertEquals(true, it.hasNext());
|
||||
assertEquals(false, it.hasPrevious());
|
||||
assertTrue(it.hasNext());
|
||||
assertFalse(it.hasPrevious());
|
||||
final Set<K> set = new HashSet<>();
|
||||
while (it.hasNext()) {
|
||||
// getKey
|
||||
|
@ -103,7 +103,7 @@ public abstract class AbstractOrderedMapIteratorTest<K, V> extends AbstractMapIt
|
|||
}
|
||||
assertTrue("Value must be in map", map.containsValue(value));
|
||||
|
||||
assertEquals(true, it.hasPrevious());
|
||||
assertTrue(it.hasPrevious());
|
||||
|
||||
verify();
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ public abstract class AbstractOrderedMapIteratorTest<K, V> extends AbstractMapIt
|
|||
}
|
||||
assertTrue("Value must be in map", map.containsValue(value));
|
||||
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
|
||||
verify();
|
||||
}
|
||||
|
@ -141,8 +141,8 @@ public abstract class AbstractOrderedMapIteratorTest<K, V> extends AbstractMapIt
|
|||
assertEquals("keySet() not consistent", new ArrayList<>(map.keySet()), new ArrayList<>(map.keySet()));
|
||||
|
||||
final Iterator<K> it2 = map.keySet().iterator();
|
||||
assertEquals(true, it.hasNext());
|
||||
assertEquals(true, it2.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertTrue(it2.hasNext());
|
||||
final List<K> list = new ArrayList<>();
|
||||
while (it.hasNext()) {
|
||||
final K key = it.next();
|
||||
|
|
|
@ -67,14 +67,12 @@ public class ArrayIterator2Test<E> extends AbstractIteratorTest<E> {
|
|||
assertEquals("Iteration value is correct", testValue, iterValue);
|
||||
}
|
||||
|
||||
assertTrue("Iterator should now be empty", !iter.hasNext());
|
||||
assertFalse("Iterator should now be empty", iter.hasNext());
|
||||
|
||||
try {
|
||||
iter.next();
|
||||
} catch (final Exception e) {
|
||||
assertTrue(
|
||||
"NoSuchElementException must be thrown",
|
||||
e.getClass().equals(new NoSuchElementException().getClass()));
|
||||
assertEquals("NoSuchElementException must be thrown", e.getClass(), new NoSuchElementException().getClass());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ package org.apache.commons.collections4.iterators;
|
|||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
/**
|
||||
* Tests the ArrayIterator to ensure that the next() method will actually
|
||||
* perform the iteration rather than the hasNext() method.
|
||||
|
@ -56,15 +58,9 @@ public class ArrayIteratorTest<E> extends AbstractIteratorTest<E> {
|
|||
assertEquals("Iteration value is correct", testValue, iterValue);
|
||||
}
|
||||
|
||||
assertTrue("Iterator should now be empty", !iter.hasNext());
|
||||
assertFalse("Iterator should now be empty", iter.hasNext());
|
||||
|
||||
try {
|
||||
iter.next();
|
||||
} catch (final Exception e) {
|
||||
assertTrue(
|
||||
"NoSuchElementException must be thrown",
|
||||
e.getClass().equals(new NoSuchElementException().getClass()));
|
||||
}
|
||||
assertThrows(NoSuchElementException.class, iter::next, "NoSuchElementException must be thrown");
|
||||
}
|
||||
|
||||
public void testNullArray() {
|
||||
|
|
|
@ -16,10 +16,11 @@
|
|||
*/
|
||||
package org.apache.commons.collections4.iterators;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ListIterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
|
||||
/**
|
||||
* Test the ArrayListIterator class.
|
||||
*
|
||||
|
@ -71,14 +72,12 @@ public class ArrayListIteratorTest<E> extends ArrayIteratorTest<E> {
|
|||
assertEquals("Iteration value is correct", testValue, iterValue);
|
||||
}
|
||||
|
||||
assertTrue("Iterator should now be empty", !iter.hasPrevious());
|
||||
assertFalse("Iterator should now be empty", iter.hasPrevious());
|
||||
|
||||
try {
|
||||
iter.previous();
|
||||
} catch (final Exception e) {
|
||||
assertTrue(
|
||||
"NoSuchElementException must be thrown",
|
||||
e.getClass().equals(new NoSuchElementException().getClass()));
|
||||
assertEquals("NoSuchElementException must be thrown", e.getClass(), new NoSuchElementException().getClass());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -101,7 +100,7 @@ public class ArrayListIteratorTest<E> extends ArrayIteratorTest<E> {
|
|||
x++;
|
||||
}
|
||||
|
||||
assertTrue("The two arrays should have the same value, i.e. {0,1,2}", Arrays.equals(testData, result));
|
||||
assertArrayEquals("The two arrays should have the same value, i.e. {0,1,2}", testData, result);
|
||||
|
||||
// a call to set() before a call to next() or previous() should throw an IllegalStateException
|
||||
iter = makeArrayListIterator(testArray);
|
||||
|
|
|
@ -102,7 +102,7 @@ public class CollatingIteratorTest extends AbstractIteratorTest<Integer> {
|
|||
assertEquals(even, iter.next());
|
||||
assertEquals(0, iter.getIteratorIndex());
|
||||
}
|
||||
assertTrue(!iter.hasNext());
|
||||
assertFalse(iter.hasNext());
|
||||
}
|
||||
|
||||
public void testIterateEvenOdd() {
|
||||
|
@ -112,7 +112,7 @@ public class CollatingIteratorTest extends AbstractIteratorTest<Integer> {
|
|||
assertEquals(Integer.valueOf(i), iter.next());
|
||||
assertEquals(i % 2, iter.getIteratorIndex());
|
||||
}
|
||||
assertTrue(!iter.hasNext());
|
||||
assertFalse(iter.hasNext());
|
||||
}
|
||||
|
||||
public void testIterateOddEven() {
|
||||
|
@ -122,7 +122,7 @@ public class CollatingIteratorTest extends AbstractIteratorTest<Integer> {
|
|||
assertEquals(Integer.valueOf(i), iter.next());
|
||||
assertEquals(i % 2 == 0 ? 1 : 0, iter.getIteratorIndex());
|
||||
}
|
||||
assertTrue(!iter.hasNext());
|
||||
assertFalse(iter.hasNext());
|
||||
}
|
||||
|
||||
public void testIterateEvenEven() {
|
||||
|
@ -137,7 +137,7 @@ public class CollatingIteratorTest extends AbstractIteratorTest<Integer> {
|
|||
assertEquals(even, iter.next());
|
||||
assertEquals(1, iter.getIteratorIndex());
|
||||
}
|
||||
assertTrue(!iter.hasNext());
|
||||
assertFalse(iter.hasNext());
|
||||
}
|
||||
|
||||
public void testIterateFibEvenOdd() {
|
||||
|
@ -203,7 +203,7 @@ public class CollatingIteratorTest extends AbstractIteratorTest<Integer> {
|
|||
assertEquals(Integer.valueOf(21), iter.next()); // fib 21
|
||||
assertEquals(0, iter.getIteratorIndex());
|
||||
|
||||
assertTrue(!iter.hasNext());
|
||||
assertFalse(iter.hasNext());
|
||||
}
|
||||
|
||||
public void testRemoveFromSingle() {
|
||||
|
|
|
@ -121,11 +121,11 @@ public class FilterIteratorTest<E> extends AbstractIteratorTest<E> {
|
|||
final FilterIterator<E> filterIterator = new FilterIterator<>(iter1);
|
||||
filterIterator.setPredicate(truePredicate());
|
||||
// this iterator has elements
|
||||
assertEquals(true, filterIterator.hasNext());
|
||||
assertTrue(filterIterator.hasNext());
|
||||
|
||||
// this iterator has no elements
|
||||
filterIterator.setIterator(iter2);
|
||||
assertEquals(false, filterIterator.hasNext());
|
||||
assertFalse(filterIterator.hasNext());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -138,15 +138,15 @@ public class FilterIteratorTest<E> extends AbstractIteratorTest<E> {
|
|||
final FilterIterator<E> filterIterator = new FilterIterator<>(iter);
|
||||
filterIterator.setPredicate(truePredicate());
|
||||
// this predicate matches
|
||||
assertEquals(true, filterIterator.hasNext());
|
||||
assertTrue(filterIterator.hasNext());
|
||||
|
||||
// this predicate doesn't match
|
||||
filterIterator.setPredicate(NotNullPredicate.notNullPredicate());
|
||||
assertEquals(false, filterIterator.hasNext());
|
||||
assertFalse(filterIterator.hasNext());
|
||||
}
|
||||
|
||||
private void verifyNoMoreElements() {
|
||||
assertTrue(!iterator.hasNext());
|
||||
assertFalse(iterator.hasNext());
|
||||
try {
|
||||
iterator.next();
|
||||
fail("NoSuchElementException expected");
|
||||
|
@ -179,7 +179,7 @@ public class FilterIteratorTest<E> extends AbstractIteratorTest<E> {
|
|||
if (iterator.hasNext()) {
|
||||
final Object last = iterator.next();
|
||||
iterator.remove();
|
||||
assertTrue("Base of FilterIterator still contains removed element.", !list.contains(last));
|
||||
assertFalse("Base of FilterIterator still contains removed element.", list.contains(last));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ public class FilterListIteratorTest {
|
|||
assertEquals(Integer.valueOf(3), filtered.previous());
|
||||
assertEquals(Integer.valueOf(0), filtered.previous());
|
||||
|
||||
assertTrue(!filtered.hasPrevious());
|
||||
assertFalse(filtered.hasPrevious());
|
||||
|
||||
assertEquals(Integer.valueOf(0), filtered.next());
|
||||
assertEquals(Integer.valueOf(3), filtered.next());
|
||||
|
@ -146,7 +146,7 @@ public class FilterListIteratorTest {
|
|||
assertEquals(Integer.valueOf(15), filtered.next());
|
||||
assertEquals(Integer.valueOf(18), filtered.next());
|
||||
|
||||
assertTrue(!filtered.hasNext());
|
||||
assertFalse(filtered.hasNext());
|
||||
|
||||
assertEquals(Integer.valueOf(18), filtered.previous());
|
||||
assertEquals(Integer.valueOf(15), filtered.previous());
|
||||
|
@ -276,7 +276,7 @@ public class FilterListIteratorTest {
|
|||
filtered.next();
|
||||
}
|
||||
assertTrue(filtered.hasPrevious());
|
||||
assertTrue(!filtered.hasNext());
|
||||
assertFalse(filtered.hasNext());
|
||||
assertEquals(expected.previous(), filtered.previous());
|
||||
}
|
||||
|
||||
|
|
|
@ -79,13 +79,12 @@ public class IteratorChainTest extends AbstractIteratorTest<String> {
|
|||
assertEquals( "Iteration value is correct", testValue, iterValue );
|
||||
}
|
||||
|
||||
assertTrue("Iterator should now be empty", !iter.hasNext());
|
||||
assertFalse("Iterator should now be empty", iter.hasNext());
|
||||
|
||||
try {
|
||||
iter.next();
|
||||
} catch (final Exception e) {
|
||||
assertTrue("NoSuchElementException must be thrown",
|
||||
e.getClass().equals(new NoSuchElementException().getClass()));
|
||||
assertEquals("NoSuchElementException must be thrown", e.getClass(), new NoSuchElementException().getClass());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,7 +134,7 @@ public class IteratorChainTest extends AbstractIteratorTest<String> {
|
|||
}
|
||||
|
||||
assertTrue("List is empty", list1.isEmpty());
|
||||
assertTrue("List is empty", list2.size() == 1);
|
||||
assertEquals("List is empty", 1, list2.size());
|
||||
assertTrue("List is empty", list3.isEmpty());
|
||||
}
|
||||
|
||||
|
@ -154,12 +153,12 @@ public class IteratorChainTest extends AbstractIteratorTest<String> {
|
|||
assertEquals("B", chain.next());
|
||||
assertTrue("should have next", chain.hasNext());
|
||||
assertEquals("C", chain.next());
|
||||
assertTrue("should not have next", !chain.hasNext());
|
||||
assertFalse("should not have next", chain.hasNext());
|
||||
}
|
||||
|
||||
public void testEmptyChain() {
|
||||
final IteratorChain<Object> chain = new IteratorChain<>();
|
||||
assertEquals(false, chain.hasNext());
|
||||
assertFalse(chain.hasNext());
|
||||
try {
|
||||
chain.next();
|
||||
fail();
|
||||
|
|
|
@ -93,13 +93,12 @@ public class LazyIteratorChainTest extends AbstractIteratorTest<String> {
|
|||
assertEquals( "Iteration value is correct", testValue, iterValue );
|
||||
}
|
||||
|
||||
assertTrue("Iterator should now be empty", !iter.hasNext());
|
||||
assertFalse("Iterator should now be empty", iter.hasNext());
|
||||
|
||||
try {
|
||||
iter.next();
|
||||
} catch (final Exception e) {
|
||||
assertTrue("NoSuchElementException must be thrown",
|
||||
e.getClass().equals(new NoSuchElementException().getClass()));
|
||||
assertEquals("NoSuchElementException must be thrown", e.getClass(), new NoSuchElementException().getClass());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,7 +148,7 @@ public class LazyIteratorChainTest extends AbstractIteratorTest<String> {
|
|||
}
|
||||
|
||||
assertTrue("List is empty", list1.isEmpty());
|
||||
assertTrue("List is empty", list2.size() == 1);
|
||||
assertEquals("List is empty", 1, list2.size());
|
||||
assertTrue("List is empty", list3.isEmpty());
|
||||
}
|
||||
|
||||
|
@ -177,12 +176,12 @@ public class LazyIteratorChainTest extends AbstractIteratorTest<String> {
|
|||
assertEquals("B", chain.next());
|
||||
assertTrue("should have next", chain.hasNext());
|
||||
assertEquals("C", chain.next());
|
||||
assertTrue("should not have next", !chain.hasNext());
|
||||
assertFalse("should not have next", chain.hasNext());
|
||||
}
|
||||
|
||||
public void testEmptyChain() {
|
||||
final LazyIteratorChain<String> chain = makeEmptyIterator();
|
||||
assertEquals(false, chain.hasNext());
|
||||
assertFalse(chain.hasNext());
|
||||
try {
|
||||
chain.next();
|
||||
fail();
|
||||
|
|
|
@ -70,13 +70,12 @@ public class ListIteratorWrapper2Test<E> extends AbstractIteratorTest<E> {
|
|||
assertEquals("Iteration value is correct", testValue, iterValue);
|
||||
}
|
||||
|
||||
assertTrue("Iterator should now be empty", !iter.hasNext());
|
||||
assertFalse("Iterator should now be empty", iter.hasNext());
|
||||
|
||||
try {
|
||||
iter.next();
|
||||
} catch (final Exception e) {
|
||||
assertTrue("NoSuchElementException must be thrown",
|
||||
e.getClass().equals(new NoSuchElementException().getClass()));
|
||||
assertEquals("NoSuchElementException must be thrown", e.getClass(), new NoSuchElementException().getClass());
|
||||
}
|
||||
|
||||
// now, read it backwards
|
||||
|
@ -90,8 +89,7 @@ public class ListIteratorWrapper2Test<E> extends AbstractIteratorTest<E> {
|
|||
try {
|
||||
iter.previous();
|
||||
} catch (final Exception e) {
|
||||
assertTrue("NoSuchElementException must be thrown",
|
||||
e.getClass().equals(new NoSuchElementException().getClass()));
|
||||
assertEquals("NoSuchElementException must be thrown", e.getClass(), new NoSuchElementException().getClass());
|
||||
}
|
||||
|
||||
// now, read it forwards again
|
||||
|
|
|
@ -71,13 +71,12 @@ public class ListIteratorWrapperTest<E> extends AbstractIteratorTest<E> {
|
|||
assertEquals("Iteration value is correct", testValue, iterValue);
|
||||
}
|
||||
|
||||
assertTrue("Iterator should now be empty", !iter.hasNext());
|
||||
assertFalse("Iterator should now be empty", iter.hasNext());
|
||||
|
||||
try {
|
||||
iter.next();
|
||||
} catch (final Exception e) {
|
||||
assertTrue("NoSuchElementException must be thrown",
|
||||
e.getClass().equals(new NoSuchElementException().getClass()));
|
||||
assertEquals("NoSuchElementException must be thrown", e.getClass(), new NoSuchElementException().getClass());
|
||||
}
|
||||
|
||||
// now, read it backwards
|
||||
|
@ -91,8 +90,7 @@ public class ListIteratorWrapperTest<E> extends AbstractIteratorTest<E> {
|
|||
try {
|
||||
iter.previous();
|
||||
} catch (final Exception e) {
|
||||
assertTrue("NoSuchElementException must be thrown",
|
||||
e.getClass().equals(new NoSuchElementException().getClass()));
|
||||
assertEquals("NoSuchElementException must be thrown", e.getClass(), new NoSuchElementException().getClass());
|
||||
}
|
||||
|
||||
// now, read it forwards again
|
||||
|
|
|
@ -51,7 +51,7 @@ public class LoopingIteratorTest {
|
|||
public void testLooping0() throws Exception {
|
||||
final List<Object> list = new ArrayList<>();
|
||||
final LoopingIterator<Object> loop = new LoopingIterator<>(list);
|
||||
assertTrue(!loop.hasNext(), "hasNext should return false");
|
||||
assertFalse(loop.hasNext(), "hasNext should return false");
|
||||
|
||||
try {
|
||||
loop.next();
|
||||
|
|
|
@ -73,14 +73,12 @@ public class ObjectArrayIteratorTest<E> extends AbstractIteratorTest<E> {
|
|||
assertEquals("Iteration value is correct", testValue, iterValue);
|
||||
}
|
||||
|
||||
assertTrue("Iterator should now be empty", !iter.hasNext());
|
||||
assertFalse("Iterator should now be empty", iter.hasNext());
|
||||
|
||||
try {
|
||||
iter.next();
|
||||
} catch (final Exception e) {
|
||||
assertTrue(
|
||||
"NoSuchElementException must be thrown",
|
||||
e.getClass().equals(new NoSuchElementException().getClass()));
|
||||
assertEquals("NoSuchElementException must be thrown", e.getClass(), new NoSuchElementException().getClass());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,10 +16,11 @@
|
|||
*/
|
||||
package org.apache.commons.collections4.iterators;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ListIterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
|
||||
/**
|
||||
* Tests the ObjectArrayListIterator class.
|
||||
*
|
||||
|
@ -68,14 +69,12 @@ public class ObjectArrayListIteratorTest<E> extends ObjectArrayIteratorTest<E> {
|
|||
assertEquals("Iteration value is correct", testValue, iterValue);
|
||||
}
|
||||
|
||||
assertTrue("Iterator should now be empty", !iter.hasPrevious());
|
||||
assertFalse("Iterator should now be empty", iter.hasPrevious());
|
||||
|
||||
try {
|
||||
iter.previous();
|
||||
} catch (final Exception e) {
|
||||
assertTrue(
|
||||
"NoSuchElementException must be thrown",
|
||||
e.getClass().equals(new NoSuchElementException().getClass()));
|
||||
assertEquals("NoSuchElementException must be thrown", e.getClass(), new NoSuchElementException().getClass());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -98,7 +97,7 @@ public class ObjectArrayListIteratorTest<E> extends ObjectArrayIteratorTest<E> {
|
|||
x++;
|
||||
}
|
||||
|
||||
assertTrue("The two arrays should have the same value, i.e. {0,1,2}", Arrays.equals(testData, result));
|
||||
assertArrayEquals("The two arrays should have the same value, i.e. {0,1,2}", testData, result);
|
||||
|
||||
// a call to set() before a call to next() or previous() should throw an IllegalStateException
|
||||
iter = makeArrayListIterator((E[]) testArray);
|
||||
|
|
|
@ -72,7 +72,7 @@ public class ObjectGraphIteratorTest extends AbstractIteratorTest<Object> {
|
|||
public void testIteratorConstructor_null1() {
|
||||
final Iterator<Object> it = new ObjectGraphIterator<>(null);
|
||||
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
try {
|
||||
it.next();
|
||||
fail();
|
||||
|
@ -107,7 +107,7 @@ public class ObjectGraphIteratorTest extends AbstractIteratorTest<Object> {
|
|||
final List<Iterator<Object>> iteratorList = new ArrayList<>();
|
||||
final Iterator<Object> it = new ObjectGraphIterator<>(iteratorList.iterator());
|
||||
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
try {
|
||||
it.next();
|
||||
fail();
|
||||
|
@ -128,10 +128,10 @@ public class ObjectGraphIteratorTest extends AbstractIteratorTest<Object> {
|
|||
final Iterator<Object> it = new ObjectGraphIterator<>(iteratorList.iterator());
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertEquals(testArray[i], it.next());
|
||||
}
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
try {
|
||||
it.next();
|
||||
fail();
|
||||
|
@ -168,10 +168,10 @@ public class ObjectGraphIteratorTest extends AbstractIteratorTest<Object> {
|
|||
final Iterator<Object> it = new ObjectGraphIterator<>(iteratorList.iterator());
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertEquals(testArray[i], it.next());
|
||||
}
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
try {
|
||||
it.next();
|
||||
fail();
|
||||
|
@ -190,7 +190,7 @@ public class ObjectGraphIteratorTest extends AbstractIteratorTest<Object> {
|
|||
assertEquals(testArray[i], it.next());
|
||||
it.remove();
|
||||
}
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
assertEquals(0, list1.size());
|
||||
assertEquals(0, list2.size());
|
||||
assertEquals(0, list3.size());
|
||||
|
@ -204,10 +204,10 @@ public class ObjectGraphIteratorTest extends AbstractIteratorTest<Object> {
|
|||
final Iterator<Object> it = new ObjectGraphIterator<>(iteratorList.iterator(), null);
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertEquals(testArray[i], it.next());
|
||||
}
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
}
|
||||
|
||||
public void testIteration_IteratorOfIteratorsWithEmptyIterators() {
|
||||
|
@ -222,16 +222,16 @@ public class ObjectGraphIteratorTest extends AbstractIteratorTest<Object> {
|
|||
final Iterator<Object> it = new ObjectGraphIterator<>(iteratorList.iterator(), null);
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertEquals(testArray[i], it.next());
|
||||
}
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
}
|
||||
|
||||
public void testIteration_RootNull() {
|
||||
final Iterator<Object> it = new ObjectGraphIterator<>(null, null);
|
||||
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
try {
|
||||
it.next();
|
||||
fail();
|
||||
|
@ -248,9 +248,9 @@ public class ObjectGraphIteratorTest extends AbstractIteratorTest<Object> {
|
|||
final Forest forest = new Forest();
|
||||
final Iterator<Object> it = new ObjectGraphIterator<>(forest, null);
|
||||
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertSame(forest, it.next());
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
try {
|
||||
it.next();
|
||||
fail();
|
||||
|
@ -263,9 +263,9 @@ public class ObjectGraphIteratorTest extends AbstractIteratorTest<Object> {
|
|||
final Leaf l1 = forest.addTree().addBranch().addLeaf();
|
||||
final Iterator<Object> it = new ObjectGraphIterator<>(forest, new LeafFinder());
|
||||
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertSame(l1, it.next());
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
try {
|
||||
it.next();
|
||||
fail();
|
||||
|
@ -291,17 +291,17 @@ public class ObjectGraphIteratorTest extends AbstractIteratorTest<Object> {
|
|||
|
||||
final Iterator<Object> it = new ObjectGraphIterator<>(forest, new LeafFinder());
|
||||
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertSame(l1, it.next());
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertSame(l2, it.next());
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertSame(l3, it.next());
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertSame(l4, it.next());
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertSame(l5, it.next());
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
try {
|
||||
it.next();
|
||||
fail();
|
||||
|
@ -327,17 +327,17 @@ public class ObjectGraphIteratorTest extends AbstractIteratorTest<Object> {
|
|||
|
||||
final Iterator<Object> it = new ObjectGraphIterator<>(forest, new LeafFinder());
|
||||
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertSame(l1, it.next());
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertSame(l2, it.next());
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertSame(l3, it.next());
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertSame(l4, it.next());
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertSame(l5, it.next());
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
try {
|
||||
it.next();
|
||||
fail();
|
||||
|
|
|
@ -53,9 +53,9 @@ public class ReverseListIteratorTest<E> extends AbstractListIteratorTest<E> {
|
|||
public void testEmptyListIteratorIsIndeedEmpty() {
|
||||
final ListIterator<E> it = makeEmptyIterator();
|
||||
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
assertEquals(-1, it.nextIndex()); // reversed index
|
||||
assertEquals(false, it.hasPrevious());
|
||||
assertFalse(it.hasPrevious());
|
||||
assertEquals(0, it.previousIndex()); // reversed index
|
||||
|
||||
// next() should throw a NoSuchElementException
|
||||
|
@ -82,8 +82,8 @@ public class ReverseListIteratorTest<E> extends AbstractListIteratorTest<E> {
|
|||
}
|
||||
|
||||
// check state at end
|
||||
assertEquals(false, it.hasNext());
|
||||
assertEquals(true, it.hasPrevious());
|
||||
assertFalse(it.hasNext());
|
||||
assertTrue(it.hasPrevious());
|
||||
|
||||
// this had to be commented out, as there is a bug in the JDK before JDK1.5
|
||||
// where calling previous at the start of an iterator would push the cursor
|
||||
|
@ -104,8 +104,8 @@ public class ReverseListIteratorTest<E> extends AbstractListIteratorTest<E> {
|
|||
}
|
||||
|
||||
// check state at start
|
||||
assertEquals(true, it.hasNext());
|
||||
assertEquals(false, it.hasPrevious());
|
||||
assertTrue(it.hasNext());
|
||||
assertFalse(it.hasPrevious());
|
||||
try {
|
||||
it.previous();
|
||||
fail("NoSuchElementException must be thrown from previous at start of ListIterator");
|
||||
|
@ -115,29 +115,29 @@ public class ReverseListIteratorTest<E> extends AbstractListIteratorTest<E> {
|
|||
|
||||
public void testReverse() {
|
||||
final ListIterator<E> it = makeObject();
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertEquals(3, it.nextIndex());
|
||||
assertEquals(false, it.hasPrevious());
|
||||
assertFalse(it.hasPrevious());
|
||||
assertEquals(4, it.previousIndex());
|
||||
assertEquals("Four", it.next());
|
||||
assertEquals(2, it.nextIndex());
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertEquals(3, it.previousIndex());
|
||||
assertEquals(true, it.hasPrevious());
|
||||
assertTrue(it.hasPrevious());
|
||||
assertEquals("Three", it.next());
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertEquals(1, it.nextIndex());
|
||||
assertEquals(true, it.hasPrevious());
|
||||
assertTrue(it.hasPrevious());
|
||||
assertEquals(2, it.previousIndex());
|
||||
assertEquals("Two", it.next());
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertEquals(0, it.nextIndex());
|
||||
assertEquals(true, it.hasPrevious());
|
||||
assertTrue(it.hasPrevious());
|
||||
assertEquals(1, it.previousIndex());
|
||||
assertEquals("One", it.next());
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
assertEquals(-1, it.nextIndex());
|
||||
assertEquals(true, it.hasPrevious());
|
||||
assertTrue(it.hasPrevious());
|
||||
assertEquals(0, it.previousIndex());
|
||||
assertEquals("One", it.previous());
|
||||
assertEquals("Two", it.previous());
|
||||
|
|
|
@ -67,34 +67,32 @@ public class SingletonIterator2Test<E> extends AbstractIteratorTest<E> {
|
|||
final E iterValue = iter.next();
|
||||
assertEquals("Iteration value is correct", testValue, iterValue);
|
||||
|
||||
assertTrue("Iterator should now be empty", !iter.hasNext());
|
||||
assertFalse("Iterator should now be empty", iter.hasNext());
|
||||
|
||||
try {
|
||||
iter.next();
|
||||
} catch (final Exception e) {
|
||||
assertTrue(
|
||||
"NoSuchElementException must be thrown",
|
||||
e.getClass().equals(new NoSuchElementException().getClass()));
|
||||
assertEquals("NoSuchElementException must be thrown", e.getClass(), new NoSuchElementException().getClass());
|
||||
}
|
||||
}
|
||||
|
||||
public void testReset() {
|
||||
final ResettableIterator<E> it = makeObject();
|
||||
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertEquals(testValue, it.next());
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
|
||||
it.reset();
|
||||
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertEquals(testValue, it.next());
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
|
||||
it.reset();
|
||||
it.reset();
|
||||
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -70,14 +70,12 @@ public class SingletonIteratorTest<E> extends AbstractIteratorTest<E> {
|
|||
final E iterValue = iter.next();
|
||||
assertEquals("Iteration value is correct", testValue, iterValue);
|
||||
|
||||
assertTrue("Iterator should now be empty", !iter.hasNext());
|
||||
assertFalse("Iterator should now be empty", iter.hasNext());
|
||||
|
||||
try {
|
||||
iter.next();
|
||||
} catch (final Exception e) {
|
||||
assertTrue(
|
||||
"NoSuchElementException must be thrown",
|
||||
e.getClass().equals(new NoSuchElementException().getClass()));
|
||||
assertEquals("NoSuchElementException must be thrown", e.getClass(), new NoSuchElementException().getClass());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,26 +86,26 @@ public class SingletonIteratorTest<E> extends AbstractIteratorTest<E> {
|
|||
assertEquals("xyzzy", iter.next());
|
||||
iter.remove();
|
||||
iter.reset();
|
||||
assertTrue(! iter.hasNext());
|
||||
assertFalse(iter.hasNext());
|
||||
}
|
||||
|
||||
public void testReset() {
|
||||
final ResettableIterator<E> it = makeObject();
|
||||
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertEquals(testValue, it.next());
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
|
||||
it.reset();
|
||||
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertEquals(testValue, it.next());
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
|
||||
it.reset();
|
||||
it.reset();
|
||||
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -70,14 +70,14 @@ public class SingletonListIteratorTest<E> extends AbstractListIteratorTest<E> {
|
|||
public void testIterator() {
|
||||
final ListIterator<E> iter = makeObject();
|
||||
assertTrue( "Iterator should have next item", iter.hasNext() );
|
||||
assertTrue( "Iterator should have no previous item", !iter.hasPrevious() );
|
||||
assertFalse("Iterator should have no previous item", iter.hasPrevious());
|
||||
assertEquals( "Iteration next index", 0, iter.nextIndex() );
|
||||
assertEquals( "Iteration previous index", -1, iter.previousIndex() );
|
||||
|
||||
Object iterValue = iter.next();
|
||||
assertEquals( "Iteration value is correct", testValue, iterValue );
|
||||
|
||||
assertTrue( "Iterator should have no next item", !iter.hasNext() );
|
||||
assertFalse("Iterator should have no next item", iter.hasNext());
|
||||
assertTrue( "Iterator should have previous item", iter.hasPrevious() );
|
||||
assertEquals( "Iteration next index", 1, iter.nextIndex() );
|
||||
assertEquals( "Iteration previous index", 0, iter.previousIndex() );
|
||||
|
@ -86,14 +86,14 @@ public class SingletonListIteratorTest<E> extends AbstractListIteratorTest<E> {
|
|||
assertEquals( "Iteration value is correct", testValue, iterValue );
|
||||
|
||||
assertTrue( "Iterator should have next item", iter.hasNext() );
|
||||
assertTrue( "Iterator should have no previous item", !iter.hasPrevious() );
|
||||
assertFalse("Iterator should have no previous item", iter.hasPrevious());
|
||||
assertEquals( "Iteration next index", 0, iter.nextIndex() );
|
||||
assertEquals( "Iteration previous index", -1, iter.previousIndex() );
|
||||
|
||||
iterValue = iter.next();
|
||||
assertEquals( "Iteration value is correct", testValue, iterValue );
|
||||
|
||||
assertTrue( "Iterator should have no next item", !iter.hasNext() );
|
||||
assertFalse("Iterator should have no next item", iter.hasNext());
|
||||
assertTrue( "Iterator should have previous item", iter.hasPrevious() );
|
||||
assertEquals( "Iteration next index", 1, iter.nextIndex() );
|
||||
assertEquals( "Iteration previous index", 0, iter.previousIndex() );
|
||||
|
@ -101,39 +101,37 @@ public class SingletonListIteratorTest<E> extends AbstractListIteratorTest<E> {
|
|||
try {
|
||||
iter.next();
|
||||
} catch (final Exception e) {
|
||||
assertTrue("NoSuchElementException must be thrown",
|
||||
e.getClass().equals(new NoSuchElementException().getClass()));
|
||||
assertEquals("NoSuchElementException must be thrown", e.getClass(), new NoSuchElementException().getClass());
|
||||
}
|
||||
iter.previous();
|
||||
try {
|
||||
iter.previous();
|
||||
} catch (final Exception e) {
|
||||
assertTrue("NoSuchElementException must be thrown",
|
||||
e.getClass().equals(new NoSuchElementException().getClass()));
|
||||
assertEquals("NoSuchElementException must be thrown", e.getClass(), new NoSuchElementException().getClass());
|
||||
}
|
||||
}
|
||||
|
||||
public void testReset() {
|
||||
final ResettableListIterator<E> it = makeObject();
|
||||
|
||||
assertEquals(true, it.hasNext());
|
||||
assertEquals(false, it.hasPrevious());
|
||||
assertTrue(it.hasNext());
|
||||
assertFalse(it.hasPrevious());
|
||||
assertEquals(testValue, it.next());
|
||||
assertEquals(false, it.hasNext());
|
||||
assertEquals(true, it.hasPrevious());
|
||||
assertFalse(it.hasNext());
|
||||
assertTrue(it.hasPrevious());
|
||||
|
||||
it.reset();
|
||||
|
||||
assertEquals(true, it.hasNext());
|
||||
assertEquals(false, it.hasPrevious());
|
||||
assertTrue(it.hasNext());
|
||||
assertFalse(it.hasPrevious());
|
||||
assertEquals(testValue, it.next());
|
||||
assertEquals(false, it.hasNext());
|
||||
assertEquals(true, it.hasPrevious());
|
||||
assertFalse(it.hasNext());
|
||||
assertTrue(it.hasPrevious());
|
||||
|
||||
it.reset();
|
||||
it.reset();
|
||||
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -73,13 +73,12 @@ public class UniqueFilterIteratorTest<E> extends AbstractIteratorTest<E> {
|
|||
assertEquals( "Iteration value is correct", testValue, iterValue );
|
||||
}
|
||||
|
||||
assertTrue("Iterator should now be empty", ! iter.hasNext() );
|
||||
assertFalse("Iterator should now be empty", iter.hasNext());
|
||||
|
||||
try {
|
||||
iter.next();
|
||||
} catch (final Exception e) {
|
||||
assertTrue("NoSuchElementException must be thrown",
|
||||
e.getClass().equals(new NoSuchElementException().getClass()));
|
||||
assertEquals("NoSuchElementException must be thrown", e.getClass(), new NoSuchElementException().getClass());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ public class UnmodifiableIteratorTest<E> extends AbstractIteratorTest<E> {
|
|||
assertSame(it, UnmodifiableIterator.unmodifiableIterator(it));
|
||||
|
||||
it = testList.iterator();
|
||||
assertTrue(it != UnmodifiableIterator.unmodifiableIterator(it));
|
||||
assertNotSame(it, UnmodifiableIterator.unmodifiableIterator(it));
|
||||
|
||||
try {
|
||||
UnmodifiableIterator.unmodifiableIterator(null);
|
||||
|
|
|
@ -83,7 +83,7 @@ public class UnmodifiableMapIteratorTest<K, V> extends AbstractMapIteratorTest<K
|
|||
assertSame(it, UnmodifiableMapIterator.unmodifiableMapIterator(it));
|
||||
|
||||
it = getMap().mapIterator();
|
||||
assertTrue(it != UnmodifiableMapIterator.unmodifiableMapIterator(it));
|
||||
assertNotSame(it, UnmodifiableMapIterator.unmodifiableMapIterator(it));
|
||||
|
||||
try {
|
||||
UnmodifiableMapIterator.unmodifiableMapIterator(null);
|
||||
|
|
|
@ -85,7 +85,7 @@ public class UnmodifiableOrderedMapIteratorTest<K, V> extends AbstractOrderedMap
|
|||
assertSame(it, UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(it));
|
||||
|
||||
it = getMap().mapIterator();
|
||||
assertTrue(it != UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(it));
|
||||
assertNotSame(it, UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(it));
|
||||
|
||||
try {
|
||||
UnmodifiableOrderedMapIterator.unmodifiableOrderedMapIterator(null);
|
||||
|
|
|
@ -84,7 +84,7 @@ public class ZippingIteratorTest extends AbstractIteratorTest<Integer> {
|
|||
assertTrue(iter.hasNext());
|
||||
assertEquals(even, iter.next());
|
||||
}
|
||||
assertTrue(!iter.hasNext());
|
||||
assertFalse(iter.hasNext());
|
||||
}
|
||||
|
||||
public void testIterateEvenOdd() {
|
||||
|
@ -93,7 +93,7 @@ public class ZippingIteratorTest extends AbstractIteratorTest<Integer> {
|
|||
assertTrue(iter.hasNext());
|
||||
assertEquals(Integer.valueOf(i), iter.next());
|
||||
}
|
||||
assertTrue(!iter.hasNext());
|
||||
assertFalse(iter.hasNext());
|
||||
}
|
||||
|
||||
public void testIterateOddEven() {
|
||||
|
@ -108,7 +108,7 @@ public class ZippingIteratorTest extends AbstractIteratorTest<Integer> {
|
|||
j++;
|
||||
}
|
||||
}
|
||||
assertTrue(!iter.hasNext());
|
||||
assertFalse(iter.hasNext());
|
||||
}
|
||||
|
||||
public void testIterateEvenEven() {
|
||||
|
@ -119,7 +119,7 @@ public class ZippingIteratorTest extends AbstractIteratorTest<Integer> {
|
|||
assertTrue(iter.hasNext());
|
||||
assertEquals(even, iter.next());
|
||||
}
|
||||
assertTrue(!iter.hasNext());
|
||||
assertFalse(iter.hasNext());
|
||||
}
|
||||
|
||||
public void testIterateFibEvenOdd() {
|
||||
|
@ -154,7 +154,7 @@ public class ZippingIteratorTest extends AbstractIteratorTest<Integer> {
|
|||
assertEquals(Integer.valueOf(18), iter.next()); // even 18
|
||||
assertEquals(Integer.valueOf(19), iter.next()); // odd 19
|
||||
|
||||
assertTrue(!iter.hasNext());
|
||||
assertFalse(iter.hasNext());
|
||||
}
|
||||
|
||||
public void testRemoveFromSingle() {
|
||||
|
|
|
@ -74,17 +74,17 @@ public abstract class AbstractMapEntryTest<K, V> {
|
|||
public void testAccessorsAndMutators() {
|
||||
Map.Entry<K, V> entry = makeMapEntry((K) key, (V) value);
|
||||
|
||||
assertTrue(entry.getKey() == key);
|
||||
assertSame(key, entry.getKey());
|
||||
|
||||
entry.setValue((V) value);
|
||||
assertTrue(entry.getValue() == value);
|
||||
assertSame(value, entry.getValue());
|
||||
|
||||
// check that null doesn't do anything funny
|
||||
entry = makeMapEntry(null, null);
|
||||
assertTrue(entry.getKey() == null);
|
||||
assertNull(entry.getKey());
|
||||
|
||||
entry.setValue(null);
|
||||
assertTrue(entry.getValue() == null);
|
||||
assertNull(entry.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -127,30 +127,30 @@ public abstract class AbstractMapEntryTest<K, V> {
|
|||
Map.Entry<K, V> e1 = makeMapEntry((K) key, (V) value);
|
||||
Map.Entry<K, V> e2 = makeKnownMapEntry((K) key, (V) value);
|
||||
|
||||
assertTrue(e1.equals(e1));
|
||||
assertTrue(e2.equals(e1));
|
||||
assertTrue(e1.equals(e2));
|
||||
assertTrue(e1.hashCode() == e2.hashCode());
|
||||
assertEquals(e1, e1);
|
||||
assertEquals(e2, e1);
|
||||
assertEquals(e1, e2);
|
||||
assertEquals(e1.hashCode(), e2.hashCode());
|
||||
|
||||
// 2. test with nulls
|
||||
e1 = makeMapEntry();
|
||||
e2 = makeKnownMapEntry();
|
||||
|
||||
assertTrue(e1.equals(e1));
|
||||
assertTrue(e2.equals(e1));
|
||||
assertTrue(e1.equals(e2));
|
||||
assertTrue(e1.hashCode() == e2.hashCode());
|
||||
assertEquals(e1, e1);
|
||||
assertEquals(e2, e1);
|
||||
assertEquals(e1, e2);
|
||||
assertEquals(e1.hashCode(), e2.hashCode());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testToString() {
|
||||
Map.Entry<K, V> entry = makeMapEntry((K) key, (V) value);
|
||||
assertTrue(entry.toString().equals(entry.getKey() + "=" + entry.getValue()));
|
||||
assertEquals(entry.toString(), entry.getKey() + "=" + entry.getValue());
|
||||
|
||||
// test with nulls
|
||||
entry = makeMapEntry();
|
||||
assertTrue(entry.toString().equals(entry.getKey() + "=" + entry.getValue()));
|
||||
assertEquals(entry.toString(), entry.getKey() + "=" + entry.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,17 +57,17 @@ public class DefaultKeyValueTest<K, V> {
|
|||
final DefaultKeyValue<K, V> kv = makeDefaultKeyValue();
|
||||
|
||||
kv.setKey((K) key);
|
||||
assertTrue(kv.getKey() == key);
|
||||
assertSame(key, kv.getKey());
|
||||
|
||||
kv.setValue((V) value);
|
||||
assertTrue(kv.getValue() == value);
|
||||
assertSame(value, kv.getValue());
|
||||
|
||||
// check that null doesn't do anything funny
|
||||
kv.setKey(null);
|
||||
assertTrue(kv.getKey() == null);
|
||||
assertNull(kv.getKey());
|
||||
|
||||
kv.setValue(null);
|
||||
assertTrue(kv.getValue() == null);
|
||||
assertNull(kv.getValue());
|
||||
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ public class DefaultKeyValueTest<K, V> {
|
|||
|
||||
// test that the KVP is independent of the Map.Entry
|
||||
entry.setValue(null);
|
||||
assertTrue(kv.getValue() == value);
|
||||
assertSame(value, kv.getValue());
|
||||
|
||||
}
|
||||
|
||||
|
@ -146,28 +146,28 @@ public class DefaultKeyValueTest<K, V> {
|
|||
DefaultKeyValue<K, V> kv = makeDefaultKeyValue((K) key, (V) value);
|
||||
DefaultKeyValue<K, V> kv2 = makeDefaultKeyValue((K) key, (V) value);
|
||||
|
||||
assertTrue(kv.equals(kv));
|
||||
assertTrue(kv.equals(kv2));
|
||||
assertTrue(kv.hashCode() == kv2.hashCode());
|
||||
assertEquals(kv, kv);
|
||||
assertEquals(kv, kv2);
|
||||
assertEquals(kv.hashCode(), kv2.hashCode());
|
||||
|
||||
// 2. test with nulls
|
||||
kv = makeDefaultKeyValue(null, null);
|
||||
kv2 = makeDefaultKeyValue(null, null);
|
||||
|
||||
assertTrue(kv.equals(kv));
|
||||
assertTrue(kv.equals(kv2));
|
||||
assertTrue(kv.hashCode() == kv2.hashCode());
|
||||
assertEquals(kv, kv);
|
||||
assertEquals(kv, kv2);
|
||||
assertEquals(kv.hashCode(), kv2.hashCode());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testToString() {
|
||||
DefaultKeyValue<K, V> kv = makeDefaultKeyValue((K) key, (V) value);
|
||||
assertTrue(kv.toString().equals(kv.getKey() + "=" + kv.getValue()));
|
||||
assertEquals(kv.toString(), kv.getKey() + "=" + kv.getValue());
|
||||
|
||||
// test with nulls
|
||||
kv = makeDefaultKeyValue(null, null);
|
||||
assertTrue(kv.toString().equals(kv.getKey() + "=" + kv.getValue()));
|
||||
assertEquals(kv.toString(), kv.getKey() + "=" + kv.getValue());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -179,8 +179,8 @@ public class DefaultKeyValueTest<K, V> {
|
|||
map.put(kv.getKey(), kv.getValue());
|
||||
final Map.Entry<K, V> entry = map.entrySet().iterator().next();
|
||||
|
||||
assertTrue(entry.equals(kv.toMapEntry()));
|
||||
assertTrue(entry.hashCode() == kv.hashCode());
|
||||
assertEquals(entry, kv.toMapEntry());
|
||||
assertEquals(entry.hashCode(), kv.hashCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.io.IOException;
|
|||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -90,19 +89,19 @@ public class MultiKeyTest {
|
|||
public void testConstructors() throws Exception {
|
||||
MultiKey<Integer> mk;
|
||||
mk = new MultiKey<>(ONE, TWO);
|
||||
assertTrue(Arrays.equals(new Object[] { ONE, TWO }, mk.getKeys()));
|
||||
assertArrayEquals(new Object[]{ONE, TWO}, mk.getKeys());
|
||||
|
||||
mk = new MultiKey<>(ONE, TWO, THREE);
|
||||
assertTrue(Arrays.equals(new Object[] { ONE, TWO, THREE }, mk.getKeys()));
|
||||
assertArrayEquals(new Object[]{ONE, TWO, THREE}, mk.getKeys());
|
||||
|
||||
mk = new MultiKey<>(ONE, TWO, THREE, FOUR);
|
||||
assertTrue(Arrays.equals(new Object[] { ONE, TWO, THREE, FOUR }, mk.getKeys()));
|
||||
assertArrayEquals(new Object[]{ONE, TWO, THREE, FOUR}, mk.getKeys());
|
||||
|
||||
mk = new MultiKey<>(ONE, TWO, THREE, FOUR, FIVE);
|
||||
assertTrue(Arrays.equals(new Object[] { ONE, TWO, THREE, FOUR, FIVE }, mk.getKeys()));
|
||||
assertArrayEquals(new Object[]{ONE, TWO, THREE, FOUR, FIVE}, mk.getKeys());
|
||||
|
||||
mk = new MultiKey<>(new Integer[] { THREE, FOUR, ONE, TWO }, false);
|
||||
assertTrue(Arrays.equals(new Object[] { THREE, FOUR, ONE, TWO }, mk.getKeys()));
|
||||
assertArrayEquals(new Object[]{THREE, FOUR, ONE, TWO}, mk.getKeys());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -110,27 +109,27 @@ public class MultiKeyTest {
|
|||
MultiKey<Integer> mk;
|
||||
Integer[] keys = new Integer[] { THREE, FOUR, ONE, TWO };
|
||||
mk = new MultiKey<>(keys);
|
||||
assertTrue(Arrays.equals(new Object[] { THREE, FOUR, ONE, TWO }, mk.getKeys()));
|
||||
assertArrayEquals(new Object[]{THREE, FOUR, ONE, TWO}, mk.getKeys());
|
||||
keys[3] = FIVE; // no effect
|
||||
assertTrue(Arrays.equals(new Object[] { THREE, FOUR, ONE, TWO }, mk.getKeys()));
|
||||
assertArrayEquals(new Object[]{THREE, FOUR, ONE, TWO}, mk.getKeys());
|
||||
|
||||
keys = new Integer[] {};
|
||||
mk = new MultiKey<>(keys);
|
||||
assertTrue(Arrays.equals(new Object[] {}, mk.getKeys()));
|
||||
assertArrayEquals(new Object[]{}, mk.getKeys());
|
||||
|
||||
keys = new Integer[] { THREE, FOUR, ONE, TWO };
|
||||
mk = new MultiKey<>(keys, true);
|
||||
assertTrue(Arrays.equals(new Object[] { THREE, FOUR, ONE, TWO }, mk.getKeys()));
|
||||
assertArrayEquals(new Object[]{THREE, FOUR, ONE, TWO}, mk.getKeys());
|
||||
keys[3] = FIVE; // no effect
|
||||
assertTrue(Arrays.equals(new Object[] { THREE, FOUR, ONE, TWO }, mk.getKeys()));
|
||||
assertArrayEquals(new Object[]{THREE, FOUR, ONE, TWO}, mk.getKeys());
|
||||
|
||||
keys = new Integer[] { THREE, FOUR, ONE, TWO };
|
||||
mk = new MultiKey<>(keys, false);
|
||||
assertTrue(Arrays.equals(new Object[] { THREE, FOUR, ONE, TWO }, mk.getKeys()));
|
||||
assertArrayEquals(new Object[]{THREE, FOUR, ONE, TWO}, mk.getKeys());
|
||||
// change key - don't do this!
|
||||
// the hashcode of the MultiKey is now broken
|
||||
keys[3] = FIVE;
|
||||
assertTrue(Arrays.equals(new Object[] { THREE, FOUR, ONE, FIVE }, mk.getKeys()));
|
||||
assertArrayEquals(new Object[]{THREE, FOUR, ONE, FIVE}, mk.getKeys());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -158,9 +157,9 @@ public class MultiKeyTest {
|
|||
|
||||
assertEquals(mk1, mk1);
|
||||
assertEquals(mk1, mk2);
|
||||
assertFalse(mk1.equals(mk3));
|
||||
assertFalse(mk1.equals(""));
|
||||
assertFalse(mk1.equals(null));
|
||||
assertNotEquals(mk1, mk3);
|
||||
assertNotEquals("", mk1);
|
||||
assertNotEquals(null, mk1);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -229,8 +228,8 @@ public class MultiKeyTest {
|
|||
final Integer[] keys = new Integer[] { ONE, TWO };
|
||||
final MultiKey<Integer> mk = new MultiKey<>(keys, true);
|
||||
final Object[] array = mk.getKeys();
|
||||
assertTrue(array != keys);
|
||||
assertTrue(Arrays.equals(array, keys));
|
||||
assertNotSame(array, keys);
|
||||
assertArrayEquals(array, keys);
|
||||
assertSame(ONE, array[0]);
|
||||
assertSame(TWO, array[1]);
|
||||
assertEquals(2, array.length);
|
||||
|
@ -241,8 +240,8 @@ public class MultiKeyTest {
|
|||
final Integer[] keys = new Integer[] { ONE, TWO };
|
||||
final MultiKey<Integer> mk = new MultiKey<>(keys, false);
|
||||
final Object[] array = mk.getKeys();
|
||||
assertTrue(array != keys); // still not equal
|
||||
assertTrue(Arrays.equals(array, keys));
|
||||
assertNotSame(array, keys); // still not equal
|
||||
assertArrayEquals(array, keys);
|
||||
assertSame(ONE, array[0]);
|
||||
assertSame(TWO, array[1]);
|
||||
assertEquals(2, array.length);
|
||||
|
@ -263,8 +262,8 @@ public class MultiKeyTest {
|
|||
final MultiKey<Integer> mk2 = new MultiKey<>(ONE, TWO);
|
||||
final MultiKey<Object> mk3 = new MultiKey<>(ONE, "TWO");
|
||||
|
||||
assertTrue(mk1.hashCode() == mk1.hashCode());
|
||||
assertTrue(mk1.hashCode() == mk2.hashCode());
|
||||
assertEquals(mk1.hashCode(), mk1.hashCode());
|
||||
assertEquals(mk1.hashCode(), mk2.hashCode());
|
||||
assertTrue(mk1.hashCode() != mk3.hashCode());
|
||||
|
||||
final int total = (0 ^ ONE.hashCode()) ^ TWO.hashCode();
|
||||
|
|
|
@ -282,32 +282,32 @@ public abstract class AbstractListTest<E> extends AbstractCollectionTest<E> {
|
|||
public void testListEquals() {
|
||||
resetEmpty();
|
||||
List<E> list = getCollection();
|
||||
assertEquals("Empty lists should be equal", true, list.equals(getConfirmed()));
|
||||
assertTrue("Empty lists should be equal", list.equals(getConfirmed()));
|
||||
verify();
|
||||
assertEquals("Empty list should equal self", true, list.equals(list));
|
||||
assertTrue("Empty list should equal self", list.equals(list));
|
||||
verify();
|
||||
|
||||
List<E> list2 = Arrays.asList(getFullElements());
|
||||
assertEquals("Empty list shouldn't equal full", false, list.equals(list2));
|
||||
assertFalse("Empty list shouldn't equal full", list.equals(list2));
|
||||
verify();
|
||||
|
||||
list2 = Arrays.asList(getOtherElements());
|
||||
assertEquals("Empty list shouldn't equal other", false, list.equals(list2));
|
||||
assertFalse("Empty list shouldn't equal other", list.equals(list2));
|
||||
verify();
|
||||
|
||||
resetFull();
|
||||
list = getCollection();
|
||||
assertEquals("Full lists should be equal", true, list.equals(getConfirmed()));
|
||||
assertTrue("Full lists should be equal", list.equals(getConfirmed()));
|
||||
verify();
|
||||
assertEquals("Full list should equal self", true, list.equals(list));
|
||||
assertTrue("Full list should equal self", list.equals(list));
|
||||
verify();
|
||||
|
||||
list2 = makeObject();
|
||||
assertEquals("Full list shouldn't equal empty", false, list.equals(list2));
|
||||
assertFalse("Full list shouldn't equal empty", list.equals(list2));
|
||||
verify();
|
||||
|
||||
list2 = Arrays.asList(getOtherElements());
|
||||
assertEquals("Full list shouldn't equal other", false, list.equals(list2));
|
||||
assertFalse("Full list shouldn't equal other", list.equals(list2));
|
||||
verify();
|
||||
|
||||
list2 = Arrays.asList(getFullElements());
|
||||
|
@ -320,15 +320,13 @@ public abstract class AbstractListTest<E> extends AbstractCollectionTest<E> {
|
|||
}
|
||||
if (list2.size() > 1) {
|
||||
Collections.reverse(list2);
|
||||
assertEquals(
|
||||
"Full list shouldn't equal full list with same elements but different order",
|
||||
false, list.equals(list2));
|
||||
assertFalse("Full list shouldn't equal full list with same elements but different order", list.equals(list2));
|
||||
verify();
|
||||
}
|
||||
|
||||
resetFull();
|
||||
list = getCollection();
|
||||
assertEquals("List shouldn't equal String", false, list.equals(""));
|
||||
assertFalse("List shouldn't equal String", list.equals(""));
|
||||
verify();
|
||||
|
||||
final List<E> listForC = Arrays.asList(getFullElements());
|
||||
|
@ -344,7 +342,7 @@ public abstract class AbstractListTest<E> extends AbstractCollectionTest<E> {
|
|||
}
|
||||
};
|
||||
|
||||
assertEquals("List shouldn't equal nonlist with same elements in same order", false, list.equals(c));
|
||||
assertFalse("List shouldn't equal nonlist with same elements in same order", list.equals(c));
|
||||
verify();
|
||||
}
|
||||
|
||||
|
@ -807,7 +805,7 @@ public abstract class AbstractListTest<E> extends AbstractCollectionTest<E> {
|
|||
final E two3 = it.next(); // do next after remove
|
||||
assertEquals(two, two3);
|
||||
assertEquals(getCollection().size() > 2, it.hasNext());
|
||||
assertEquals(true, it.hasPrevious());
|
||||
assertTrue(it.hasPrevious());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -838,7 +836,7 @@ public abstract class AbstractListTest<E> extends AbstractCollectionTest<E> {
|
|||
assertEquals(two, getCollection().get(1));
|
||||
final E zero3 = it.previous(); // do previous after remove
|
||||
assertEquals(zero, zero3);
|
||||
assertEquals(false, it.hasPrevious());
|
||||
assertFalse(it.hasPrevious());
|
||||
assertEquals(getCollection().size() > 2, it.hasNext());
|
||||
}
|
||||
|
||||
|
@ -868,7 +866,7 @@ public abstract class AbstractListTest<E> extends AbstractCollectionTest<E> {
|
|||
final E three2 = it.next(); // do next after remove
|
||||
assertEquals(three, three2);
|
||||
assertEquals(getCollection().size() > 3, it.hasNext());
|
||||
assertEquals(true, it.hasPrevious());
|
||||
assertTrue(it.hasPrevious());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -895,8 +893,8 @@ public abstract class AbstractListTest<E> extends AbstractCollectionTest<E> {
|
|||
assertEquals(one, getCollection().get(1));
|
||||
final E one2 = it.previous(); // do previous after remove
|
||||
assertEquals(one, one2);
|
||||
assertEquals(true, it.hasNext());
|
||||
assertEquals(true, it.hasPrevious());
|
||||
assertTrue(it.hasNext());
|
||||
assertTrue(it.hasPrevious());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -920,7 +918,7 @@ public abstract class AbstractListTest<E> extends AbstractCollectionTest<E> {
|
|||
i++;
|
||||
}
|
||||
|
||||
assertTrue("Iterator shouldn't have next", !iter.hasNext());
|
||||
assertFalse("Iterator shouldn't have next", iter.hasNext());
|
||||
assertEquals("nextIndex should be size", max, iter.nextIndex());
|
||||
assertEquals("previousIndex should be size - 1", max - 1, iter.previousIndex());
|
||||
|
||||
|
@ -954,7 +952,7 @@ public abstract class AbstractListTest<E> extends AbstractCollectionTest<E> {
|
|||
i--;
|
||||
}
|
||||
|
||||
assertTrue("Iterator shouldn't have previous", !iter.hasPrevious());
|
||||
assertFalse("Iterator shouldn't have previous", iter.hasPrevious());
|
||||
final int nextIndex = iter.nextIndex();
|
||||
assertEquals("nextIndex should be 0", 0, nextIndex);
|
||||
final int prevIndex = iter.previousIndex();
|
||||
|
|
|
@ -95,7 +95,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
|
||||
list.add((E) "element");
|
||||
assertEquals(1, list.size());
|
||||
assertTrue(!list.isEmpty());
|
||||
assertFalse(list.isEmpty());
|
||||
|
||||
list.clear();
|
||||
assertEquals(0, list.size());
|
||||
|
@ -104,7 +104,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
list.add((E) "element1");
|
||||
list.add((E) "element2");
|
||||
assertEquals(2, list.size());
|
||||
assertTrue(!list.isEmpty());
|
||||
assertFalse(list.isEmpty());
|
||||
|
||||
list.clear();
|
||||
assertEquals(0, list.size());
|
||||
|
@ -114,7 +114,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
list.add((E) Integer.valueOf(i));
|
||||
}
|
||||
assertEquals(1000, list.size());
|
||||
assertTrue(!list.isEmpty());
|
||||
assertFalse(list.isEmpty());
|
||||
|
||||
list.clear();
|
||||
assertEquals(0, list.size());
|
||||
|
@ -123,7 +123,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testContains() {
|
||||
assertTrue(!list.contains("A"));
|
||||
assertFalse(list.contains("A"));
|
||||
assertTrue(list.add((E) "A"));
|
||||
assertTrue(list.contains("A"));
|
||||
assertTrue(list.add((E) "B"));
|
||||
|
@ -133,7 +133,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
assertTrue(list.remove("a"));
|
||||
assertTrue(list.contains("A"));
|
||||
assertTrue(list.remove("A"));
|
||||
assertTrue(!list.contains("A"));
|
||||
assertFalse(list.contains("A"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -142,14 +142,14 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
final java.util.List<E> list2 = new java.util.LinkedList<>();
|
||||
assertTrue(list.containsAll(list2));
|
||||
list2.add((E) "A");
|
||||
assertTrue(!list.containsAll(list2));
|
||||
assertFalse(list.containsAll(list2));
|
||||
list.add((E) "B");
|
||||
list.add((E) "A");
|
||||
assertTrue(list.containsAll(list2));
|
||||
list2.add((E) "B");
|
||||
assertTrue(list.containsAll(list2));
|
||||
list2.add((E) "C");
|
||||
assertTrue(!list.containsAll(list2));
|
||||
assertFalse(list.containsAll(list2));
|
||||
list.add((E) "C");
|
||||
assertTrue(list.containsAll(list2));
|
||||
list2.add((E) "C");
|
||||
|
@ -166,13 +166,13 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
list.add((E) "5");
|
||||
final CursorableLinkedList.Cursor<E> it = list.cursor();
|
||||
assertTrue(it.hasNext());
|
||||
assertTrue(!it.hasPrevious());
|
||||
assertFalse(it.hasPrevious());
|
||||
assertEquals("1", it.next());
|
||||
assertTrue(it.hasNext());
|
||||
assertTrue(it.hasPrevious());
|
||||
assertEquals("1", it.previous());
|
||||
assertTrue(it.hasNext());
|
||||
assertTrue(!it.hasPrevious());
|
||||
assertFalse(it.hasPrevious());
|
||||
assertEquals("1", it.next());
|
||||
assertTrue(it.hasNext());
|
||||
assertTrue(it.hasPrevious());
|
||||
|
@ -192,7 +192,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
assertTrue(it.hasNext());
|
||||
assertTrue(it.hasPrevious());
|
||||
assertEquals("5", it.next());
|
||||
assertTrue(!it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
assertTrue(it.hasPrevious());
|
||||
assertEquals("5", it.previous());
|
||||
assertTrue(it.hasNext());
|
||||
|
@ -208,7 +208,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
assertTrue(it.hasPrevious());
|
||||
assertEquals("1", it.previous());
|
||||
assertTrue(it.hasNext());
|
||||
assertTrue(!it.hasPrevious());
|
||||
assertFalse(it.hasPrevious());
|
||||
it.close();
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
assertEquals("1", it.previous());
|
||||
it.remove();
|
||||
assertEquals("[3, 4, 5]", list.toString());
|
||||
assertTrue(!it.hasPrevious());
|
||||
assertFalse(it.hasPrevious());
|
||||
assertEquals("3", it.next());
|
||||
it.remove();
|
||||
assertEquals("[4, 5]", list.toString());
|
||||
|
@ -469,10 +469,10 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
|
||||
assertEquals("B", list.remove(1));
|
||||
|
||||
assertEquals(true, c1.nextIndexValid);
|
||||
assertTrue(c1.nextIndexValid);
|
||||
assertEquals(1, c1.nextIndex);
|
||||
assertEquals(true, c1.currentRemovedByAnother);
|
||||
assertEquals(null, c1.current);
|
||||
assertTrue(c1.currentRemovedByAnother);
|
||||
assertNull(c1.current);
|
||||
assertEquals("C", c1.next.value);
|
||||
|
||||
assertEquals("[A, C]", list.toString());
|
||||
|
@ -495,9 +495,9 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
|
||||
assertEquals("B", list.remove(1));
|
||||
|
||||
assertEquals(true, c1.nextIndexValid);
|
||||
assertTrue(c1.nextIndexValid);
|
||||
assertEquals(1, c1.nextIndex);
|
||||
assertEquals(false, c1.currentRemovedByAnother);
|
||||
assertFalse(c1.currentRemovedByAnother);
|
||||
assertEquals("A", c1.current.value);
|
||||
assertEquals("C", c1.next.value);
|
||||
|
||||
|
@ -522,10 +522,10 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
|
||||
assertEquals("B", list.remove(1));
|
||||
|
||||
assertEquals(true, c1.nextIndexValid);
|
||||
assertTrue(c1.nextIndexValid);
|
||||
assertEquals(1, c1.nextIndex);
|
||||
assertEquals(true, c1.currentRemovedByAnother);
|
||||
assertEquals(null, c1.current);
|
||||
assertTrue(c1.currentRemovedByAnother);
|
||||
assertNull(c1.current);
|
||||
assertEquals("C", c1.next.value);
|
||||
|
||||
assertEquals("[A, C]", list.toString());
|
||||
|
@ -551,8 +551,8 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
|
||||
assertEquals("B", list.remove(1));
|
||||
|
||||
assertEquals(false, c1.nextIndexValid);
|
||||
assertEquals(false, c1.currentRemovedByAnother);
|
||||
assertFalse(c1.nextIndexValid);
|
||||
assertFalse(c1.currentRemovedByAnother);
|
||||
assertEquals("C", c1.current.value);
|
||||
assertEquals("D", c1.next.value);
|
||||
|
||||
|
@ -578,10 +578,10 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
|
||||
c1.remove();
|
||||
|
||||
assertEquals(true, c1.nextIndexValid);
|
||||
assertTrue(c1.nextIndexValid);
|
||||
assertEquals(1, c1.nextIndex);
|
||||
assertEquals(false, c1.currentRemovedByAnother);
|
||||
assertEquals(null, c1.current);
|
||||
assertFalse(c1.currentRemovedByAnother);
|
||||
assertNull(c1.current);
|
||||
assertEquals("C", c1.next.value);
|
||||
|
||||
assertEquals("[A, C]", list.toString());
|
||||
|
@ -603,10 +603,10 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
|
||||
c1.remove();
|
||||
|
||||
assertEquals(true, c1.nextIndexValid);
|
||||
assertTrue(c1.nextIndexValid);
|
||||
assertEquals(1, c1.nextIndex);
|
||||
assertEquals(false, c1.currentRemovedByAnother);
|
||||
assertEquals(null, c1.current);
|
||||
assertFalse(c1.currentRemovedByAnother);
|
||||
assertNull(c1.current);
|
||||
assertEquals("C", c1.next.value);
|
||||
|
||||
assertEquals("[A, C]", list.toString());
|
||||
|
@ -629,7 +629,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
|
||||
list.add(1, (E) "Z");
|
||||
|
||||
assertEquals(true, c1.nextIndexValid);
|
||||
assertTrue(c1.nextIndexValid);
|
||||
assertEquals(1, c1.nextIndex);
|
||||
assertEquals("B", c1.current.value);
|
||||
assertEquals("Z", c1.next.value);
|
||||
|
@ -654,7 +654,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
|
||||
list.add(1, (E) "Z");
|
||||
|
||||
assertEquals(true, c1.nextIndexValid);
|
||||
assertTrue(c1.nextIndexValid);
|
||||
assertEquals(1, c1.nextIndex);
|
||||
assertEquals("A", c1.current.value);
|
||||
assertEquals("Z", c1.next.value);
|
||||
|
@ -680,7 +680,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
|
||||
list.add(1, (E) "Z");
|
||||
|
||||
assertEquals(false, c1.nextIndexValid);
|
||||
assertFalse(c1.nextIndexValid);
|
||||
assertEquals("B", c1.current.value);
|
||||
assertEquals("C", c1.next.value);
|
||||
|
||||
|
@ -706,9 +706,9 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
|
||||
c1.add((E) "Z");
|
||||
|
||||
assertEquals(true, c1.nextIndexValid);
|
||||
assertTrue(c1.nextIndexValid);
|
||||
assertEquals(2, c1.nextIndex);
|
||||
assertEquals(null, c1.current);
|
||||
assertNull(c1.current);
|
||||
assertEquals("B", c1.next.value);
|
||||
|
||||
assertEquals("[A, Z, B, C]", list.toString());
|
||||
|
@ -730,10 +730,10 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
|
||||
c1.add((E) "Z");
|
||||
|
||||
assertEquals(true, c1.nextIndexValid);
|
||||
assertTrue(c1.nextIndexValid);
|
||||
assertEquals(3, c1.nextIndex);
|
||||
assertEquals(false, c1.currentRemovedByAnother);
|
||||
assertEquals(null, c1.current);
|
||||
assertFalse(c1.currentRemovedByAnother);
|
||||
assertNull(c1.current);
|
||||
assertEquals("C", c1.next.value);
|
||||
|
||||
assertEquals("[A, B, Z, C]", list.toString());
|
||||
|
@ -755,9 +755,9 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
|
||||
list.remove(1);
|
||||
|
||||
assertEquals(true, c1.nextIndexValid);
|
||||
assertTrue(c1.nextIndexValid);
|
||||
assertEquals(1, c1.nextIndex);
|
||||
assertEquals(null, c1.current);
|
||||
assertNull(c1.current);
|
||||
assertEquals("C", c1.next.value);
|
||||
assertEquals("[A, C]", list.toString());
|
||||
|
||||
|
@ -780,7 +780,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
|
||||
c1.set((E) "Z");
|
||||
|
||||
assertEquals(true, c1.nextIndexValid);
|
||||
assertTrue(c1.nextIndexValid);
|
||||
assertEquals(1, c1.nextIndex);
|
||||
assertEquals("Z", c1.current.value);
|
||||
assertEquals("Z", c1.next.value);
|
||||
|
@ -806,7 +806,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
|
||||
c1.set((E) "Z");
|
||||
|
||||
assertEquals(true, c1.nextIndexValid);
|
||||
assertTrue(c1.nextIndexValid);
|
||||
assertEquals(2, c1.nextIndex);
|
||||
assertEquals("Z", c1.current.value);
|
||||
assertEquals("C", c1.next.value);
|
||||
|
@ -822,66 +822,66 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testEqualsAndHashCode() {
|
||||
assertTrue(list.equals(list));
|
||||
assertEquals(list, list);
|
||||
assertEquals(list.hashCode(), list.hashCode());
|
||||
list.add((E) "A");
|
||||
assertTrue(list.equals(list));
|
||||
assertEquals(list, list);
|
||||
assertEquals(list.hashCode(), list.hashCode());
|
||||
|
||||
final CursorableLinkedList<E> list2 = new CursorableLinkedList<>();
|
||||
assertTrue(!list.equals(list2));
|
||||
assertTrue(!list2.equals(list));
|
||||
assertFalse(list.equals(list2));
|
||||
assertFalse(list2.equals(list));
|
||||
|
||||
final java.util.List<E> list3 = new java.util.LinkedList<>();
|
||||
assertTrue(!list.equals(list3));
|
||||
assertTrue(!list3.equals(list));
|
||||
assertTrue(list2.equals(list3));
|
||||
assertTrue(list3.equals(list2));
|
||||
assertFalse(list.equals(list3));
|
||||
assertFalse(list3.equals(list));
|
||||
assertEquals(list2, list3);
|
||||
assertEquals(list3, list2);
|
||||
assertEquals(list2.hashCode(), list3.hashCode());
|
||||
|
||||
list2.add((E) "A");
|
||||
assertTrue(list.equals(list2));
|
||||
assertTrue(list2.equals(list));
|
||||
assertTrue(!list2.equals(list3));
|
||||
assertTrue(!list3.equals(list2));
|
||||
assertEquals(list, list2);
|
||||
assertEquals(list2, list);
|
||||
assertFalse(list2.equals(list3));
|
||||
assertFalse(list3.equals(list2));
|
||||
|
||||
list3.add((E) "A");
|
||||
assertTrue(list2.equals(list3));
|
||||
assertTrue(list3.equals(list2));
|
||||
assertEquals(list2, list3);
|
||||
assertEquals(list3, list2);
|
||||
assertEquals(list2.hashCode(), list3.hashCode());
|
||||
|
||||
list.add((E) "B");
|
||||
assertTrue(list.equals(list));
|
||||
assertTrue(!list.equals(list2));
|
||||
assertTrue(!list2.equals(list));
|
||||
assertTrue(!list.equals(list3));
|
||||
assertTrue(!list3.equals(list));
|
||||
assertEquals(list, list);
|
||||
assertFalse(list.equals(list2));
|
||||
assertFalse(list2.equals(list));
|
||||
assertFalse(list.equals(list3));
|
||||
assertFalse(list3.equals(list));
|
||||
|
||||
list2.add((E) "B");
|
||||
list3.add((E) "B");
|
||||
assertTrue(list.equals(list));
|
||||
assertTrue(list.equals(list2));
|
||||
assertTrue(list2.equals(list));
|
||||
assertTrue(list2.equals(list3));
|
||||
assertTrue(list3.equals(list2));
|
||||
assertEquals(list, list);
|
||||
assertEquals(list, list2);
|
||||
assertEquals(list2, list);
|
||||
assertEquals(list2, list3);
|
||||
assertEquals(list3, list2);
|
||||
assertEquals(list2.hashCode(), list3.hashCode());
|
||||
|
||||
list.add((E) "C");
|
||||
list2.add((E) "C");
|
||||
list3.add((E) "C");
|
||||
assertTrue(list.equals(list));
|
||||
assertTrue(list.equals(list2));
|
||||
assertTrue(list2.equals(list));
|
||||
assertTrue(list2.equals(list3));
|
||||
assertTrue(list3.equals(list2));
|
||||
assertEquals(list, list);
|
||||
assertEquals(list, list2);
|
||||
assertEquals(list2, list);
|
||||
assertEquals(list2, list3);
|
||||
assertEquals(list3, list2);
|
||||
assertEquals(list.hashCode(), list2.hashCode());
|
||||
assertEquals(list2.hashCode(), list3.hashCode());
|
||||
|
||||
list.add((E) "D");
|
||||
list2.addFirst((E) "D");
|
||||
assertTrue(list.equals(list));
|
||||
assertTrue(!list.equals(list2));
|
||||
assertTrue(!list2.equals(list));
|
||||
assertEquals(list, list);
|
||||
assertFalse(list.equals(list2));
|
||||
assertFalse(list2.equals(list));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -939,11 +939,11 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
public void testIsEmpty() {
|
||||
assertTrue(list.isEmpty());
|
||||
list.add((E) "element");
|
||||
assertTrue(!list.isEmpty());
|
||||
assertFalse(list.isEmpty());
|
||||
list.remove("element");
|
||||
assertTrue(list.isEmpty());
|
||||
list.add((E) "element");
|
||||
assertTrue(!list.isEmpty());
|
||||
assertFalse(list.isEmpty());
|
||||
list.clear();
|
||||
assertTrue(list.isEmpty());
|
||||
}
|
||||
|
@ -966,7 +966,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
assertEquals("4", it.next());
|
||||
assertTrue(it.hasNext());
|
||||
assertEquals("5", it.next());
|
||||
assertTrue(!it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
|
||||
it = list.iterator();
|
||||
assertTrue(it.hasNext());
|
||||
|
@ -989,7 +989,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
assertEquals("5", it.next());
|
||||
it.remove();
|
||||
assertEquals("[]", list.toString());
|
||||
assertTrue(!it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -1001,7 +1001,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
list.add((E) "5");
|
||||
final ListIterator<E> it = list.listIterator();
|
||||
assertTrue(it.hasNext());
|
||||
assertTrue(!it.hasPrevious());
|
||||
assertFalse(it.hasPrevious());
|
||||
assertEquals(-1, it.previousIndex());
|
||||
assertEquals(0, it.nextIndex());
|
||||
assertEquals("1", it.next());
|
||||
|
@ -1011,7 +1011,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
assertEquals(1, it.nextIndex());
|
||||
assertEquals("1", it.previous());
|
||||
assertTrue(it.hasNext());
|
||||
assertTrue(!it.hasPrevious());
|
||||
assertFalse(it.hasPrevious());
|
||||
assertEquals(-1, it.previousIndex());
|
||||
assertEquals(0, it.nextIndex());
|
||||
assertEquals("1", it.next());
|
||||
|
@ -1045,7 +1045,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
assertEquals(3, it.previousIndex());
|
||||
assertEquals(4, it.nextIndex());
|
||||
assertEquals("5", it.next());
|
||||
assertTrue(!it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
assertTrue(it.hasPrevious());
|
||||
assertEquals(4, it.previousIndex());
|
||||
assertEquals(5, it.nextIndex());
|
||||
|
@ -1071,7 +1071,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
assertEquals(1, it.nextIndex());
|
||||
assertEquals("1", it.previous());
|
||||
assertTrue(it.hasNext());
|
||||
assertTrue(!it.hasPrevious());
|
||||
assertFalse(it.hasPrevious());
|
||||
assertEquals(-1, it.previousIndex());
|
||||
assertEquals(0, it.nextIndex());
|
||||
}
|
||||
|
@ -1125,7 +1125,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
assertEquals("1", it.previous());
|
||||
it.remove();
|
||||
assertEquals("[3, 4, 5]", list.toString());
|
||||
assertTrue(!it.hasPrevious());
|
||||
assertFalse(it.hasPrevious());
|
||||
assertEquals("3", it.next());
|
||||
it.remove();
|
||||
assertEquals("[4, 5]", list.toString());
|
||||
|
@ -1179,7 +1179,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
|
||||
assertTrue(list.removeAll(set));
|
||||
assertEquals("[1, 3, 5]", list.toString());
|
||||
assertTrue(!list.removeAll(set));
|
||||
assertFalse(list.removeAll(set));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -1215,12 +1215,12 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
list.add((E) "4");
|
||||
list.add((E) "5");
|
||||
assertEquals("[1, 1, 2, 3, 4, 5, 2, 3, 4, 5]", list.toString());
|
||||
assertTrue(!list.remove("6"));
|
||||
assertFalse(list.remove("6"));
|
||||
assertTrue(list.remove("5"));
|
||||
assertEquals("[1, 1, 2, 3, 4, 2, 3, 4, 5]", list.toString());
|
||||
assertTrue(list.remove("5"));
|
||||
assertEquals("[1, 1, 2, 3, 4, 2, 3, 4]", list.toString());
|
||||
assertTrue(!list.remove("5"));
|
||||
assertFalse(list.remove("5"));
|
||||
assertTrue(list.remove("1"));
|
||||
assertEquals("[1, 2, 3, 4, 2, 3, 4]", list.toString());
|
||||
assertTrue(list.remove("1"));
|
||||
|
@ -1261,7 +1261,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
|
||||
assertTrue(list.retainAll(set));
|
||||
assertEquals("[2, 2, 4, 4]", list.toString());
|
||||
assertTrue(!list.retainAll(set));
|
||||
assertFalse(list.retainAll(set));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -1409,7 +1409,7 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
|
||||
final String[] elts4 = new String[3];
|
||||
final String[] elts4b = list.toArray(elts4);
|
||||
assertTrue(elts4 != elts4b);
|
||||
assertNotSame(elts4, elts4b);
|
||||
assertEquals("1", elts4b[0]);
|
||||
assertEquals("2", elts4b[1]);
|
||||
assertEquals("3", elts4b[2]);
|
||||
|
@ -1436,9 +1436,9 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
final java.io.ObjectInputStream in = new java.io.ObjectInputStream(bufin);
|
||||
final Object list2 = in.readObject();
|
||||
|
||||
assertTrue(list != list2);
|
||||
assertTrue(list2.equals(list));
|
||||
assertTrue(list.equals(list2));
|
||||
assertNotSame(list, list2);
|
||||
assertEquals(list2, list);
|
||||
assertEquals(list, list2);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -1458,9 +1458,9 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
final java.io.ObjectInputStream in = new java.io.ObjectInputStream(bufin);
|
||||
final Object list2 = in.readObject();
|
||||
|
||||
assertTrue(list != list2);
|
||||
assertTrue(list2.equals(list));
|
||||
assertTrue(list.equals(list2));
|
||||
assertNotSame(list, list2);
|
||||
assertEquals(list2, list);
|
||||
assertEquals(list, list2);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -1481,9 +1481,9 @@ public class CursorableLinkedListTest<E> extends AbstractLinkedListTest<E> {
|
|||
final java.io.ObjectInputStream in = new java.io.ObjectInputStream(bufin);
|
||||
final Object list2 = in.readObject();
|
||||
|
||||
assertTrue(list != list2);
|
||||
assertTrue(list2.equals(list));
|
||||
assertTrue(list.equals(list2));
|
||||
assertNotSame(list, list2);
|
||||
assertEquals(list2, list);
|
||||
assertEquals(list, list2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -63,7 +63,7 @@ public class GrowthListTest<E> extends AbstractListTest<E> {
|
|||
assertEquals(0, grower.size());
|
||||
grower.add(1, one);
|
||||
assertEquals(2, grower.size());
|
||||
assertEquals(null, grower.get(0));
|
||||
assertNull(grower.get(0));
|
||||
assertEquals(one, grower.get(1));
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class GrowthListTest<E> extends AbstractListTest<E> {
|
|||
assertEquals(0, grower.size());
|
||||
grower.addAll(1, coll);
|
||||
assertEquals(3, grower.size());
|
||||
assertEquals(null, grower.get(0));
|
||||
assertNull(grower.get(0));
|
||||
assertEquals(one, grower.get(1));
|
||||
assertEquals(two, grower.get(2));
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public class GrowthListTest<E> extends AbstractListTest<E> {
|
|||
assertEquals(0, grower.size());
|
||||
grower.set(1, one);
|
||||
assertEquals(2, grower.size());
|
||||
assertEquals(null, grower.get(0));
|
||||
assertNull(grower.get(0));
|
||||
assertEquals(one, grower.get(1));
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ public class PredicatedListTest<E> extends AbstractListTest<E> {
|
|||
} catch (final IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
assertTrue("Collection shouldn't contain illegal element", !list.contains(i));
|
||||
assertFalse("Collection shouldn't contain illegal element", list.contains(i));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -89,10 +89,10 @@ public class PredicatedListTest<E> extends AbstractListTest<E> {
|
|||
} catch (final IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
assertTrue("List shouldn't contain illegal element", !list.contains("one"));
|
||||
assertTrue("List shouldn't contain illegal element", !list.contains("two"));
|
||||
assertTrue("List shouldn't contain illegal element", !list.contains(Integer.valueOf(3)));
|
||||
assertTrue("List shouldn't contain illegal element", !list.contains("four"));
|
||||
assertFalse("List shouldn't contain illegal element", list.contains("one"));
|
||||
assertFalse("List shouldn't contain illegal element", list.contains("two"));
|
||||
assertFalse("List shouldn't contain illegal element", list.contains(Integer.valueOf(3)));
|
||||
assertFalse("List shouldn't contain illegal element", list.contains("four"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -67,12 +67,12 @@ public class TransformedListTest<E> extends AbstractListTest<E> {
|
|||
for (int i = 0; i < els.length; i++) {
|
||||
list.add(els[i]);
|
||||
assertEquals(i + 1, list.size());
|
||||
assertEquals(true, list.contains(Integer.valueOf((String) els[i])));
|
||||
assertEquals(false, list.contains(els[i]));
|
||||
assertTrue(list.contains(Integer.valueOf((String) els[i])));
|
||||
assertFalse(list.contains(els[i]));
|
||||
}
|
||||
|
||||
assertEquals(false, list.remove(els[0]));
|
||||
assertEquals(true, list.remove(Integer.valueOf((String) els[0])));
|
||||
assertFalse(list.remove(els[0]));
|
||||
assertTrue(list.remove(Integer.valueOf((String) els[0])));
|
||||
|
||||
list.clear();
|
||||
for (int i = 0; i < els.length; i++) {
|
||||
|
@ -116,12 +116,12 @@ public class TransformedListTest<E> extends AbstractListTest<E> {
|
|||
final List<?> list = TransformedList.transformedList(originalList, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||
assertEquals(els.length, list.size());
|
||||
for (final Object el : els) {
|
||||
assertEquals(true, list.contains(Integer.valueOf((String) el)));
|
||||
assertEquals(false, list.contains(el));
|
||||
assertTrue(list.contains(Integer.valueOf((String) el)));
|
||||
assertFalse(list.contains(el));
|
||||
}
|
||||
|
||||
assertEquals(false, list.remove(els[0]));
|
||||
assertEquals(true, list.remove(Integer.valueOf((String) els[0])));
|
||||
assertFalse(list.remove(els[0]));
|
||||
assertTrue(list.remove(Integer.valueOf((String) els[0])));
|
||||
}
|
||||
|
||||
public void testSubList() {
|
||||
|
|
|
@ -117,7 +117,7 @@ public class TreeListTest<E> extends AbstractListTest<E> {
|
|||
l.add((E) "andres");
|
||||
l.add((E) "harald");
|
||||
l.add(0, null);
|
||||
assertEquals(null, l.get(0));
|
||||
assertNull(l.get(0));
|
||||
assertEquals("hugo", l.get(1));
|
||||
assertEquals("erna", l.get(2));
|
||||
assertEquals("daniel", l.get(3));
|
||||
|
@ -135,7 +135,7 @@ public class TreeListTest<E> extends AbstractListTest<E> {
|
|||
l.add((E) "harald");
|
||||
l.add(0, null);
|
||||
int i = 0;
|
||||
assertEquals(null, l.get(i++));
|
||||
assertNull(l.get(i++));
|
||||
assertEquals("hugo", l.get(i++));
|
||||
assertEquals("erna", l.get(i++));
|
||||
assertEquals("daniel", l.get(i++));
|
||||
|
@ -241,7 +241,7 @@ public class TreeListTest<E> extends AbstractListTest<E> {
|
|||
assertEquals(Integer.valueOf(4), li.next());
|
||||
assertEquals(Integer.valueOf(4), li.previous());
|
||||
assertEquals(Integer.valueOf(4), li.next());
|
||||
assertEquals(false, li.hasNext());
|
||||
assertFalse(li.hasNext());
|
||||
}
|
||||
|
||||
public void testBugCollections447() {
|
||||
|
|
|
@ -413,7 +413,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
"isAllowNullValue is not overridden to return false.",
|
||||
values[i] == null || !isAllowNullValue());
|
||||
|
||||
assertTrue("Unknown reason for NullPointer.", false);
|
||||
fail("Unknown reason for NullPointer.");
|
||||
}
|
||||
}
|
||||
assertEquals("size must reflect number of mappings added.",
|
||||
|
@ -532,26 +532,22 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
*/
|
||||
public void testMakeMap() {
|
||||
final Map<K, V> em = makeObject();
|
||||
assertTrue("failure in test: makeEmptyMap must return a non-null map.",
|
||||
em != null);
|
||||
assertNotNull("failure in test: makeEmptyMap must return a non-null map.", em);
|
||||
|
||||
final Map<K, V> em2 = makeObject();
|
||||
assertTrue("failure in test: makeEmptyMap must return a non-null map.",
|
||||
em != null);
|
||||
assertNotNull("failure in test: makeEmptyMap must return a non-null map.", em);
|
||||
|
||||
assertTrue("failure in test: makeEmptyMap must return a new map " +
|
||||
"with each invocation.", em != em2);
|
||||
assertNotSame("failure in test: makeEmptyMap must return a new map " +
|
||||
"with each invocation.", em, em2);
|
||||
|
||||
final Map<K, V> fm = makeFullMap();
|
||||
assertTrue("failure in test: makeFullMap must return a non-null map.",
|
||||
fm != null);
|
||||
assertNotNull("failure in test: makeFullMap must return a non-null map.", fm);
|
||||
|
||||
final Map<K, V> fm2 = makeFullMap();
|
||||
assertTrue("failure in test: makeFullMap must return a non-null map.",
|
||||
fm != null);
|
||||
assertNotNull("failure in test: makeFullMap must return a non-null map.", fm);
|
||||
|
||||
assertTrue("failure in test: makeFullMap must return a new map " +
|
||||
"with each invocation.", fm != fm2);
|
||||
assertNotSame("failure in test: makeFullMap must return a new map " +
|
||||
"with each invocation.", fm, fm2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -559,13 +555,11 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
*/
|
||||
public void testMapIsEmpty() {
|
||||
resetEmpty();
|
||||
assertEquals("Map.isEmpty() should return true with an empty map",
|
||||
true, getMap().isEmpty());
|
||||
assertTrue("Map.isEmpty() should return true with an empty map", getMap().isEmpty());
|
||||
verify();
|
||||
|
||||
resetFull();
|
||||
assertEquals("Map.isEmpty() should return false with a non-empty map",
|
||||
false, getMap().isEmpty());
|
||||
assertFalse("Map.isEmpty() should return false with a non-empty map", getMap().isEmpty());
|
||||
verify();
|
||||
}
|
||||
|
||||
|
@ -623,8 +617,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
|
||||
resetEmpty();
|
||||
for (final Object key : keys) {
|
||||
assertTrue("Map must not contain key when map is empty",
|
||||
!getMap().containsKey(key));
|
||||
assertFalse("Map must not contain key when map is empty", getMap().containsKey(key));
|
||||
}
|
||||
verify();
|
||||
|
||||
|
@ -646,8 +639,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
|
||||
resetEmpty();
|
||||
for (final Object value : values) {
|
||||
assertTrue("Empty map must not contain value",
|
||||
!getMap().containsValue(value));
|
||||
assertFalse("Empty map must not contain value", getMap().containsValue(value));
|
||||
}
|
||||
verify();
|
||||
|
||||
|
@ -665,11 +657,11 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
*/
|
||||
public void testMapEquals() {
|
||||
resetEmpty();
|
||||
assertTrue("Empty maps unequal.", getMap().equals(confirmed));
|
||||
assertEquals("Empty maps unequal.", getMap(), confirmed);
|
||||
verify();
|
||||
|
||||
resetFull();
|
||||
assertTrue("Full maps unequal.", getMap().equals(confirmed));
|
||||
assertEquals("Full maps unequal.", getMap(), confirmed);
|
||||
verify();
|
||||
|
||||
resetFull();
|
||||
|
@ -678,12 +670,11 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
final Iterator<K> iter = confirmed.keySet().iterator();
|
||||
iter.next();
|
||||
iter.remove();
|
||||
assertTrue("Different maps equal.", !getMap().equals(confirmed));
|
||||
assertFalse("Different maps equal.", getMap().equals(confirmed));
|
||||
|
||||
resetFull();
|
||||
assertTrue("equals(null) returned true.", !getMap().equals(null));
|
||||
assertTrue("equals(new Object()) returned true.",
|
||||
!getMap().equals(new Object()));
|
||||
assertFalse("equals(null) returned true.", getMap().equals(null));
|
||||
assertFalse("equals(new Object()) returned true.", getMap().equals(new Object()));
|
||||
verify();
|
||||
}
|
||||
|
||||
|
@ -697,8 +688,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
final Object[] values = getSampleValues();
|
||||
|
||||
for (final Object key : keys) {
|
||||
assertTrue("Empty map.get() should return null.",
|
||||
getMap().get(key) == null);
|
||||
assertNull("Empty map.get() should return null.", getMap().get(key));
|
||||
}
|
||||
verify();
|
||||
|
||||
|
@ -714,12 +704,10 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
*/
|
||||
public void testMapHashCode() {
|
||||
resetEmpty();
|
||||
assertTrue("Empty maps have different hashCodes.",
|
||||
getMap().hashCode() == confirmed.hashCode());
|
||||
assertEquals("Empty maps have different hashCodes.", getMap().hashCode(), confirmed.hashCode());
|
||||
|
||||
resetFull();
|
||||
assertTrue("Equal maps have different hashCodes.",
|
||||
getMap().hashCode() == confirmed.hashCode());
|
||||
assertEquals("Equal maps have different hashCodes.", getMap().hashCode(), confirmed.hashCode());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -733,13 +721,11 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
*/
|
||||
public void testMapToString() {
|
||||
resetEmpty();
|
||||
assertTrue("Empty map toString() should not return null",
|
||||
getMap().toString() != null);
|
||||
assertNotNull("Empty map toString() should not return null", getMap().toString());
|
||||
verify();
|
||||
|
||||
resetFull();
|
||||
assertTrue("Empty map toString() should not return null",
|
||||
getMap().toString() != null);
|
||||
assertNotNull("Empty map toString() should not return null", getMap().toString());
|
||||
verify();
|
||||
}
|
||||
|
||||
|
@ -801,7 +787,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
final Object o = getMap().put(keys[i], values[i]);
|
||||
getConfirmed().put(keys[i], values[i]);
|
||||
verify();
|
||||
assertTrue("First map.put should return null", o == null);
|
||||
assertNull("First map.put should return null", o);
|
||||
assertTrue("Map should contain key after put",
|
||||
getMap().containsKey(keys[i]));
|
||||
assertTrue("Map should contain value after put",
|
||||
|
@ -821,8 +807,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
// if duplicates are allowed, we're not guaranteed that the value
|
||||
// no longer exists, so don't try checking that.
|
||||
if (!isAllowDuplicateValues()) {
|
||||
assertTrue("Map should not contain old value after put when changed",
|
||||
!getMap().containsValue(values[i]));
|
||||
assertFalse("Map should not contain old value after put when changed", getMap().containsValue(values[i]));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -860,8 +845,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
// if duplicates are allowed, we're not guaranteed that the value
|
||||
// no longer exists, so don't try checking that.
|
||||
if (!isAllowDuplicateValues()) {
|
||||
assertTrue("Map should not contain old value after put when changed",
|
||||
!getMap().containsValue(values[i]));
|
||||
assertFalse("Map should not contain old value after put when changed", getMap().containsValue(values[i]));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -990,7 +974,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
final Object[] values = getSampleValues();
|
||||
for (final Object key : keys) {
|
||||
final Object o = getMap().remove(key);
|
||||
assertTrue("First map.remove should return null", o == null);
|
||||
assertNull("First map.remove should return null", o);
|
||||
}
|
||||
verify();
|
||||
|
||||
|
@ -1106,7 +1090,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
resetFull();
|
||||
final Set<Map.Entry<K, V>> entrySet = getMap().entrySet();
|
||||
final Map.Entry<K, V> entry = entrySet.iterator().next();
|
||||
assertEquals(true, entrySet.contains(entry));
|
||||
assertTrue(entrySet.contains(entry));
|
||||
}
|
||||
|
||||
public void testEntrySetContains2() {
|
||||
|
@ -1114,7 +1098,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
final Set<Map.Entry<K, V>> entrySet = getMap().entrySet();
|
||||
final Map.Entry<K, V> entry = entrySet.iterator().next();
|
||||
final Map.Entry<K, V> test = cloneMapEntry(entry);
|
||||
assertEquals(true, entrySet.contains(test));
|
||||
assertTrue(entrySet.contains(test));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -1125,7 +1109,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
final HashMap<K, V> temp = new HashMap<>();
|
||||
temp.put(entry.getKey(), (V) "A VERY DIFFERENT VALUE");
|
||||
final Map.Entry<K, V> test = temp.entrySet().iterator().next();
|
||||
assertEquals(false, entrySet.contains(test));
|
||||
assertFalse(entrySet.contains(test));
|
||||
}
|
||||
|
||||
public void testEntrySetRemove1() {
|
||||
|
@ -1138,8 +1122,8 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
final Map.Entry<K, V> entry = entrySet.iterator().next();
|
||||
final K key = entry.getKey();
|
||||
|
||||
assertEquals(true, entrySet.remove(entry));
|
||||
assertEquals(false, getMap().containsKey(key));
|
||||
assertTrue(entrySet.remove(entry));
|
||||
assertFalse(getMap().containsKey(key));
|
||||
assertEquals(size - 1, getMap().size());
|
||||
}
|
||||
|
||||
|
@ -1154,8 +1138,8 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
final K key = entry.getKey();
|
||||
final Map.Entry<K, V> test = cloneMapEntry(entry);
|
||||
|
||||
assertEquals(true, entrySet.remove(test));
|
||||
assertEquals(false, getMap().containsKey(key));
|
||||
assertTrue(entrySet.remove(test));
|
||||
assertFalse(getMap().containsKey(key));
|
||||
assertEquals(size - 1, getMap().size());
|
||||
}
|
||||
|
||||
|
@ -1173,8 +1157,8 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
temp.put(entry.getKey(), (V) "A VERY DIFFERENT VALUE");
|
||||
final Map.Entry<K, V> test = temp.entrySet().iterator().next();
|
||||
|
||||
assertEquals(false, entrySet.remove(test));
|
||||
assertEquals(true, getMap().containsKey(key));
|
||||
assertFalse(entrySet.remove(test));
|
||||
assertTrue(getMap().containsKey(key));
|
||||
assertEquals(size, getMap().size());
|
||||
}
|
||||
|
||||
|
@ -1210,9 +1194,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
j++;
|
||||
}
|
||||
assertTrue("values().remove(obj) is broken", j < 10000);
|
||||
assertTrue(
|
||||
"Value should have been removed from the underlying map.",
|
||||
!getMap().containsValue(sampleValue));
|
||||
assertFalse("Value should have been removed from the underlying map.", getMap().containsValue(sampleValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1316,9 +1298,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
// if key.remove is unsupported, just skip this test
|
||||
return;
|
||||
}
|
||||
assertTrue(
|
||||
"Key should have been removed from the underlying map.",
|
||||
!getMap().containsKey(sampleKey));
|
||||
assertFalse("Key should have been removed from the underlying map.", getMap().containsKey(sampleKey));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1403,9 +1383,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
// if entrySet removal is unsupported, just skip this test
|
||||
return;
|
||||
}
|
||||
assertTrue(
|
||||
"Entry should have been removed from the underlying map.",
|
||||
!getMap().containsKey(sampleKeys[i]));
|
||||
assertFalse("Entry should have been removed from the underlying map.", getMap().containsKey(sampleKeys[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1614,8 +1592,8 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
int count = 0;
|
||||
while (it.hasNext()) {
|
||||
final Map.Entry<K, V> entry = it.next();
|
||||
assertEquals(true, AbstractMapTest.this.getMap().containsKey(entry.getKey()));
|
||||
assertEquals(true, AbstractMapTest.this.getMap().containsValue(entry.getValue()));
|
||||
assertTrue(AbstractMapTest.this.getMap().containsKey(entry.getKey()));
|
||||
assertTrue(AbstractMapTest.this.getMap().containsValue(entry.getValue()));
|
||||
if (!isGetStructuralModify()) {
|
||||
assertEquals(AbstractMapTest.this.getMap().get(entry.getKey()), entry.getValue());
|
||||
}
|
||||
|
@ -1654,24 +1632,24 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
entry1.setValue(newValue1);
|
||||
entryConfirmed1.setValue(newValue1);
|
||||
assertEquals(newValue1, entry1.getValue());
|
||||
assertEquals(true, AbstractMapTest.this.getMap().containsKey(entry1.getKey()));
|
||||
assertEquals(true, AbstractMapTest.this.getMap().containsValue(newValue1));
|
||||
assertTrue(AbstractMapTest.this.getMap().containsKey(entry1.getKey()));
|
||||
assertTrue(AbstractMapTest.this.getMap().containsValue(newValue1));
|
||||
assertEquals(newValue1, AbstractMapTest.this.getMap().get(entry1.getKey()));
|
||||
verify();
|
||||
|
||||
entry1.setValue(newValue1);
|
||||
entryConfirmed1.setValue(newValue1);
|
||||
assertEquals(newValue1, entry1.getValue());
|
||||
assertEquals(true, AbstractMapTest.this.getMap().containsKey(entry1.getKey()));
|
||||
assertEquals(true, AbstractMapTest.this.getMap().containsValue(newValue1));
|
||||
assertTrue(AbstractMapTest.this.getMap().containsKey(entry1.getKey()));
|
||||
assertTrue(AbstractMapTest.this.getMap().containsValue(newValue1));
|
||||
assertEquals(newValue1, AbstractMapTest.this.getMap().get(entry1.getKey()));
|
||||
verify();
|
||||
|
||||
entry2.setValue(newValue2);
|
||||
entryConfirmed2.setValue(newValue2);
|
||||
assertEquals(newValue2, entry2.getValue());
|
||||
assertEquals(true, AbstractMapTest.this.getMap().containsKey(entry2.getKey()));
|
||||
assertEquals(true, AbstractMapTest.this.getMap().containsValue(newValue2));
|
||||
assertTrue(AbstractMapTest.this.getMap().containsKey(entry2.getKey()));
|
||||
assertTrue(AbstractMapTest.this.getMap().containsValue(newValue2));
|
||||
assertEquals(newValue2, AbstractMapTest.this.getMap().get(entry2.getKey()));
|
||||
verify();
|
||||
}
|
||||
|
@ -1699,8 +1677,8 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
return;
|
||||
}
|
||||
resetFull();
|
||||
assertEquals(false, getCollection().remove(null));
|
||||
assertEquals(false, getCollection().remove(new Object()));
|
||||
assertFalse(getCollection().remove(null));
|
||||
assertFalse(getCollection().remove(new Object()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1956,7 +1934,7 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
|
|||
// concurrent modification exceptions.
|
||||
// Because of this we have assertEquals(map, confirmed), and not the other way around.
|
||||
assertEquals("Map should still equal HashMap", map, confirmed);
|
||||
assertTrue("Map should still equal HashMap", getMap().equals(getConfirmed()));
|
||||
assertEquals("Map should still equal HashMap", getMap(), getConfirmed());
|
||||
}
|
||||
|
||||
public void verifyEntrySet() {
|
||||
|
|
|
@ -116,13 +116,13 @@ public abstract class AbstractOrderedMapTest<K, V> extends AbstractIterableMapTe
|
|||
public void testNextKey() {
|
||||
resetEmpty();
|
||||
OrderedMap<K, V> ordered = getMap();
|
||||
assertEquals(null, ordered.nextKey(getOtherKeys()[0]));
|
||||
assertNull(ordered.nextKey(getOtherKeys()[0]));
|
||||
if (!isAllowNullKey()) {
|
||||
try {
|
||||
assertEquals(null, ordered.nextKey(null)); // this is allowed too
|
||||
assertNull(ordered.nextKey(null)); // this is allowed too
|
||||
} catch (final NullPointerException ex) {}
|
||||
} else {
|
||||
assertEquals(null, ordered.nextKey(null));
|
||||
assertNull(ordered.nextKey(null));
|
||||
}
|
||||
|
||||
resetFull();
|
||||
|
@ -134,7 +134,7 @@ public abstract class AbstractOrderedMapTest<K, V> extends AbstractIterableMapTe
|
|||
assertEquals(confirmedObject, ordered.nextKey(confirmedLast));
|
||||
confirmedLast = confirmedObject;
|
||||
}
|
||||
assertEquals(null, ordered.nextKey(confirmedLast));
|
||||
assertNull(ordered.nextKey(confirmedLast));
|
||||
|
||||
if (!isAllowNullKey()) {
|
||||
try {
|
||||
|
@ -142,20 +142,20 @@ public abstract class AbstractOrderedMapTest<K, V> extends AbstractIterableMapTe
|
|||
fail();
|
||||
} catch (final NullPointerException ex) {}
|
||||
} else {
|
||||
assertEquals(null, ordered.nextKey(null));
|
||||
assertNull(ordered.nextKey(null));
|
||||
}
|
||||
}
|
||||
|
||||
public void testPreviousKey() {
|
||||
resetEmpty();
|
||||
OrderedMap<K, V> ordered = getMap();
|
||||
assertEquals(null, ordered.previousKey(getOtherKeys()[0]));
|
||||
assertNull(ordered.previousKey(getOtherKeys()[0]));
|
||||
if (!isAllowNullKey()) {
|
||||
try {
|
||||
assertEquals(null, ordered.previousKey(null)); // this is allowed too
|
||||
assertNull(ordered.previousKey(null)); // this is allowed too
|
||||
} catch (final NullPointerException ex) {}
|
||||
} else {
|
||||
assertEquals(null, ordered.previousKey(null));
|
||||
assertNull(ordered.previousKey(null));
|
||||
}
|
||||
|
||||
resetFull();
|
||||
|
@ -169,7 +169,7 @@ public abstract class AbstractOrderedMapTest<K, V> extends AbstractIterableMapTe
|
|||
assertEquals(confirmedObject, ordered.previousKey(confirmedLast));
|
||||
confirmedLast = confirmedObject;
|
||||
}
|
||||
assertEquals(null, ordered.previousKey(confirmedLast));
|
||||
assertNull(ordered.previousKey(confirmedLast));
|
||||
|
||||
if (!isAllowNullKey()) {
|
||||
try {
|
||||
|
@ -178,7 +178,7 @@ public abstract class AbstractOrderedMapTest<K, V> extends AbstractIterableMapTe
|
|||
} catch (final NullPointerException ex) {}
|
||||
} else {
|
||||
if (!isAllowNullKey()) {
|
||||
assertEquals(null, ordered.previousKey(null));
|
||||
assertNull(ordered.previousKey(null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,14 +52,14 @@ public class DefaultedMapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
final Map<K, V> map = new DefaultedMap<>((V) "NULL");
|
||||
|
||||
assertEquals(0, map.size());
|
||||
assertEquals(false, map.containsKey("NotInMap"));
|
||||
assertFalse(map.containsKey("NotInMap"));
|
||||
assertEquals("NULL", map.get("NotInMap"));
|
||||
|
||||
map.put((K) "Key", (V) "Value");
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(true, map.containsKey("Key"));
|
||||
assertTrue(map.containsKey("Key"));
|
||||
assertEquals("Value", map.get("Key"));
|
||||
assertEquals(false, map.containsKey("NotInMap"));
|
||||
assertFalse(map.containsKey("NotInMap"));
|
||||
assertEquals("NULL", map.get("NotInMap"));
|
||||
}
|
||||
|
||||
|
@ -70,15 +70,15 @@ public class DefaultedMapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
|
||||
assertEquals(0, map.size());
|
||||
assertEquals(0, base.size());
|
||||
assertEquals(false, map.containsKey("NotInMap"));
|
||||
assertFalse(map.containsKey("NotInMap"));
|
||||
assertEquals("NULL", map.get("NotInMap"));
|
||||
|
||||
map.put((K) "Key", (V) "Value");
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(1, base.size());
|
||||
assertEquals(true, map.containsKey("Key"));
|
||||
assertTrue(map.containsKey("Key"));
|
||||
assertEquals("Value", map.get("Key"));
|
||||
assertEquals(false, map.containsKey("NotInMap"));
|
||||
assertFalse(map.containsKey("NotInMap"));
|
||||
assertEquals("NULL", map.get("NotInMap"));
|
||||
}
|
||||
|
||||
|
@ -89,15 +89,15 @@ public class DefaultedMapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
|
||||
assertEquals(0, map.size());
|
||||
assertEquals(0, base.size());
|
||||
assertEquals(false, map.containsKey("NotInMap"));
|
||||
assertFalse(map.containsKey("NotInMap"));
|
||||
assertEquals("NULL", map.get("NotInMap"));
|
||||
|
||||
map.put((K) "Key", (V) "Value");
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(1, base.size());
|
||||
assertEquals(true, map.containsKey("Key"));
|
||||
assertTrue(map.containsKey("Key"));
|
||||
assertEquals("Value", map.get("Key"));
|
||||
assertEquals(false, map.containsKey("NotInMap"));
|
||||
assertFalse(map.containsKey("NotInMap"));
|
||||
assertEquals("NULL", map.get("NotInMap"));
|
||||
}
|
||||
|
||||
|
@ -113,16 +113,16 @@ public class DefaultedMapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
|
||||
assertEquals(0, map.size());
|
||||
assertEquals(0, base.size());
|
||||
assertEquals(false, map.containsKey("NotInMap"));
|
||||
assertFalse(map.containsKey("NotInMap"));
|
||||
assertEquals("NULL", map.get("NotInMap"));
|
||||
assertEquals("NULL_OBJECT", map.get(Integer.valueOf(0)));
|
||||
|
||||
map.put((K) "Key", (V) "Value");
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(1, base.size());
|
||||
assertEquals(true, map.containsKey("Key"));
|
||||
assertTrue(map.containsKey("Key"));
|
||||
assertEquals("Value", map.get("Key"));
|
||||
assertEquals(false, map.containsKey("NotInMap"));
|
||||
assertFalse(map.containsKey("NotInMap"));
|
||||
assertEquals("NULL", map.get("NotInMap"));
|
||||
assertEquals("NULL_OBJECT", map.get(Integer.valueOf(0)));
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
final Flat3Map<K, V> map2 = makeObject();
|
||||
map2.put((K) "a", (V) "testB");
|
||||
map2.put((K) "b", (V) "testA");
|
||||
assertEquals(false, map1.equals(map2));
|
||||
assertFalse(map1.equals(map2));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -77,7 +77,7 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
final Flat3Map<K, V> map2 = makeObject();
|
||||
map2.put((K) "a", (V) "testB");
|
||||
map2.put((K) "c", (V) "testA");
|
||||
assertEquals(false, map1.equals(map2));
|
||||
assertFalse(map1.equals(map2));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -87,16 +87,16 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
map.put((K) ONE, (V) TEN);
|
||||
map.put((K) TWO, (V) TWENTY);
|
||||
assertEquals(2, map.size());
|
||||
assertEquals(true, map.containsKey(ONE));
|
||||
assertEquals(true, map.containsKey(TWO));
|
||||
assertTrue(map.containsKey(ONE));
|
||||
assertTrue(map.containsKey(TWO));
|
||||
assertSame(TEN, map.get(ONE));
|
||||
assertSame(TWENTY, map.get(TWO));
|
||||
|
||||
// clone works (size = 2)
|
||||
final Flat3Map<K, V> cloned = map.clone();
|
||||
assertEquals(2, cloned.size());
|
||||
assertEquals(true, cloned.containsKey(ONE));
|
||||
assertEquals(true, cloned.containsKey(TWO));
|
||||
assertTrue(cloned.containsKey(ONE));
|
||||
assertTrue(cloned.containsKey(TWO));
|
||||
assertSame(TEN, cloned.get(ONE));
|
||||
assertSame(TWENTY, cloned.get(TWO));
|
||||
|
||||
|
@ -105,8 +105,8 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
map.put((K) TWENTY, (V) TWO);
|
||||
assertEquals(4, map.size());
|
||||
assertEquals(2, cloned.size());
|
||||
assertEquals(true, cloned.containsKey(ONE));
|
||||
assertEquals(true, cloned.containsKey(TWO));
|
||||
assertTrue(cloned.containsKey(ONE));
|
||||
assertTrue(cloned.containsKey(TWO));
|
||||
assertSame(TEN, cloned.get(ONE));
|
||||
assertSame(TWENTY, cloned.get(TWO));
|
||||
}
|
||||
|
@ -124,10 +124,10 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
final Flat3Map<K, V> cloned = map.clone();
|
||||
assertEquals(4, map.size());
|
||||
assertEquals(4, cloned.size());
|
||||
assertEquals(true, cloned.containsKey(ONE));
|
||||
assertEquals(true, cloned.containsKey(TWO));
|
||||
assertEquals(true, cloned.containsKey(TEN));
|
||||
assertEquals(true, cloned.containsKey(TWENTY));
|
||||
assertTrue(cloned.containsKey(ONE));
|
||||
assertTrue(cloned.containsKey(TWO));
|
||||
assertTrue(cloned.containsKey(TEN));
|
||||
assertTrue(cloned.containsKey(TWENTY));
|
||||
assertSame(TEN, cloned.get(ONE));
|
||||
assertSame(TWENTY, cloned.get(TWO));
|
||||
assertSame(ONE, cloned.get(TEN));
|
||||
|
@ -137,10 +137,10 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
map.clear();
|
||||
assertEquals(0, map.size());
|
||||
assertEquals(4, cloned.size());
|
||||
assertEquals(true, cloned.containsKey(ONE));
|
||||
assertEquals(true, cloned.containsKey(TWO));
|
||||
assertEquals(true, cloned.containsKey(TEN));
|
||||
assertEquals(true, cloned.containsKey(TWENTY));
|
||||
assertTrue(cloned.containsKey(ONE));
|
||||
assertTrue(cloned.containsKey(TWO));
|
||||
assertTrue(cloned.containsKey(TEN));
|
||||
assertTrue(cloned.containsKey(TWENTY));
|
||||
assertSame(TEN, cloned.get(ONE));
|
||||
assertSame(TWENTY, cloned.get(TWO));
|
||||
assertSame(ONE, cloned.get(TEN));
|
||||
|
@ -179,8 +179,8 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
in.close();
|
||||
assertEquals(2, map.size());
|
||||
assertEquals(2, ser.size());
|
||||
assertEquals(true, ser.containsKey(ONE));
|
||||
assertEquals(true, ser.containsKey(TWO));
|
||||
assertTrue(ser.containsKey(ONE));
|
||||
assertTrue(ser.containsKey(TWO));
|
||||
assertEquals(TEN, ser.get(ONE));
|
||||
assertEquals(TWENTY, ser.get(TWO));
|
||||
}
|
||||
|
@ -204,10 +204,10 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
in.close();
|
||||
assertEquals(4, map.size());
|
||||
assertEquals(4, ser.size());
|
||||
assertEquals(true, ser.containsKey(ONE));
|
||||
assertEquals(true, ser.containsKey(TWO));
|
||||
assertEquals(true, ser.containsKey(TEN));
|
||||
assertEquals(true, ser.containsKey(TWENTY));
|
||||
assertTrue(ser.containsKey(ONE));
|
||||
assertTrue(ser.containsKey(TWO));
|
||||
assertTrue(ser.containsKey(TEN));
|
||||
assertTrue(ser.containsKey(TWENTY));
|
||||
assertEquals(TEN, ser.get(ONE));
|
||||
assertEquals(TWENTY, ser.get(TWO));
|
||||
assertEquals(ONE, ser.get(TEN));
|
||||
|
@ -225,9 +225,9 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
final Map.Entry<K, V> entry = it.next();
|
||||
entry.setValue((V) "NewValue");
|
||||
assertEquals(3, map.size());
|
||||
assertEquals(true, map.containsKey(ONE));
|
||||
assertEquals(true, map.containsKey(TWO));
|
||||
assertEquals(true, map.containsKey(THREE));
|
||||
assertTrue(map.containsKey(ONE));
|
||||
assertTrue(map.containsKey(TWO));
|
||||
assertTrue(map.containsKey(THREE));
|
||||
assertEquals("NewValue", map.get(ONE));
|
||||
assertEquals(TWENTY, map.get(TWO));
|
||||
assertEquals(THIRTY, map.get(THREE));
|
||||
|
@ -245,9 +245,9 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
final Map.Entry<K, V> entry = it.next();
|
||||
entry.setValue((V) "NewValue");
|
||||
assertEquals(3, map.size());
|
||||
assertEquals(true, map.containsKey(ONE));
|
||||
assertEquals(true, map.containsKey(TWO));
|
||||
assertEquals(true, map.containsKey(THREE));
|
||||
assertTrue(map.containsKey(ONE));
|
||||
assertTrue(map.containsKey(TWO));
|
||||
assertTrue(map.containsKey(THREE));
|
||||
assertEquals(TEN, map.get(ONE));
|
||||
assertEquals("NewValue", map.get(TWO));
|
||||
assertEquals(THIRTY, map.get(THREE));
|
||||
|
@ -266,9 +266,9 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
final Map.Entry<K, V> entry = it.next();
|
||||
entry.setValue((V) "NewValue");
|
||||
assertEquals(3, map.size());
|
||||
assertEquals(true, map.containsKey(ONE));
|
||||
assertEquals(true, map.containsKey(TWO));
|
||||
assertEquals(true, map.containsKey(THREE));
|
||||
assertTrue(map.containsKey(ONE));
|
||||
assertTrue(map.containsKey(TWO));
|
||||
assertTrue(map.containsKey(THREE));
|
||||
assertEquals(TEN, map.get(ONE));
|
||||
assertEquals(TWENTY, map.get(TWO));
|
||||
assertEquals("NewValue", map.get(THREE));
|
||||
|
@ -285,9 +285,9 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
it.next();
|
||||
it.setValue((V) "NewValue");
|
||||
assertEquals(3, map.size());
|
||||
assertEquals(true, map.containsKey(ONE));
|
||||
assertEquals(true, map.containsKey(TWO));
|
||||
assertEquals(true, map.containsKey(THREE));
|
||||
assertTrue(map.containsKey(ONE));
|
||||
assertTrue(map.containsKey(TWO));
|
||||
assertTrue(map.containsKey(THREE));
|
||||
assertEquals("NewValue", map.get(ONE));
|
||||
assertEquals(TWENTY, map.get(TWO));
|
||||
assertEquals(THIRTY, map.get(THREE));
|
||||
|
@ -305,9 +305,9 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
it.next();
|
||||
it.setValue((V) "NewValue");
|
||||
assertEquals(3, map.size());
|
||||
assertEquals(true, map.containsKey(ONE));
|
||||
assertEquals(true, map.containsKey(TWO));
|
||||
assertEquals(true, map.containsKey(THREE));
|
||||
assertTrue(map.containsKey(ONE));
|
||||
assertTrue(map.containsKey(TWO));
|
||||
assertTrue(map.containsKey(THREE));
|
||||
assertEquals(TEN, map.get(ONE));
|
||||
assertEquals("NewValue", map.get(TWO));
|
||||
assertEquals(THIRTY, map.get(THREE));
|
||||
|
@ -326,9 +326,9 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
it.next();
|
||||
it.setValue((V) "NewValue");
|
||||
assertEquals(3, map.size());
|
||||
assertEquals(true, map.containsKey(ONE));
|
||||
assertEquals(true, map.containsKey(TWO));
|
||||
assertEquals(true, map.containsKey(THREE));
|
||||
assertTrue(map.containsKey(ONE));
|
||||
assertTrue(map.containsKey(TWO));
|
||||
assertTrue(map.containsKey(THREE));
|
||||
assertEquals(TEN, map.get(ONE));
|
||||
assertEquals(TWENTY, map.get(TWO));
|
||||
assertEquals("NewValue", map.get(THREE));
|
||||
|
@ -354,7 +354,7 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
assertEquals(2, map.size());
|
||||
assertEquals("one", map.get("A"));
|
||||
assertEquals("two", map.get("B"));
|
||||
assertEquals(null, map.get("C"));
|
||||
assertNull(map.get("C"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -719,7 +719,7 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
m.put(TWO, TWO);
|
||||
m.put(null, THREE);
|
||||
final boolean contains = m.containsKey(null);
|
||||
assertEquals(true, contains);
|
||||
assertTrue(contains);
|
||||
}
|
||||
|
||||
public void testContainsKey2() {
|
||||
|
@ -728,7 +728,7 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
m.put(ONE, ONE);
|
||||
m.put(null, TWO);
|
||||
final boolean contains = m.containsKey(null);
|
||||
assertEquals(true, contains);
|
||||
assertTrue(contains);
|
||||
}
|
||||
|
||||
public void testContainsKey3() {
|
||||
|
@ -736,7 +736,7 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
|
||||
m.put(null, ONE);
|
||||
final boolean contains = m.containsKey(null);
|
||||
assertEquals(true, contains);
|
||||
assertTrue(contains);
|
||||
}
|
||||
|
||||
public void testContainsValue1() {
|
||||
|
@ -746,7 +746,7 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
m.put(TWO, TWO);
|
||||
m.put(THREE, null);
|
||||
final boolean contains = m.containsValue(null);
|
||||
assertEquals(true, contains);
|
||||
assertTrue(contains);
|
||||
}
|
||||
|
||||
public void testContainsValue2() {
|
||||
|
@ -755,7 +755,7 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
m.put(ONE, ONE);
|
||||
m.put(TWO, null);
|
||||
final boolean contains = m.containsValue(null);
|
||||
assertEquals(true, contains);
|
||||
assertTrue(contains);
|
||||
}
|
||||
|
||||
public void testContainsValue3() {
|
||||
|
@ -763,7 +763,7 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
|
||||
m.put(ONE, null);
|
||||
final boolean contains = m.containsValue(null);
|
||||
assertEquals(true, contains);
|
||||
assertTrue(contains);
|
||||
}
|
||||
|
||||
public void testPut1() {
|
||||
|
@ -793,7 +793,7 @@ public class Flat3MapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
m.put(null, THREE);
|
||||
final Object old = m.put(null, ONE);
|
||||
assertEquals(THREE, old);
|
||||
assertEquals(null, m.get(ONE));
|
||||
assertNull(m.get(ONE));
|
||||
}
|
||||
|
||||
public void testPut4() {
|
||||
|
|
|
@ -124,17 +124,17 @@ public class LRUMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
|
|||
|
||||
final LRUMap<K, V> map = new LRUMap<>(2);
|
||||
assertEquals(0, map.size());
|
||||
assertEquals(false, map.isFull());
|
||||
assertFalse(map.isFull());
|
||||
assertEquals(2, map.maxSize());
|
||||
|
||||
map.put(keys[0], values[0]);
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(false, map.isFull());
|
||||
assertFalse(map.isFull());
|
||||
assertEquals(2, map.maxSize());
|
||||
|
||||
map.put(keys[1], values[1]);
|
||||
assertEquals(2, map.size());
|
||||
assertEquals(true, map.isFull());
|
||||
assertTrue(map.isFull());
|
||||
assertEquals(2, map.maxSize());
|
||||
kit = map.keySet().iterator();
|
||||
assertSame(keys[0], kit.next());
|
||||
|
@ -145,7 +145,7 @@ public class LRUMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
|
|||
|
||||
map.put(keys[2], values[2]);
|
||||
assertEquals(2, map.size());
|
||||
assertEquals(true, map.isFull());
|
||||
assertTrue(map.isFull());
|
||||
assertEquals(2, map.maxSize());
|
||||
kit = map.keySet().iterator();
|
||||
assertSame(keys[1], kit.next());
|
||||
|
@ -156,7 +156,7 @@ public class LRUMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
|
|||
|
||||
map.put(keys[2], values[0]);
|
||||
assertEquals(2, map.size());
|
||||
assertEquals(true, map.isFull());
|
||||
assertTrue(map.isFull());
|
||||
assertEquals(2, map.maxSize());
|
||||
kit = map.keySet().iterator();
|
||||
assertSame(keys[1], kit.next());
|
||||
|
@ -167,7 +167,7 @@ public class LRUMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
|
|||
|
||||
map.put(keys[1], values[3]);
|
||||
assertEquals(2, map.size());
|
||||
assertEquals(true, map.isFull());
|
||||
assertTrue(map.isFull());
|
||||
assertEquals(2, map.maxSize());
|
||||
kit = map.keySet().iterator();
|
||||
assertSame(keys[2], kit.next());
|
||||
|
@ -339,9 +339,9 @@ public class LRUMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
|
|||
assertEquals("a", map.value);
|
||||
assertEquals("C", map.entry.getKey()); // entry is reused
|
||||
assertEquals("c", map.entry.getValue()); // entry is reused
|
||||
assertEquals(false, map.containsKey("A"));
|
||||
assertEquals(true, map.containsKey("B"));
|
||||
assertEquals(true, map.containsKey("C"));
|
||||
assertFalse(map.containsKey("A"));
|
||||
assertTrue(map.containsKey("B"));
|
||||
assertTrue(map.containsKey("C"));
|
||||
}
|
||||
|
||||
static class MockLRUMapSubclass<K, V> extends LRUMap<K, V> {
|
||||
|
@ -377,9 +377,9 @@ public class LRUMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
|
|||
map.put((K) "C", (V) "c"); // should remove oldest, which is A=a, but this is blocked
|
||||
assertEquals(3, map.size());
|
||||
assertEquals(2, map.maxSize());
|
||||
assertEquals(true, map.containsKey("A"));
|
||||
assertEquals(true, map.containsKey("B"));
|
||||
assertEquals(true, map.containsKey("C"));
|
||||
assertTrue(map.containsKey("A"));
|
||||
assertTrue(map.containsKey("B"));
|
||||
assertTrue(map.containsKey("C"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -393,9 +393,9 @@ public class LRUMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
|
|||
map.put((K) "C", (V) "c"); // should remove oldest, which is A=a, but this is blocked
|
||||
assertEquals(3, map.size());
|
||||
assertEquals(2, map.maxSize());
|
||||
assertEquals(true, map.containsKey("A"));
|
||||
assertEquals(true, map.containsKey("B"));
|
||||
assertEquals(true, map.containsKey("C"));
|
||||
assertTrue(map.containsKey("A"));
|
||||
assertTrue(map.containsKey("B"));
|
||||
assertTrue(map.containsKey("C"));
|
||||
}
|
||||
|
||||
static class MockLRUMapSubclassBlocksRemove<K, V> extends LRUMap<K, V> {
|
||||
|
@ -425,9 +425,9 @@ public class LRUMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
|
|||
map.put((K) "C", (V) "c"); // should remove oldest, which is A=a but this is blocked - so advance to B=b
|
||||
assertEquals(2, map.size());
|
||||
assertEquals(2, map.maxSize());
|
||||
assertEquals(true, map.containsKey("A"));
|
||||
assertEquals(false, map.containsKey("B"));
|
||||
assertEquals(true, map.containsKey("C"));
|
||||
assertTrue(map.containsKey("A"));
|
||||
assertFalse(map.containsKey("B"));
|
||||
assertTrue(map.containsKey("C"));
|
||||
}
|
||||
|
||||
static class MockLRUMapSubclassFirstBlocksRemove<K, V> extends LRUMap<K, V> {
|
||||
|
@ -486,7 +486,7 @@ public class LRUMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
|
|||
|
||||
assertEquals(4, map.data.length);
|
||||
assertEquals(3, map.size);
|
||||
assertEquals(null, map.header.next);
|
||||
assertNull(map.header.next);
|
||||
assertEquals(one, map.header.after.key); // LRU
|
||||
assertEquals(two, map.header.after.after.key);
|
||||
assertEquals(three, map.header.after.after.after.key); // MRU
|
||||
|
@ -498,7 +498,7 @@ public class LRUMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
|
|||
|
||||
assertEquals(4, map.data.length);
|
||||
assertEquals(3, map.size);
|
||||
assertEquals(null, map.header.next);
|
||||
assertNull(map.header.next);
|
||||
assertEquals(two, map.header.after.key); // LRU
|
||||
assertEquals(three, map.header.after.after.key);
|
||||
assertEquals(four, map.header.after.after.after.key); // MRU
|
||||
|
@ -510,7 +510,7 @@ public class LRUMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
|
|||
|
||||
assertEquals(4, map.data.length);
|
||||
assertEquals(3, map.size);
|
||||
assertEquals(null, map.header.next);
|
||||
assertNull(map.header.next);
|
||||
assertEquals(two, map.header.after.key); // LRU
|
||||
assertEquals(four, map.header.after.after.key);
|
||||
assertEquals(three, map.header.after.after.after.key); // MRU
|
||||
|
@ -522,7 +522,7 @@ public class LRUMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
|
|||
|
||||
assertEquals(4, map.data.length);
|
||||
assertEquals(3, map.size);
|
||||
assertEquals(null, map.header.next);
|
||||
assertNull(map.header.next);
|
||||
assertEquals(four, map.header.after.key); // LRU
|
||||
assertEquals(three, map.header.after.after.key);
|
||||
assertEquals(five, map.header.after.after.after.key); // MRU
|
||||
|
@ -535,7 +535,7 @@ public class LRUMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
|
|||
|
||||
assertEquals(4, map.data.length);
|
||||
assertEquals(3, map.size);
|
||||
assertEquals(null, map.header.next);
|
||||
assertNull(map.header.next);
|
||||
assertEquals(four, map.header.after.key); // LRU
|
||||
assertEquals(three, map.header.after.after.key);
|
||||
assertEquals(five, map.header.after.after.after.key); // MRU
|
||||
|
@ -547,7 +547,7 @@ public class LRUMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
|
|||
|
||||
assertEquals(4, map.data.length);
|
||||
assertEquals(3, map.size);
|
||||
assertEquals(null, map.header.next);
|
||||
assertNull(map.header.next);
|
||||
assertEquals(three, map.header.after.key); // LRU
|
||||
assertEquals(five, map.header.after.after.key);
|
||||
assertEquals(six, map.header.after.after.after.key); // MRU
|
||||
|
|
|
@ -65,7 +65,7 @@ public class LazyMapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
|
||||
map = lazyMap(new HashMap<Integer, Number>(), FactoryUtils.<Long>nullFactory());
|
||||
final Object o = map.get("Five");
|
||||
assertEquals(null, o);
|
||||
assertNull(o);
|
||||
assertEquals(1, map.size());
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ public class LazySortedMapTest<K, V> extends AbstractSortedMapTest<K, V> {
|
|||
|
||||
map = lazySortedMap(new TreeMap<Integer, Number>(), FactoryUtils.<Number>nullFactory());
|
||||
final Number o = map.get(5);
|
||||
assertEquals(null, o);
|
||||
assertNull(o);
|
||||
assertEquals(1, map.size());
|
||||
|
||||
}
|
||||
|
@ -100,8 +100,7 @@ public class LazySortedMapTest<K, V> extends AbstractSortedMapTest<K, V> {
|
|||
"B", map.subMap("A", "C").lastKey());
|
||||
|
||||
final Comparator<?> c = map.comparator();
|
||||
assertTrue("natural order, so comparator should be null",
|
||||
c == null);
|
||||
assertNull("natural order, so comparator should be null", c);
|
||||
}
|
||||
|
||||
public void testReverseSortOrder() {
|
||||
|
@ -119,8 +118,7 @@ public class LazySortedMapTest<K, V> extends AbstractSortedMapTest<K, V> {
|
|||
"B", map.subMap("C", "A").lastKey());
|
||||
|
||||
final Comparator<?> c = map.comparator();
|
||||
assertTrue("natural order, so comparator should be null",
|
||||
c == reverseStringComparator);
|
||||
assertSame("natural order, so comparator should be null", c, reverseStringComparator);
|
||||
}
|
||||
|
||||
public void testTransformerDecorate() {
|
||||
|
|
|
@ -219,7 +219,7 @@ public class LinkedMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
|
|||
final Object value = lm.get(key);
|
||||
assertEquals(value, lm.remove(i));
|
||||
list.remove(i);
|
||||
assertEquals(false, lm.containsKey(key));
|
||||
assertFalse(lm.containsKey(key));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ public class ListOrderedMap2Test<K, V> extends AbstractOrderedMapTest<K, V> {
|
|||
final Object value = lom.get(key);
|
||||
assertEquals(value, lom.remove(i));
|
||||
list.remove(i);
|
||||
assertEquals(false, lom.containsKey(key));
|
||||
assertFalse(lom.containsKey(key));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ public class ListOrderedMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
|
|||
final Object value = lom.get(key);
|
||||
assertEquals(value, lom.remove(i));
|
||||
list.remove(i);
|
||||
assertEquals(false, lom.containsKey(key));
|
||||
assertFalse(lom.containsKey(key));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -116,18 +116,18 @@ public class MultiKeyMapTest<K, V> extends AbstractIterableMapTest<MultiKey<? ex
|
|||
@SuppressWarnings("unchecked")
|
||||
public void testNullHandling() {
|
||||
resetFull();
|
||||
assertEquals(null, map.get(null));
|
||||
assertEquals(false, map.containsKey(null));
|
||||
assertEquals(false, map.containsValue(null));
|
||||
assertEquals(null, map.remove(null));
|
||||
assertEquals(false, map.entrySet().contains(null));
|
||||
assertEquals(false, map.keySet().contains(null));
|
||||
assertEquals(false, map.values().contains(null));
|
||||
assertNull(map.get(null));
|
||||
assertFalse(map.containsKey(null));
|
||||
assertFalse(map.containsValue(null));
|
||||
assertNull(map.remove(null));
|
||||
assertFalse(map.entrySet().contains(null));
|
||||
assertFalse(map.keySet().contains(null));
|
||||
assertFalse(map.values().contains(null));
|
||||
try {
|
||||
map.put(null, null);
|
||||
fail();
|
||||
} catch (final NullPointerException ex) {}
|
||||
assertEquals(null, map.put(new MultiKey<K>(null, null), null));
|
||||
assertNull(map.put(new MultiKey<K>(null, null), null));
|
||||
try {
|
||||
map.put(null, (V) new Object());
|
||||
fail();
|
||||
|
@ -147,39 +147,39 @@ public class MultiKeyMapTest<K, V> extends AbstractIterableMapTest<MultiKey<? ex
|
|||
switch (key.size()) {
|
||||
case 2:
|
||||
assertEquals(value, multimap.get(key.getKey(0), key.getKey(1)));
|
||||
assertEquals(null, multimap.get(null, key.getKey(1)));
|
||||
assertEquals(null, multimap.get(key.getKey(0), null));
|
||||
assertEquals(null, multimap.get(null, null));
|
||||
assertEquals(null, multimap.get(key.getKey(0), key.getKey(1), null));
|
||||
assertEquals(null, multimap.get(key.getKey(0), key.getKey(1), null, null));
|
||||
assertEquals(null, multimap.get(key.getKey(0), key.getKey(1), null, null, null));
|
||||
assertNull(multimap.get(null, key.getKey(1)));
|
||||
assertNull(multimap.get(key.getKey(0), null));
|
||||
assertNull(multimap.get(null, null));
|
||||
assertNull(multimap.get(key.getKey(0), key.getKey(1), null));
|
||||
assertNull(multimap.get(key.getKey(0), key.getKey(1), null, null));
|
||||
assertNull(multimap.get(key.getKey(0), key.getKey(1), null, null, null));
|
||||
break;
|
||||
case 3:
|
||||
assertEquals(value, multimap.get(key.getKey(0), key.getKey(1), key.getKey(2)));
|
||||
assertEquals(null, multimap.get(null, key.getKey(1), key.getKey(2)));
|
||||
assertEquals(null, multimap.get(key.getKey(0), null, key.getKey(2)));
|
||||
assertEquals(null, multimap.get(key.getKey(0), key.getKey(1), null));
|
||||
assertEquals(null, multimap.get(null, null, null));
|
||||
assertEquals(null, multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), null));
|
||||
assertEquals(null, multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), null, null));
|
||||
assertNull(multimap.get(null, key.getKey(1), key.getKey(2)));
|
||||
assertNull(multimap.get(key.getKey(0), null, key.getKey(2)));
|
||||
assertNull(multimap.get(key.getKey(0), key.getKey(1), null));
|
||||
assertNull(multimap.get(null, null, null));
|
||||
assertNull(multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), null));
|
||||
assertNull(multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), null, null));
|
||||
break;
|
||||
case 4:
|
||||
assertEquals(value, multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
assertEquals(null, multimap.get(null, key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
assertEquals(null, multimap.get(key.getKey(0), null, key.getKey(2), key.getKey(3)));
|
||||
assertEquals(null, multimap.get(key.getKey(0), key.getKey(1), null, key.getKey(3)));
|
||||
assertEquals(null, multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), null));
|
||||
assertEquals(null, multimap.get(null, null, null, null));
|
||||
assertEquals(null, multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), null));
|
||||
assertNull(multimap.get(null, key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
assertNull(multimap.get(key.getKey(0), null, key.getKey(2), key.getKey(3)));
|
||||
assertNull(multimap.get(key.getKey(0), key.getKey(1), null, key.getKey(3)));
|
||||
assertNull(multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), null));
|
||||
assertNull(multimap.get(null, null, null, null));
|
||||
assertNull(multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), null));
|
||||
break;
|
||||
case 5:
|
||||
assertEquals(value, multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertEquals(null, multimap.get(null, key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertEquals(null, multimap.get(key.getKey(0), null, key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertEquals(null, multimap.get(key.getKey(0), key.getKey(1), null, key.getKey(3), key.getKey(4)));
|
||||
assertEquals(null, multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), null, key.getKey(4)));
|
||||
assertEquals(null, multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), null));
|
||||
assertEquals(null, multimap.get(null, null, null, null, null));
|
||||
assertNull(multimap.get(null, key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertNull(multimap.get(key.getKey(0), null, key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertNull(multimap.get(key.getKey(0), key.getKey(1), null, key.getKey(3), key.getKey(4)));
|
||||
assertNull(multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), null, key.getKey(4)));
|
||||
assertNull(multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), null));
|
||||
assertNull(multimap.get(null, null, null, null, null));
|
||||
break;
|
||||
default:
|
||||
fail("Invalid key size");
|
||||
|
@ -195,40 +195,40 @@ public class MultiKeyMapTest<K, V> extends AbstractIterableMapTest<MultiKey<? ex
|
|||
for (final MultiKey<K> key : keys) {
|
||||
switch (key.size()) {
|
||||
case 2:
|
||||
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1)));
|
||||
assertEquals(false, multimap.containsKey(null, key.getKey(1)));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), null));
|
||||
assertEquals(false, multimap.containsKey(null, null));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), null));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), null, null));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), null, null, null));
|
||||
assertTrue(multimap.containsKey(key.getKey(0), key.getKey(1)));
|
||||
assertFalse(multimap.containsKey(null, key.getKey(1)));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), null));
|
||||
assertFalse(multimap.containsKey(null, null));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), key.getKey(1), null));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), key.getKey(1), null, null));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), key.getKey(1), null, null, null));
|
||||
break;
|
||||
case 3:
|
||||
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2)));
|
||||
assertEquals(false, multimap.containsKey(null, key.getKey(1), key.getKey(2)));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), null, key.getKey(2)));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), null));
|
||||
assertEquals(false, multimap.containsKey(null, null, null));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), null));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), null, null));
|
||||
assertTrue(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2)));
|
||||
assertFalse(multimap.containsKey(null, key.getKey(1), key.getKey(2)));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), null, key.getKey(2)));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), key.getKey(1), null));
|
||||
assertFalse(multimap.containsKey(null, null, null));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), null));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), null, null));
|
||||
break;
|
||||
case 4:
|
||||
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
assertEquals(false, multimap.containsKey(null, key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), null, key.getKey(2), key.getKey(3)));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), null, key.getKey(3)));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), null));
|
||||
assertEquals(false, multimap.containsKey(null, null, null, null));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), null));
|
||||
assertTrue(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
assertFalse(multimap.containsKey(null, key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), null, key.getKey(2), key.getKey(3)));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), key.getKey(1), null, key.getKey(3)));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), null));
|
||||
assertFalse(multimap.containsKey(null, null, null, null));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), null));
|
||||
break;
|
||||
case 5:
|
||||
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertEquals(false, multimap.containsKey(null, key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), null, key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), null, key.getKey(3), key.getKey(4)));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), null, key.getKey(4)));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), null));
|
||||
assertEquals(false, multimap.containsKey(null, null, null, null, null));
|
||||
assertTrue(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertFalse(multimap.containsKey(null, key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), null, key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), key.getKey(1), null, key.getKey(3), key.getKey(4)));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), null, key.getKey(4)));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), null));
|
||||
assertFalse(multimap.containsKey(null, null, null, null, null));
|
||||
break;
|
||||
default:
|
||||
fail("Invalid key size");
|
||||
|
@ -248,48 +248,48 @@ public class MultiKeyMapTest<K, V> extends AbstractIterableMapTest<MultiKey<? ex
|
|||
|
||||
switch (key.size()) {
|
||||
case 2:
|
||||
assertEquals(null, multimap.put(key.getKey(0), key.getKey(1), value));
|
||||
assertNull(multimap.put(key.getKey(0), key.getKey(1), value));
|
||||
assertEquals(1, multimap.size());
|
||||
assertEquals(value, multimap.get(key.getKey(0), key.getKey(1)));
|
||||
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1)));
|
||||
assertEquals(true, multimap.containsKey(new MultiKey<>(key.getKey(0), key.getKey(1))));
|
||||
assertTrue(multimap.containsKey(key.getKey(0), key.getKey(1)));
|
||||
assertTrue(multimap.containsKey(new MultiKey<>(key.getKey(0), key.getKey(1))));
|
||||
assertEquals(value, multimap.put(key.getKey(0), key.getKey(1), null));
|
||||
assertEquals(1, multimap.size());
|
||||
assertEquals(null, multimap.get(key.getKey(0), key.getKey(1)));
|
||||
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1)));
|
||||
assertNull(multimap.get(key.getKey(0), key.getKey(1)));
|
||||
assertTrue(multimap.containsKey(key.getKey(0), key.getKey(1)));
|
||||
break;
|
||||
case 3:
|
||||
assertEquals(null, multimap.put(key.getKey(0), key.getKey(1), key.getKey(2), value));
|
||||
assertNull(multimap.put(key.getKey(0), key.getKey(1), key.getKey(2), value));
|
||||
assertEquals(1, multimap.size());
|
||||
assertEquals(value, multimap.get(key.getKey(0), key.getKey(1), key.getKey(2)));
|
||||
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2)));
|
||||
assertEquals(true, multimap.containsKey(new MultiKey<>(key.getKey(0), key.getKey(1), key.getKey(2))));
|
||||
assertTrue(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2)));
|
||||
assertTrue(multimap.containsKey(new MultiKey<>(key.getKey(0), key.getKey(1), key.getKey(2))));
|
||||
assertEquals(value, multimap.put(key.getKey(0), key.getKey(1), key.getKey(2), null));
|
||||
assertEquals(1, multimap.size());
|
||||
assertEquals(null, multimap.get(key.getKey(0), key.getKey(1), key.getKey(2)));
|
||||
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2)));
|
||||
assertNull(multimap.get(key.getKey(0), key.getKey(1), key.getKey(2)));
|
||||
assertTrue(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2)));
|
||||
break;
|
||||
case 4:
|
||||
assertEquals(null, multimap.put(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), value));
|
||||
assertNull(multimap.put(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), value));
|
||||
assertEquals(1, multimap.size());
|
||||
assertEquals(value, multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
assertEquals(true, multimap.containsKey(new MultiKey<>(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3))));
|
||||
assertTrue(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
assertTrue(multimap.containsKey(new MultiKey<>(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3))));
|
||||
assertEquals(value, multimap.put(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), null));
|
||||
assertEquals(1, multimap.size());
|
||||
assertEquals(null, multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
assertNull(multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
assertTrue(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
break;
|
||||
case 5:
|
||||
assertEquals(null, multimap.put(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4), value));
|
||||
assertNull(multimap.put(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4), value));
|
||||
assertEquals(1, multimap.size());
|
||||
assertEquals(value, multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertEquals(true, multimap.containsKey(new MultiKey<>(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4))));
|
||||
assertTrue(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertTrue(multimap.containsKey(new MultiKey<>(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4))));
|
||||
assertEquals(value, multimap.put(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4), null));
|
||||
assertEquals(1, multimap.size());
|
||||
assertEquals(null, multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertNull(multimap.get(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertTrue(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
break;
|
||||
default:
|
||||
fail("Invalid key size");
|
||||
|
@ -327,36 +327,36 @@ public class MultiKeyMapTest<K, V> extends AbstractIterableMapTest<MultiKey<? ex
|
|||
|
||||
switch (key.size()) {
|
||||
case 2:
|
||||
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1)));
|
||||
assertTrue(multimap.containsKey(key.getKey(0), key.getKey(1)));
|
||||
assertEquals(value, multimap.removeMultiKey(key.getKey(0), key.getKey(1)));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1)));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), key.getKey(1)));
|
||||
assertEquals(size - 1, multimap.size());
|
||||
assertEquals(null, multimap.removeMultiKey(key.getKey(0), key.getKey(1)));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1)));
|
||||
assertNull(multimap.removeMultiKey(key.getKey(0), key.getKey(1)));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), key.getKey(1)));
|
||||
break;
|
||||
case 3:
|
||||
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2)));
|
||||
assertTrue(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2)));
|
||||
assertEquals(value, multimap.removeMultiKey(key.getKey(0), key.getKey(1), key.getKey(2)));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2)));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2)));
|
||||
assertEquals(size - 1, multimap.size());
|
||||
assertEquals(null, multimap.removeMultiKey(key.getKey(0), key.getKey(1), key.getKey(2)));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2)));
|
||||
assertNull(multimap.removeMultiKey(key.getKey(0), key.getKey(1), key.getKey(2)));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2)));
|
||||
break;
|
||||
case 4:
|
||||
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
assertTrue(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
assertEquals(value, multimap.removeMultiKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
assertEquals(size - 1, multimap.size());
|
||||
assertEquals(null, multimap.removeMultiKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
assertNull(multimap.removeMultiKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3)));
|
||||
break;
|
||||
case 5:
|
||||
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertTrue(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertEquals(value, multimap.removeMultiKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertEquals(size - 1, multimap.size());
|
||||
assertEquals(null, multimap.removeMultiKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertEquals(false, multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertNull(multimap.removeMultiKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
assertFalse(multimap.containsKey(key.getKey(0), key.getKey(1), key.getKey(2), key.getKey(3), key.getKey(4)));
|
||||
break;
|
||||
default:
|
||||
fail("Invalid key size");
|
||||
|
@ -373,7 +373,7 @@ public class MultiKeyMapTest<K, V> extends AbstractIterableMapTest<MultiKey<? ex
|
|||
assertEquals(8, multimap.size());
|
||||
for (final MapIterator<MultiKey<? extends K>, V> it = multimap.mapIterator(); it.hasNext();) {
|
||||
final MultiKey<? extends K> key = it.next();
|
||||
assertEquals(false, I1.equals(key.getKey(0)));
|
||||
assertFalse(I1.equals(key.getKey(0)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,7 @@ public class MultiKeyMapTest<K, V> extends AbstractIterableMapTest<MultiKey<? ex
|
|||
assertEquals(9, multimap.size());
|
||||
for (final MapIterator<MultiKey<? extends K>, V> it = multimap.mapIterator(); it.hasNext();) {
|
||||
final MultiKey<? extends K> key = it.next();
|
||||
assertEquals(false, I2.equals(key.getKey(0)) && I3.equals(key.getKey(1)));
|
||||
assertFalse(I2.equals(key.getKey(0)) && I3.equals(key.getKey(1)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -399,7 +399,7 @@ public class MultiKeyMapTest<K, V> extends AbstractIterableMapTest<MultiKey<? ex
|
|||
assertEquals(9, multimap.size());
|
||||
for (final MapIterator<MultiKey<? extends K>, V> it = multimap.mapIterator(); it.hasNext();) {
|
||||
final MultiKey<? extends K> key = it.next();
|
||||
assertEquals(false, I1.equals(key.getKey(0)) && I1.equals(key.getKey(1)) && I2.equals(key.getKey(2)));
|
||||
assertFalse(I1.equals(key.getKey(0)) && I1.equals(key.getKey(1)) && I2.equals(key.getKey(2)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -412,7 +412,7 @@ public class MultiKeyMapTest<K, V> extends AbstractIterableMapTest<MultiKey<? ex
|
|||
assertEquals(10, multimap.size());
|
||||
for (final MapIterator<MultiKey<? extends K>, V> it = multimap.mapIterator(); it.hasNext();) {
|
||||
final MultiKey<? extends K> key = it.next();
|
||||
assertEquals(false, I1.equals(key.getKey(0)) && I1.equals(key.getKey(1)) && I2.equals(key.getKey(2)) && key.size() >= 4 && I3.equals(key.getKey(3)));
|
||||
assertFalse(I1.equals(key.getKey(0)) && I1.equals(key.getKey(1)) && I2.equals(key.getKey(2)) && key.size() >= 4 && I3.equals(key.getKey(3)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -433,19 +433,19 @@ public class MultiKeyMapTest<K, V> extends AbstractIterableMapTest<MultiKey<? ex
|
|||
assertEquals(2, map.size());
|
||||
map.put((K) I1, (K) I4, (V) "1-4");
|
||||
assertEquals(2, map.size());
|
||||
assertEquals(true, map.containsKey(I1, I3));
|
||||
assertEquals(true, map.containsKey(I1, I4));
|
||||
assertEquals(false, map.containsKey(I1, I2));
|
||||
assertTrue(map.containsKey(I1, I3));
|
||||
assertTrue(map.containsKey(I1, I4));
|
||||
assertFalse(map.containsKey(I1, I2));
|
||||
|
||||
final MultiKeyMap<K, V> cloned = map.clone();
|
||||
assertEquals(2, map.size());
|
||||
assertEquals(true, cloned.containsKey(I1, I3));
|
||||
assertEquals(true, cloned.containsKey(I1, I4));
|
||||
assertEquals(false, cloned.containsKey(I1, I2));
|
||||
assertTrue(cloned.containsKey(I1, I3));
|
||||
assertTrue(cloned.containsKey(I1, I4));
|
||||
assertFalse(cloned.containsKey(I1, I2));
|
||||
cloned.put((K) I1, (K) I5, (V) "1-5");
|
||||
assertEquals(2, cloned.size());
|
||||
assertEquals(true, cloned.containsKey(I1, I4));
|
||||
assertEquals(true, cloned.containsKey(I1, I5));
|
||||
assertTrue(cloned.containsKey(I1, I4));
|
||||
assertTrue(cloned.containsKey(I1, I5));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -259,22 +259,22 @@ public class MultiValueMapTest<K, V> extends AbstractObjectTest {
|
|||
@SuppressWarnings("unchecked")
|
||||
public void testIterator_Key() {
|
||||
final MultiValueMap<K, V> map = new MultiValueMap<>();
|
||||
assertEquals(false, map.iterator("A").hasNext());
|
||||
assertFalse(map.iterator("A").hasNext());
|
||||
map.put((K) "A", "AA");
|
||||
final Iterator<?> it = map.iterator("A");
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
it.next();
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testContainsValue_Key() {
|
||||
final MultiValueMap<K, V> map = new MultiValueMap<>();
|
||||
assertEquals(false, map.containsValue("A", "AA"));
|
||||
assertEquals(false, map.containsValue("B", "BB"));
|
||||
assertFalse(map.containsValue("A", "AA"));
|
||||
assertFalse(map.containsValue("B", "BB"));
|
||||
map.put((K) "A", "AA");
|
||||
assertEquals(true, map.containsValue("A", "AA"));
|
||||
assertEquals(false, map.containsValue("A", "AB"));
|
||||
assertTrue(map.containsValue("A", "AA"));
|
||||
assertFalse(map.containsValue("A", "AB"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -294,7 +294,7 @@ public class MultiValueMapTest<K, V> extends AbstractObjectTest {
|
|||
final MultiValueMap<K, V> test = MultiValueMap.multiValueMap(new HashMap<K, HashSet>(), HashSet.class);
|
||||
assertEquals("a", test.put((K) "A", "a"));
|
||||
assertEquals("b", test.put((K) "A", "b"));
|
||||
assertEquals(null, test.put((K) "A", "a"));
|
||||
assertNull(test.put((K) "A", "a"));
|
||||
assertEquals(1, test.size());
|
||||
assertEquals(2, test.size("A"));
|
||||
assertEquals(2, test.totalSize());
|
||||
|
@ -315,10 +315,10 @@ public class MultiValueMapTest<K, V> extends AbstractObjectTest {
|
|||
assertEquals(4, test.totalSize());
|
||||
assertEquals(1, test.getCollection("keyA").size());
|
||||
assertEquals(3, test.getCollection("key").size());
|
||||
assertEquals(true, test.containsValue("objectA"));
|
||||
assertEquals(true, test.containsValue("object0"));
|
||||
assertEquals(true, test.containsValue("object1"));
|
||||
assertEquals(true, test.containsValue("object2"));
|
||||
assertTrue(test.containsValue("objectA"));
|
||||
assertTrue(test.containsValue("object0"));
|
||||
assertTrue(test.containsValue("object1"));
|
||||
assertTrue(test.containsValue("object2"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -337,10 +337,10 @@ public class MultiValueMapTest<K, V> extends AbstractObjectTest {
|
|||
assertEquals(1, test.getCollection("keyA").size());
|
||||
assertEquals(2, test.getCollection("keyX").size());
|
||||
assertEquals(1, test.getCollection("keyY").size());
|
||||
assertEquals(true, test.containsValue("objectA"));
|
||||
assertEquals(true, test.containsValue("object0"));
|
||||
assertEquals(true, test.containsValue("object1"));
|
||||
assertEquals(true, test.containsValue("object2"));
|
||||
assertTrue(test.containsValue("objectA"));
|
||||
assertTrue(test.containsValue("object0"));
|
||||
assertTrue(test.containsValue("object1"));
|
||||
assertTrue(test.containsValue("object2"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -348,31 +348,31 @@ public class MultiValueMapTest<K, V> extends AbstractObjectTest {
|
|||
final MultiValueMap<K, V> map = new MultiValueMap<>();
|
||||
Collection<V> coll = (Collection<V>) Arrays.asList("X", "Y", "Z");
|
||||
|
||||
assertEquals(true, map.putAll((K) "A", coll));
|
||||
assertTrue(map.putAll((K) "A", coll));
|
||||
assertEquals(3, map.size("A"));
|
||||
assertEquals(true, map.containsValue("A", "X"));
|
||||
assertEquals(true, map.containsValue("A", "Y"));
|
||||
assertEquals(true, map.containsValue("A", "Z"));
|
||||
assertTrue(map.containsValue("A", "X"));
|
||||
assertTrue(map.containsValue("A", "Y"));
|
||||
assertTrue(map.containsValue("A", "Z"));
|
||||
|
||||
assertEquals(false, map.putAll((K) "A", null));
|
||||
assertFalse(map.putAll((K) "A", null));
|
||||
assertEquals(3, map.size("A"));
|
||||
assertEquals(true, map.containsValue("A", "X"));
|
||||
assertEquals(true, map.containsValue("A", "Y"));
|
||||
assertEquals(true, map.containsValue("A", "Z"));
|
||||
assertTrue(map.containsValue("A", "X"));
|
||||
assertTrue(map.containsValue("A", "Y"));
|
||||
assertTrue(map.containsValue("A", "Z"));
|
||||
|
||||
assertEquals(false, map.putAll((K) "A", new ArrayList<V>()));
|
||||
assertFalse(map.putAll((K) "A", new ArrayList<V>()));
|
||||
assertEquals(3, map.size("A"));
|
||||
assertEquals(true, map.containsValue("A", "X"));
|
||||
assertEquals(true, map.containsValue("A", "Y"));
|
||||
assertEquals(true, map.containsValue("A", "Z"));
|
||||
assertTrue(map.containsValue("A", "X"));
|
||||
assertTrue(map.containsValue("A", "Y"));
|
||||
assertTrue(map.containsValue("A", "Z"));
|
||||
|
||||
coll = (Collection<V>) Arrays.asList("M");
|
||||
assertEquals(true, map.putAll((K) "A", coll));
|
||||
assertTrue(map.putAll((K) "A", coll));
|
||||
assertEquals(4, map.size("A"));
|
||||
assertEquals(true, map.containsValue("A", "X"));
|
||||
assertEquals(true, map.containsValue("A", "Y"));
|
||||
assertEquals(true, map.containsValue("A", "Z"));
|
||||
assertEquals(true, map.containsValue("A", "M"));
|
||||
assertTrue(map.containsValue("A", "X"));
|
||||
assertTrue(map.containsValue("A", "Y"));
|
||||
assertTrue(map.containsValue("A", "Z"));
|
||||
assertTrue(map.containsValue("A", "M"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -381,11 +381,11 @@ public class MultiValueMapTest<K, V> extends AbstractObjectTest {
|
|||
map.put((K) "A", "AA");
|
||||
map.put((K) "A", "AB");
|
||||
map.put((K) "A", "AC");
|
||||
assertEquals(false, map.removeMapping("C", "CA"));
|
||||
assertEquals(false, map.removeMapping("A", "AD"));
|
||||
assertEquals(true, map.removeMapping("A", "AC"));
|
||||
assertEquals(true, map.removeMapping("A", "AB"));
|
||||
assertEquals(true, map.removeMapping("A", "AA"));
|
||||
assertFalse(map.removeMapping("C", "CA"));
|
||||
assertFalse(map.removeMapping("A", "AD"));
|
||||
assertTrue(map.removeMapping("A", "AC"));
|
||||
assertTrue(map.removeMapping("A", "AB"));
|
||||
assertTrue(map.removeMapping("A", "AA"));
|
||||
assertEquals(new MultiValueMap<K, V>(), map);
|
||||
}
|
||||
|
||||
|
|
|
@ -57,12 +57,10 @@ public class PredicatedMapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
@SuppressWarnings("unchecked")
|
||||
public void testEntrySet() {
|
||||
Map<K, V> map = makeTestMap();
|
||||
assertTrue("returned entryset should not be null",
|
||||
map.entrySet() != null);
|
||||
assertNotNull("returned entryset should not be null", map.entrySet());
|
||||
map = decorateMap(new HashMap<K, V>(), null, null);
|
||||
map.put((K) "oneKey", (V) "oneValue");
|
||||
assertTrue("returned entryset should contain one entry",
|
||||
map.entrySet().size() == 1);
|
||||
assertEquals("returned entryset should contain one entry", 1, map.entrySet().size());
|
||||
map = decorateMap(map, null, null);
|
||||
}
|
||||
|
||||
|
@ -83,8 +81,8 @@ public class PredicatedMapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
// expected
|
||||
}
|
||||
|
||||
assertTrue(!map.containsKey(Integer.valueOf(3)));
|
||||
assertTrue(!map.containsValue(Integer.valueOf(3)));
|
||||
assertFalse(map.containsKey(Integer.valueOf(3)));
|
||||
assertFalse(map.containsValue(Integer.valueOf(3)));
|
||||
|
||||
final Map<K, V> map2 = new HashMap<>();
|
||||
map2.put((K) "A", (V) "a");
|
||||
|
|
|
@ -85,12 +85,10 @@ public class PredicatedSortedMapTest<K, V> extends AbstractSortedMapTest<K, V> {
|
|||
@SuppressWarnings("unchecked")
|
||||
public void testEntrySet() {
|
||||
SortedMap<K, V> map = makeTestMap();
|
||||
assertTrue("returned entryset should not be null",
|
||||
map.entrySet() != null);
|
||||
assertNotNull("returned entryset should not be null", map.entrySet());
|
||||
map = decorateMap(new TreeMap<K, V>(), null, null);
|
||||
map.put((K) "oneKey", (V) "oneValue");
|
||||
assertTrue("returned entryset should contain one entry",
|
||||
map.entrySet().size() == 1);
|
||||
assertEquals("returned entryset should contain one entry", 1, map.entrySet().size());
|
||||
map = decorateMap(map, null, null);
|
||||
}
|
||||
|
||||
|
@ -111,8 +109,8 @@ public class PredicatedSortedMapTest<K, V> extends AbstractSortedMapTest<K, V> {
|
|||
// expected
|
||||
}
|
||||
|
||||
assertTrue(!map.containsKey(Integer.valueOf(3)));
|
||||
assertTrue(!map.containsValue(Integer.valueOf(3)));
|
||||
assertFalse(map.containsKey(Integer.valueOf(3)));
|
||||
assertFalse(map.containsValue(Integer.valueOf(3)));
|
||||
|
||||
final Map<K, V> map2 = new HashMap<>();
|
||||
map2.put((K) "A", (V) "a");
|
||||
|
@ -172,8 +170,7 @@ public class PredicatedSortedMapTest<K, V> extends AbstractSortedMapTest<K, V> {
|
|||
"B", map.subMap((K) "A", (K) "C").lastKey());
|
||||
|
||||
final Comparator<? super K> c = map.comparator();
|
||||
assertTrue("natural order, so comparator should be null",
|
||||
c == null);
|
||||
assertNull("natural order, so comparator should be null", c);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -204,8 +201,7 @@ public class PredicatedSortedMapTest<K, V> extends AbstractSortedMapTest<K, V> {
|
|||
"B", map.subMap((K) "C", (K) "A").lastKey());
|
||||
|
||||
final Comparator<? super K> c = map.comparator();
|
||||
assertTrue("reverse order, so comparator should be reverseStringComparator",
|
||||
c == reverseStringComparator);
|
||||
assertSame("reverse order, so comparator should be reverseStringComparator", c, reverseStringComparator);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -235,28 +235,28 @@ public class ReferenceIdentityMapTest<K, V> extends AbstractIterableMapTest<K, V
|
|||
assertEquals(1, map.size());
|
||||
assertSame(I2A, map.get(I1A));
|
||||
assertSame(null, map.get(I1B));
|
||||
assertEquals(true, map.containsKey(I1A));
|
||||
assertEquals(false, map.containsKey(I1B));
|
||||
assertEquals(true, map.containsValue(I2A));
|
||||
assertEquals(false, map.containsValue(I2B));
|
||||
assertTrue(map.containsKey(I1A));
|
||||
assertFalse(map.containsKey(I1B));
|
||||
assertTrue(map.containsValue(I2A));
|
||||
assertFalse(map.containsValue(I2B));
|
||||
|
||||
map.put((K) I1A, (V) I2B);
|
||||
assertEquals(1, map.size());
|
||||
assertSame(I2B, map.get(I1A));
|
||||
assertSame(null, map.get(I1B));
|
||||
assertEquals(true, map.containsKey(I1A));
|
||||
assertEquals(false, map.containsKey(I1B));
|
||||
assertEquals(false, map.containsValue(I2A));
|
||||
assertEquals(true, map.containsValue(I2B));
|
||||
assertTrue(map.containsKey(I1A));
|
||||
assertFalse(map.containsKey(I1B));
|
||||
assertFalse(map.containsValue(I2A));
|
||||
assertTrue(map.containsValue(I2B));
|
||||
|
||||
map.put((K) I1B, (V) I2B);
|
||||
assertEquals(2, map.size());
|
||||
assertSame(I2B, map.get(I1A));
|
||||
assertSame(I2B, map.get(I1B));
|
||||
assertEquals(true, map.containsKey(I1A));
|
||||
assertEquals(true, map.containsKey(I1B));
|
||||
assertEquals(false, map.containsValue(I2A));
|
||||
assertEquals(true, map.containsValue(I2B));
|
||||
assertTrue(map.containsKey(I1A));
|
||||
assertTrue(map.containsKey(I1B));
|
||||
assertFalse(map.containsValue(I2A));
|
||||
assertTrue(map.containsValue(I2B));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -271,21 +271,21 @@ public class ReferenceIdentityMapTest<K, V> extends AbstractIterableMapTest<K, V
|
|||
final Map.Entry<K, V> entry2 = it.next();
|
||||
final Map.Entry<K, V> entry3 = it.next();
|
||||
|
||||
assertEquals(true, entry1.equals(entry2));
|
||||
assertEquals(true, entry2.equals(entry1));
|
||||
assertEquals(false, entry1.equals(entry3));
|
||||
assertTrue(entry1.equals(entry2));
|
||||
assertTrue(entry2.equals(entry1));
|
||||
assertFalse(entry1.equals(entry3));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testNullHandling() {
|
||||
resetFull();
|
||||
assertEquals(null, getMap().get(null));
|
||||
assertEquals(false, getMap().containsKey(null));
|
||||
assertEquals(false, getMap().containsValue(null));
|
||||
assertEquals(null, getMap().remove(null));
|
||||
assertEquals(false, getMap().entrySet().contains(null));
|
||||
assertEquals(false, getMap().keySet().contains(null));
|
||||
assertEquals(false, getMap().values().contains(null));
|
||||
assertNull(getMap().get(null));
|
||||
assertFalse(getMap().containsKey(null));
|
||||
assertFalse(getMap().containsValue(null));
|
||||
assertNull(getMap().remove(null));
|
||||
assertFalse(getMap().entrySet().contains(null));
|
||||
assertFalse(getMap().keySet().contains(null));
|
||||
assertFalse(getMap().values().contains(null));
|
||||
try {
|
||||
getMap().put(null, null);
|
||||
fail();
|
||||
|
|
|
@ -83,13 +83,13 @@ public class ReferenceMapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
@SuppressWarnings("unchecked")
|
||||
public void testNullHandling() {
|
||||
resetFull();
|
||||
assertEquals(null, map.get(null));
|
||||
assertEquals(false, map.containsKey(null));
|
||||
assertEquals(false, map.containsValue(null));
|
||||
assertEquals(null, map.remove(null));
|
||||
assertEquals(false, map.entrySet().contains(null));
|
||||
assertEquals(false, map.keySet().contains(null));
|
||||
assertEquals(false, map.values().contains(null));
|
||||
assertNull(map.get(null));
|
||||
assertFalse(map.containsKey(null));
|
||||
assertFalse(map.containsValue(null));
|
||||
assertNull(map.remove(null));
|
||||
assertFalse(map.entrySet().contains(null));
|
||||
assertFalse(map.keySet().contains(null));
|
||||
assertFalse(map.values().contains(null));
|
||||
try {
|
||||
map.put(null, null);
|
||||
fail();
|
||||
|
|
|
@ -98,8 +98,8 @@ public class SingletonMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
|
|||
assertEquals(1, map.size());
|
||||
final SingletonMap<K, V> cloned = map.clone();
|
||||
assertEquals(1, cloned.size());
|
||||
assertEquals(true, cloned.containsKey(ONE));
|
||||
assertEquals(true, cloned.containsValue(TWO));
|
||||
assertTrue(cloned.containsKey(ONE));
|
||||
assertTrue(cloned.containsValue(TWO));
|
||||
}
|
||||
|
||||
public void testKeyValue() {
|
||||
|
@ -113,7 +113,7 @@ public class SingletonMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
|
|||
public void testBoundedMap() {
|
||||
final SingletonMap<K, V> map = makeFullMap();
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(true, map.isFull());
|
||||
assertTrue(map.isFull());
|
||||
assertEquals(1, map.maxSize());
|
||||
assertTrue(map instanceof BoundedMap);
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public class StaticBucketMapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
// loop so we find a string that is in the same bucket as the null
|
||||
for (int i = 'A'; i <= 'Z'; i++) {
|
||||
final String str = String.valueOf((char) i);
|
||||
assertEquals("String: " + str, null, map.get(str));
|
||||
assertNull("String: " + str, map.get(str));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,11 +76,11 @@ public class StaticBucketMapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
public void test_containsKey_nullMatchesIncorrectly() {
|
||||
final StaticBucketMap<K, V> map = new StaticBucketMap<>(17);
|
||||
map.put(null, (V) "A");
|
||||
assertEquals(true, map.containsKey(null));
|
||||
assertTrue(map.containsKey(null));
|
||||
// loop so we find a string that is in the same bucket as the null
|
||||
for (int i = 'A'; i <= 'Z'; i++) {
|
||||
final String str = String.valueOf((char) i);
|
||||
assertEquals("String: " + str, false, map.containsKey(str));
|
||||
assertFalse("String: " + str, map.containsKey(str));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,11 +88,11 @@ public class StaticBucketMapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
public void test_containsValue_nullMatchesIncorrectly() {
|
||||
final StaticBucketMap<K, V> map = new StaticBucketMap<>(17);
|
||||
map.put((K) "A", null);
|
||||
assertEquals(true, map.containsValue(null));
|
||||
assertTrue(map.containsValue(null));
|
||||
// loop so we find a string that is in the same bucket as the null
|
||||
for (int i = 'A'; i <= 'Z'; i++) {
|
||||
final String str = String.valueOf((char) i);
|
||||
assertEquals("String: " + str, false, map.containsValue(str));
|
||||
assertFalse("String: " + str, map.containsValue(str));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,13 +56,13 @@ public class TransformedMapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
for (int i = 0; i < els.length; i++) {
|
||||
map.put((K) els[i], (V) els[i]);
|
||||
assertEquals(i + 1, map.size());
|
||||
assertEquals(true, map.containsKey(Integer.valueOf((String) els[i])));
|
||||
assertEquals(false, map.containsKey(els[i]));
|
||||
assertEquals(true, map.containsValue(els[i]));
|
||||
assertTrue(map.containsKey(Integer.valueOf((String) els[i])));
|
||||
assertFalse(map.containsKey(els[i]));
|
||||
assertTrue(map.containsValue(els[i]));
|
||||
assertEquals(els[i], map.get(Integer.valueOf((String) els[i])));
|
||||
}
|
||||
|
||||
assertEquals(null, map.remove(els[0]));
|
||||
assertNull(map.remove(els[0]));
|
||||
assertEquals(els[0], map.remove(Integer.valueOf((String) els[0])));
|
||||
|
||||
map = TransformedMap.transformingMap(new HashMap(), null,
|
||||
|
@ -72,9 +72,9 @@ public class TransformedMapTest<K, V> extends AbstractIterableMapTest<K, V> {
|
|||
for (int i = 0; i < els.length; i++) {
|
||||
map.put((K) els[i], (V) els[i]);
|
||||
assertEquals(i + 1, map.size());
|
||||
assertEquals(true, map.containsValue(Integer.valueOf((String) els[i])));
|
||||
assertEquals(false, map.containsValue(els[i]));
|
||||
assertEquals(true, map.containsKey(els[i]));
|
||||
assertTrue(map.containsValue(Integer.valueOf((String) els[i])));
|
||||
assertFalse(map.containsValue(els[i]));
|
||||
assertTrue(map.containsKey(els[i]));
|
||||
assertEquals(Integer.valueOf((String) els[i]), map.get(els[i]));
|
||||
}
|
||||
|
||||
|
|
|
@ -76,12 +76,12 @@ public class TransformedSortedMapTest<K, V> extends AbstractSortedMapTest<K, V>
|
|||
for (int i = 0; i < els.length; i++) {
|
||||
map.put((K) els[i], (V) els[i]);
|
||||
assertEquals(i + 1, map.size());
|
||||
assertEquals(true, map.containsKey(Integer.valueOf((String) els[i])));
|
||||
assertTrue(map.containsKey(Integer.valueOf((String) els[i])));
|
||||
try {
|
||||
map.containsKey(els[i]);
|
||||
fail();
|
||||
} catch (final ClassCastException ex) {}
|
||||
assertEquals(true, map.containsValue(els[i]));
|
||||
assertTrue(map.containsValue(els[i]));
|
||||
assertEquals(els[i], map.get(Integer.valueOf((String) els[i])));
|
||||
}
|
||||
|
||||
|
@ -100,9 +100,9 @@ public class TransformedSortedMapTest<K, V> extends AbstractSortedMapTest<K, V>
|
|||
for (int i = 0; i < els.length; i++) {
|
||||
map.put((K) els[i], (V) els[i]);
|
||||
assertEquals(i + 1, map.size());
|
||||
assertEquals(true, map.containsValue(Integer.valueOf((String) els[i])));
|
||||
assertEquals(false, map.containsValue(els[i]));
|
||||
assertEquals(true, map.containsKey(els[i]));
|
||||
assertTrue(map.containsValue(Integer.valueOf((String) els[i])));
|
||||
assertFalse(map.containsValue(els[i]));
|
||||
assertTrue(map.containsKey(els[i]));
|
||||
assertEquals(Integer.valueOf((String) els[i]), map.get(els[i]));
|
||||
}
|
||||
|
||||
|
|
|
@ -531,14 +531,14 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
|
|||
@SuppressWarnings("unchecked")
|
||||
public void testContainsValue_Key() {
|
||||
final MultiValuedMap<K, V> map = makeFullMap();
|
||||
assertEquals(true, map.containsMapping("one", "uno"));
|
||||
assertEquals(false, map.containsMapping("two", "2"));
|
||||
assertTrue(map.containsMapping("one", "uno"));
|
||||
assertFalse(map.containsMapping("two", "2"));
|
||||
if (!isAddSupported()) {
|
||||
return;
|
||||
}
|
||||
map.put((K) "A", (V) "AA");
|
||||
assertEquals(true, map.containsMapping("A", "AA"));
|
||||
assertEquals(false, map.containsMapping("A", "AB"));
|
||||
assertTrue(map.containsMapping("A", "AA"));
|
||||
assertFalse(map.containsMapping("A", "AB"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -567,10 +567,10 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
|
|||
assertEquals(4, test.size());
|
||||
assertEquals(1, test.get((K) "keyA").size());
|
||||
assertEquals(3, test.get((K) "key").size());
|
||||
assertEquals(true, test.containsValue("objectA"));
|
||||
assertEquals(true, test.containsValue("object0"));
|
||||
assertEquals(true, test.containsValue("object1"));
|
||||
assertEquals(true, test.containsValue("object2"));
|
||||
assertTrue(test.containsValue("objectA"));
|
||||
assertTrue(test.containsValue("object0"));
|
||||
assertTrue(test.containsValue("object1"));
|
||||
assertTrue(test.containsValue("object2"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -600,10 +600,10 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
|
|||
assertEquals(1, test.get((K) "keyA").size());
|
||||
assertEquals(2, test.get((K) "keyX").size());
|
||||
assertEquals(1, test.get((K) "keyY").size());
|
||||
assertEquals(true, test.containsValue("objectA"));
|
||||
assertEquals(true, test.containsValue("object0"));
|
||||
assertEquals(true, test.containsValue("object1"));
|
||||
assertEquals(true, test.containsValue("object2"));
|
||||
assertTrue(test.containsValue("objectA"));
|
||||
assertTrue(test.containsValue("object0"));
|
||||
assertTrue(test.containsValue("object1"));
|
||||
assertTrue(test.containsValue("object2"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -614,11 +614,11 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
|
|||
final MultiValuedMap<K, V> map = makeObject();
|
||||
Collection<V> coll = (Collection<V>) Arrays.asList("X", "Y", "Z");
|
||||
|
||||
assertEquals(true, map.putAll((K) "A", coll));
|
||||
assertTrue(map.putAll((K) "A", coll));
|
||||
assertEquals(3, map.get((K) "A").size());
|
||||
assertEquals(true, map.containsMapping("A", "X"));
|
||||
assertEquals(true, map.containsMapping("A", "Y"));
|
||||
assertEquals(true, map.containsMapping("A", "Z"));
|
||||
assertTrue(map.containsMapping("A", "X"));
|
||||
assertTrue(map.containsMapping("A", "Y"));
|
||||
assertTrue(map.containsMapping("A", "Z"));
|
||||
|
||||
try {
|
||||
map.putAll((K) "A", null);
|
||||
|
@ -628,23 +628,23 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
|
|||
}
|
||||
|
||||
assertEquals(3, map.get((K) "A").size());
|
||||
assertEquals(true, map.containsMapping("A", "X"));
|
||||
assertEquals(true, map.containsMapping("A", "Y"));
|
||||
assertEquals(true, map.containsMapping("A", "Z"));
|
||||
assertTrue(map.containsMapping("A", "X"));
|
||||
assertTrue(map.containsMapping("A", "Y"));
|
||||
assertTrue(map.containsMapping("A", "Z"));
|
||||
|
||||
assertEquals(false, map.putAll((K) "A", new ArrayList<V>()));
|
||||
assertFalse(map.putAll((K) "A", new ArrayList<V>()));
|
||||
assertEquals(3, map.get((K) "A").size());
|
||||
assertEquals(true, map.containsMapping("A", "X"));
|
||||
assertEquals(true, map.containsMapping("A", "Y"));
|
||||
assertEquals(true, map.containsMapping("A", "Z"));
|
||||
assertTrue(map.containsMapping("A", "X"));
|
||||
assertTrue(map.containsMapping("A", "Y"));
|
||||
assertTrue(map.containsMapping("A", "Z"));
|
||||
|
||||
coll = (Collection<V>) Arrays.asList("M");
|
||||
assertEquals(true, map.putAll((K) "A", coll));
|
||||
assertTrue(map.putAll((K) "A", coll));
|
||||
assertEquals(4, map.get((K) "A").size());
|
||||
assertEquals(true, map.containsMapping("A", "X"));
|
||||
assertEquals(true, map.containsMapping("A", "Y"));
|
||||
assertEquals(true, map.containsMapping("A", "Z"));
|
||||
assertEquals(true, map.containsMapping("A", "M"));
|
||||
assertTrue(map.containsMapping("A", "X"));
|
||||
assertTrue(map.containsMapping("A", "Y"));
|
||||
assertTrue(map.containsMapping("A", "Z"));
|
||||
assertTrue(map.containsMapping("A", "M"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -656,11 +656,11 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
|
|||
map.put((K) "A", (V) "AA");
|
||||
map.put((K) "A", (V) "AB");
|
||||
map.put((K) "A", (V) "AC");
|
||||
assertEquals(false, map.removeMapping("C", "CA"));
|
||||
assertEquals(false, map.removeMapping("A", "AD"));
|
||||
assertEquals(true, map.removeMapping("A", "AC"));
|
||||
assertEquals(true, map.removeMapping("A", "AB"));
|
||||
assertEquals(true, map.removeMapping("A", "AA"));
|
||||
assertFalse(map.removeMapping("C", "CA"));
|
||||
assertFalse(map.removeMapping("A", "AD"));
|
||||
assertTrue(map.removeMapping("A", "AC"));
|
||||
assertTrue(map.removeMapping("A", "AB"));
|
||||
assertTrue(map.removeMapping("A", "AA"));
|
||||
//assertEquals(new MultiValuedHashMap<K, V>(), map);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,16 +61,16 @@ public class TransformedMultiValuedMapTest<K, V> extends AbstractMultiValuedMapT
|
|||
for (int i = 0; i < els.length; i++) {
|
||||
map.put((K) els[i], (V) els[i]);
|
||||
assertEquals(i + 1, map.size());
|
||||
assertEquals(true, map.containsKey(Integer.valueOf((String) els[i])));
|
||||
assertEquals(false, map.containsKey(els[i]));
|
||||
assertEquals(true, map.containsValue(els[i]));
|
||||
assertEquals(true, map.get((K) Integer.valueOf((String) els[i])).contains(els[i]));
|
||||
assertTrue(map.containsKey(Integer.valueOf((String) els[i])));
|
||||
assertFalse(map.containsKey(els[i]));
|
||||
assertTrue(map.containsValue(els[i]));
|
||||
assertTrue(map.get((K) Integer.valueOf((String) els[i])).contains(els[i]));
|
||||
}
|
||||
|
||||
final Collection<V> coll = map.remove(els[0]);
|
||||
assertNotNull(coll);
|
||||
assertEquals(0, coll.size());
|
||||
assertEquals(true, map.remove(Integer.valueOf((String) els[0])).contains(els[0]));
|
||||
assertTrue(map.remove(Integer.valueOf((String) els[0])).contains(els[0]));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -84,12 +84,12 @@ public class TransformedMultiValuedMapTest<K, V> extends AbstractMultiValuedMapT
|
|||
for (int i = 0; i < els.length; i++) {
|
||||
map.put((K) els[i], (V) els[i]);
|
||||
assertEquals(i + 1, map.size());
|
||||
assertEquals(true, map.containsValue(Integer.valueOf((String) els[i])));
|
||||
assertEquals(false, map.containsValue(els[i]));
|
||||
assertEquals(true, map.containsKey(els[i]));
|
||||
assertEquals(true, map.get((K) els[i]).contains(Integer.valueOf((String) els[i])));
|
||||
assertTrue(map.containsValue(Integer.valueOf((String) els[i])));
|
||||
assertFalse(map.containsValue(els[i]));
|
||||
assertTrue(map.containsKey(els[i]));
|
||||
assertTrue(map.get((K) els[i]).contains(Integer.valueOf((String) els[i])));
|
||||
}
|
||||
assertEquals(true, map.remove(els[0]).contains(Integer.valueOf((String) els[0])));
|
||||
assertTrue(map.remove(els[0]).contains(Integer.valueOf((String) els[0])));
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
@ -106,11 +106,11 @@ public class TransformedMultiValuedMapTest<K, V> extends AbstractMultiValuedMapT
|
|||
null,
|
||||
(Transformer<? super V, ? extends V>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||
assertEquals(3, trans.size());
|
||||
assertEquals(true, trans.get((K) "A").contains("1"));
|
||||
assertEquals(true, trans.get((K) "B").contains("2"));
|
||||
assertEquals(true, trans.get((K) "C").contains("3"));
|
||||
assertTrue(trans.get((K) "A").contains("1"));
|
||||
assertTrue(trans.get((K) "B").contains("2"));
|
||||
assertTrue(trans.get((K) "C").contains("3"));
|
||||
trans.put((K) "D", (V) "4");
|
||||
assertEquals(true, trans.get((K) "D").contains(Integer.valueOf(4)));
|
||||
assertTrue(trans.get((K) "D").contains(Integer.valueOf(4)));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -126,11 +126,11 @@ public class TransformedMultiValuedMapTest<K, V> extends AbstractMultiValuedMapT
|
|||
null,
|
||||
(Transformer<? super V, ? extends V>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||
assertEquals(3, trans.size());
|
||||
assertEquals(true, trans.get((K) "A").contains(Integer.valueOf(1)));
|
||||
assertEquals(true, trans.get((K) "B").contains(Integer.valueOf(2)));
|
||||
assertEquals(true, trans.get((K) "C").contains(Integer.valueOf(3)));
|
||||
assertTrue(trans.get((K) "A").contains(Integer.valueOf(1)));
|
||||
assertTrue(trans.get((K) "B").contains(Integer.valueOf(2)));
|
||||
assertTrue(trans.get((K) "C").contains(Integer.valueOf(3)));
|
||||
trans.put((K) "D", (V) "4");
|
||||
assertEquals(true, trans.get((K) "D").contains(Integer.valueOf(4)));
|
||||
assertTrue(trans.get((K) "D").contains(Integer.valueOf(4)));
|
||||
|
||||
final MultiValuedMap<K, V> baseMap = new ArrayListValuedHashMap<>();
|
||||
final MultiValuedMap<K, V> transMap = TransformedMultiValuedMap
|
||||
|
@ -141,7 +141,7 @@ public class TransformedMultiValuedMapTest<K, V> extends AbstractMultiValuedMapT
|
|||
assertEquals(0, transMap.size());
|
||||
transMap.put((K) "D", (V) "4");
|
||||
assertEquals(1, transMap.size());
|
||||
assertEquals(true, transMap.get((K) "D").contains(Integer.valueOf(4)));
|
||||
assertTrue(transMap.get((K) "D").contains(Integer.valueOf(4)));
|
||||
}
|
||||
|
||||
// public void testCreate() throws Exception {
|
||||
|
|
|
@ -147,18 +147,18 @@ public abstract class AbstractMultiSetTest<T> extends AbstractCollectionTest<T>
|
|||
@SuppressWarnings("unchecked")
|
||||
public void testMultiSetEqualsSelf() {
|
||||
final MultiSet<T> multiset = makeObject();
|
||||
assertTrue(multiset.equals(multiset));
|
||||
assertEquals(multiset, multiset);
|
||||
|
||||
if (!isAddSupported()) {
|
||||
return;
|
||||
}
|
||||
|
||||
multiset.add((T) "elt");
|
||||
assertTrue(multiset.equals(multiset));
|
||||
assertEquals(multiset, multiset);
|
||||
multiset.add((T) "elt"); // again
|
||||
assertTrue(multiset.equals(multiset));
|
||||
assertEquals(multiset, multiset);
|
||||
multiset.add((T) "elt2");
|
||||
assertTrue(multiset.equals(multiset));
|
||||
assertEquals(multiset, multiset);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -215,20 +215,20 @@ public abstract class AbstractMultiSetTest<T> extends AbstractCollectionTest<T>
|
|||
|
||||
final MultiSet<T> multiset = makeObject();
|
||||
|
||||
assertEquals("MultiSet does not have at least 1 'A'", false, multiset.contains("A"));
|
||||
assertEquals("MultiSet does not have at least 1 'B'", false, multiset.contains("B"));
|
||||
assertFalse("MultiSet does not have at least 1 'A'", multiset.contains("A"));
|
||||
assertFalse("MultiSet does not have at least 1 'B'", multiset.contains("B"));
|
||||
|
||||
multiset.add((T) "A"); // multiset 1A
|
||||
assertEquals("MultiSet has at least 1 'A'", true, multiset.contains("A"));
|
||||
assertEquals("MultiSet does not have at least 1 'B'", false, multiset.contains("B"));
|
||||
assertTrue("MultiSet has at least 1 'A'", multiset.contains("A"));
|
||||
assertFalse("MultiSet does not have at least 1 'B'", multiset.contains("B"));
|
||||
|
||||
multiset.add((T) "A"); // multiset 2A
|
||||
assertEquals("MultiSet has at least 1 'A'", true, multiset.contains("A"));
|
||||
assertEquals("MultiSet does not have at least 1 'B'", false, multiset.contains("B"));
|
||||
assertTrue("MultiSet has at least 1 'A'", multiset.contains("A"));
|
||||
assertFalse("MultiSet does not have at least 1 'B'", multiset.contains("B"));
|
||||
|
||||
multiset.add((T) "B"); // multiset 2A,1B
|
||||
assertEquals("MultiSet has at least 1 'A'", true, multiset.contains("A"));
|
||||
assertEquals("MultiSet has at least 1 'B'", true, multiset.contains("B"));
|
||||
assertTrue("MultiSet has at least 1 'A'", multiset.contains("A"));
|
||||
assertTrue("MultiSet has at least 1 'B'", multiset.contains("B"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -250,39 +250,39 @@ public abstract class AbstractMultiSetTest<T> extends AbstractCollectionTest<T>
|
|||
known1A1B.add("A");
|
||||
known1A1B.add("B");
|
||||
|
||||
assertEquals("MultiSet containsAll of empty", true, multiset.containsAll(known));
|
||||
assertEquals("MultiSet does not containsAll of 1 'A'", false, multiset.containsAll(known1A));
|
||||
assertEquals("MultiSet does not containsAll of 2 'A'", false, multiset.containsAll(known2A));
|
||||
assertEquals("MultiSet does not containsAll of 1 'B'", false, multiset.containsAll(known1B));
|
||||
assertEquals("MultiSet does not containsAll of 1 'A' 1 'B'", false, multiset.containsAll(known1A1B));
|
||||
assertTrue("MultiSet containsAll of empty", multiset.containsAll(known));
|
||||
assertFalse("MultiSet does not containsAll of 1 'A'", multiset.containsAll(known1A));
|
||||
assertFalse("MultiSet does not containsAll of 2 'A'", multiset.containsAll(known2A));
|
||||
assertFalse("MultiSet does not containsAll of 1 'B'", multiset.containsAll(known1B));
|
||||
assertFalse("MultiSet does not containsAll of 1 'A' 1 'B'", multiset.containsAll(known1A1B));
|
||||
|
||||
multiset.add((T) "A"); // multiset 1A
|
||||
assertEquals("MultiSet containsAll of empty", true, multiset.containsAll(known));
|
||||
assertEquals("MultiSet containsAll of 1 'A'", true, multiset.containsAll(known1A));
|
||||
assertEquals("MultiSet does not containsAll 'A'", true, multiset.containsAll(known2A));
|
||||
assertEquals("MultiSet does not containsAll of 1 'B'", false, multiset.containsAll(known1B));
|
||||
assertEquals("MultiSet does not containsAll of 1 'A' 1 'B'", false, multiset.containsAll(known1A1B));
|
||||
assertTrue("MultiSet containsAll of empty", multiset.containsAll(known));
|
||||
assertTrue("MultiSet containsAll of 1 'A'", multiset.containsAll(known1A));
|
||||
assertTrue("MultiSet does not containsAll 'A'", multiset.containsAll(known2A));
|
||||
assertFalse("MultiSet does not containsAll of 1 'B'", multiset.containsAll(known1B));
|
||||
assertFalse("MultiSet does not containsAll of 1 'A' 1 'B'", multiset.containsAll(known1A1B));
|
||||
|
||||
multiset.add((T) "A"); // multiset 2A
|
||||
assertEquals("MultiSet containsAll of empty", true, multiset.containsAll(known));
|
||||
assertEquals("MultiSet containsAll of 1 'A'", true, multiset.containsAll(known1A));
|
||||
assertEquals("MultiSet containsAll of 2 'A'", true, multiset.containsAll(known2A));
|
||||
assertEquals("MultiSet does not containsAll of 1 'B'", false, multiset.containsAll(known1B));
|
||||
assertEquals("MultiSet does not containsAll of 1 'A' 1 'B'", false, multiset.containsAll(known1A1B));
|
||||
assertTrue("MultiSet containsAll of empty", multiset.containsAll(known));
|
||||
assertTrue("MultiSet containsAll of 1 'A'", multiset.containsAll(known1A));
|
||||
assertTrue("MultiSet containsAll of 2 'A'", multiset.containsAll(known2A));
|
||||
assertFalse("MultiSet does not containsAll of 1 'B'", multiset.containsAll(known1B));
|
||||
assertFalse("MultiSet does not containsAll of 1 'A' 1 'B'", multiset.containsAll(known1A1B));
|
||||
|
||||
multiset.add((T) "A"); // multiset 3A
|
||||
assertEquals("MultiSet containsAll of empty", true, multiset.containsAll(known));
|
||||
assertEquals("MultiSet containsAll of 1 'A'", true, multiset.containsAll(known1A));
|
||||
assertEquals("MultiSet containsAll of 2 'A'", true, multiset.containsAll(known2A));
|
||||
assertEquals("MultiSet does not containsAll of 1 'B'", false, multiset.containsAll(known1B));
|
||||
assertEquals("MultiSet does not containsAll of 1 'A' 1 'B'", false, multiset.containsAll(known1A1B));
|
||||
assertTrue("MultiSet containsAll of empty", multiset.containsAll(known));
|
||||
assertTrue("MultiSet containsAll of 1 'A'", multiset.containsAll(known1A));
|
||||
assertTrue("MultiSet containsAll of 2 'A'", multiset.containsAll(known2A));
|
||||
assertFalse("MultiSet does not containsAll of 1 'B'", multiset.containsAll(known1B));
|
||||
assertFalse("MultiSet does not containsAll of 1 'A' 1 'B'", multiset.containsAll(known1A1B));
|
||||
|
||||
multiset.add((T) "B"); // multiset 3A1B
|
||||
assertEquals("MultiSet containsAll of empty", true, multiset.containsAll(known));
|
||||
assertEquals("MultiSet containsAll of 1 'A'", true, multiset.containsAll(known1A));
|
||||
assertEquals("MultiSet containsAll of 2 'A'", true, multiset.containsAll(known2A));
|
||||
assertEquals("MultiSet containsAll of 1 'B'", true, multiset.containsAll(known1B));
|
||||
assertEquals("MultiSet containsAll of 1 'A' 1 'B'", true, multiset.containsAll(known1A1B));
|
||||
assertTrue("MultiSet containsAll of empty", multiset.containsAll(known));
|
||||
assertTrue("MultiSet containsAll of 1 'A'", multiset.containsAll(known1A));
|
||||
assertTrue("MultiSet containsAll of 2 'A'", multiset.containsAll(known2A));
|
||||
assertTrue("MultiSet containsAll of 1 'B'", multiset.containsAll(known1B));
|
||||
assertTrue("MultiSet containsAll of 1 'A' 1 'B'", multiset.containsAll(known1A1B));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -444,18 +444,18 @@ public abstract class AbstractMultiSetTest<T> extends AbstractCollectionTest<T>
|
|||
assertEquals(2, multiset.size());
|
||||
final Iterator<T> it = multiset.iterator();
|
||||
assertEquals("A", it.next());
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
it.remove();
|
||||
assertEquals(1, multiset.size());
|
||||
assertEquals(true, it.hasNext());
|
||||
assertTrue(it.hasNext());
|
||||
assertEquals("A", it.next());
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
it.remove();
|
||||
assertEquals(0, multiset.size());
|
||||
assertEquals(false, it.hasNext());
|
||||
assertFalse(it.hasNext());
|
||||
|
||||
final Iterator<T> it2 = multiset.iterator();
|
||||
assertEquals(false, it2.hasNext());
|
||||
assertFalse(it2.hasNext());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -530,11 +530,11 @@ public abstract class AbstractMultiSetTest<T> extends AbstractCollectionTest<T>
|
|||
|
||||
final MultiSet<T> multiset = makeObject();
|
||||
final MultiSet<T> multiset2 = makeObject();
|
||||
assertEquals(true, multiset.equals(multiset2));
|
||||
assertTrue(multiset.equals(multiset2));
|
||||
multiset.add((T) "A");
|
||||
assertEquals(false, multiset.equals(multiset2));
|
||||
assertFalse(multiset.equals(multiset2));
|
||||
multiset2.add((T) "A");
|
||||
assertEquals(true, multiset.equals(multiset2));
|
||||
assertTrue(multiset.equals(multiset2));
|
||||
multiset.add((T) "A");
|
||||
multiset.add((T) "B");
|
||||
multiset.add((T) "B");
|
||||
|
@ -543,7 +543,7 @@ public abstract class AbstractMultiSetTest<T> extends AbstractCollectionTest<T>
|
|||
multiset2.add((T) "B");
|
||||
multiset2.add((T) "B");
|
||||
multiset2.add((T) "C");
|
||||
assertEquals(true, multiset.equals(multiset2));
|
||||
assertTrue(multiset.equals(multiset2));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -554,11 +554,11 @@ public abstract class AbstractMultiSetTest<T> extends AbstractCollectionTest<T>
|
|||
|
||||
final MultiSet<T> multiset = makeObject();
|
||||
final MultiSet<T> multiset2 = new HashMultiSet<>();
|
||||
assertEquals(true, multiset.equals(multiset2));
|
||||
assertTrue(multiset.equals(multiset2));
|
||||
multiset.add((T) "A");
|
||||
assertEquals(false, multiset.equals(multiset2));
|
||||
assertFalse(multiset.equals(multiset2));
|
||||
multiset2.add((T) "A");
|
||||
assertEquals(true, multiset.equals(multiset2));
|
||||
assertTrue(multiset.equals(multiset2));
|
||||
multiset.add((T) "A");
|
||||
multiset.add((T) "B");
|
||||
multiset.add((T) "B");
|
||||
|
@ -567,7 +567,7 @@ public abstract class AbstractMultiSetTest<T> extends AbstractCollectionTest<T>
|
|||
multiset2.add((T) "B");
|
||||
multiset2.add((T) "B");
|
||||
multiset2.add((T) "C");
|
||||
assertEquals(true, multiset.equals(multiset2));
|
||||
assertTrue(multiset.equals(multiset2));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -72,11 +72,11 @@ public class PredicatedMultiSetTest<T> extends AbstractMultiSetTest<T> {
|
|||
for (int i = 0; i < els.length; i++) {
|
||||
multiset.add(els[i]);
|
||||
assertEquals(i + 1, multiset.size());
|
||||
assertEquals(true, multiset.contains(els[i]));
|
||||
assertTrue(multiset.contains(els[i]));
|
||||
}
|
||||
Set<T> set = ((PredicatedMultiSet<T>) multiset).uniqueSet();
|
||||
assertTrue("Unique set contains the first element", set.contains(els[0]));
|
||||
assertEquals(true, multiset.remove(els[0]));
|
||||
assertTrue(multiset.remove(els[0]));
|
||||
set = ((PredicatedMultiSet<T>) multiset).uniqueSet();
|
||||
assertTrue("Unique set does not contain anymore the first element",
|
||||
set.contains(els[0]));
|
||||
|
@ -92,8 +92,7 @@ public class PredicatedMultiSetTest<T> extends AbstractMultiSetTest<T> {
|
|||
} catch (final IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
assertTrue("Collection shouldn't contain illegal element",
|
||||
!multiset.contains(i));
|
||||
assertFalse("Collection shouldn't contain illegal element", multiset.contains(i));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
@ -95,14 +96,14 @@ public class EmptyPropertiesTest {
|
|||
|
||||
@Test
|
||||
public void testEquals() {
|
||||
assertTrue(PropertiesFactory.EMPTY_PROPERTIES.equals(PropertiesFactory.EMPTY_PROPERTIES));
|
||||
assertTrue(PropertiesFactory.EMPTY_PROPERTIES.equals(new Properties()));
|
||||
assertTrue(new Properties().equals(PropertiesFactory.EMPTY_PROPERTIES));
|
||||
assertFalse(PropertiesFactory.EMPTY_PROPERTIES.equals(null));
|
||||
assertEquals(PropertiesFactory.EMPTY_PROPERTIES, PropertiesFactory.EMPTY_PROPERTIES);
|
||||
assertEquals(PropertiesFactory.EMPTY_PROPERTIES, new Properties());
|
||||
assertEquals(new Properties(), PropertiesFactory.EMPTY_PROPERTIES);
|
||||
assertNotEquals(null, PropertiesFactory.EMPTY_PROPERTIES);
|
||||
final Properties p = new Properties();
|
||||
p.put("Key", "Value");
|
||||
assertFalse(PropertiesFactory.EMPTY_PROPERTIES.equals(p));
|
||||
assertFalse(p.equals(PropertiesFactory.EMPTY_PROPERTIES));
|
||||
assertNotEquals(PropertiesFactory.EMPTY_PROPERTIES, p);
|
||||
assertNotEquals(p, PropertiesFactory.EMPTY_PROPERTIES);
|
||||
}
|
||||
|
||||
public void testForEach() {
|
||||
|
|
|
@ -116,16 +116,16 @@ public class CircularFifoQueueTest<E> extends AbstractQueueTest<E> {
|
|||
list.add((E) "C");
|
||||
final Queue<E> queue = new CircularFifoQueue<>(list);
|
||||
|
||||
assertEquals(true, queue.contains("A"));
|
||||
assertEquals(true, queue.contains("B"));
|
||||
assertEquals(true, queue.contains("C"));
|
||||
assertTrue(queue.contains("A"));
|
||||
assertTrue(queue.contains("B"));
|
||||
assertTrue(queue.contains("C"));
|
||||
|
||||
queue.add((E) "D");
|
||||
|
||||
assertEquals(false, queue.contains("A"));
|
||||
assertEquals(true, queue.contains("B"));
|
||||
assertEquals(true, queue.contains("C"));
|
||||
assertEquals(true, queue.contains("D"));
|
||||
assertFalse(queue.contains("A"));
|
||||
assertTrue(queue.contains("B"));
|
||||
assertTrue(queue.contains("C"));
|
||||
assertTrue(queue.contains("D"));
|
||||
|
||||
assertEquals("B", queue.peek());
|
||||
assertEquals("B", queue.remove());
|
||||
|
@ -369,7 +369,7 @@ public class CircularFifoQueueTest<E> extends AbstractQueueTest<E> {
|
|||
final CircularFifoQueue<E> b = new CircularFifoQueue<>(2);
|
||||
b.add((E) "a");
|
||||
assertEquals(1, b.size());
|
||||
assertEquals(true, b.contains("a"));
|
||||
assertTrue(b.contains("a"));
|
||||
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
new ObjectOutputStream(bos).writeObject(b);
|
||||
|
@ -378,11 +378,11 @@ public class CircularFifoQueueTest<E> extends AbstractQueueTest<E> {
|
|||
new ByteArrayInputStream(bos.toByteArray())).readObject();
|
||||
|
||||
assertEquals(1, b2.size());
|
||||
assertEquals(true, b2.contains("a"));
|
||||
assertTrue(b2.contains("a"));
|
||||
b2.add((E) "b");
|
||||
assertEquals(2, b2.size());
|
||||
assertEquals(true, b2.contains("a"));
|
||||
assertEquals(true, b2.contains("b"));
|
||||
assertTrue(b2.contains("a"));
|
||||
assertTrue(b2.contains("b"));
|
||||
|
||||
bos = new ByteArrayOutputStream();
|
||||
new ObjectOutputStream(bos).writeObject(b2);
|
||||
|
@ -391,12 +391,12 @@ public class CircularFifoQueueTest<E> extends AbstractQueueTest<E> {
|
|||
new ByteArrayInputStream(bos.toByteArray())).readObject();
|
||||
|
||||
assertEquals(2, b3.size());
|
||||
assertEquals(true, b3.contains("a"));
|
||||
assertEquals(true, b3.contains("b"));
|
||||
assertTrue(b3.contains("a"));
|
||||
assertTrue(b3.contains("b"));
|
||||
b3.add((E) "c");
|
||||
assertEquals(2, b3.size());
|
||||
assertEquals(true, b3.contains("b"));
|
||||
assertEquals(true, b3.contains("c"));
|
||||
assertTrue(b3.contains("b"));
|
||||
assertTrue(b3.contains("c"));
|
||||
}
|
||||
|
||||
public void testGetIndex() {
|
||||
|
|
|
@ -69,12 +69,12 @@ public class TransformedQueueTest<E> extends AbstractQueueTest<E> {
|
|||
for (int i = 0; i < elements.length; i++) {
|
||||
queue.add(elements[i]);
|
||||
assertEquals(i + 1, queue.size());
|
||||
assertEquals(true, queue.contains(Integer.valueOf((String) elements[i])));
|
||||
assertEquals(false, queue.contains(elements[i]));
|
||||
assertTrue(queue.contains(Integer.valueOf((String) elements[i])));
|
||||
assertFalse(queue.contains(elements[i]));
|
||||
}
|
||||
|
||||
assertEquals(false, queue.remove(elements[0]));
|
||||
assertEquals(true, queue.remove(Integer.valueOf((String) elements[0])));
|
||||
assertFalse(queue.remove(elements[0]));
|
||||
assertTrue(queue.remove(Integer.valueOf((String) elements[0])));
|
||||
|
||||
}
|
||||
|
||||
|
@ -87,12 +87,12 @@ public class TransformedQueueTest<E> extends AbstractQueueTest<E> {
|
|||
TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||
assertEquals(elements.length, queue.size());
|
||||
for (final Object el : elements) {
|
||||
assertEquals(true, queue.contains(Integer.valueOf((String) el)));
|
||||
assertEquals(false, queue.contains(el));
|
||||
assertTrue(queue.contains(Integer.valueOf((String) el)));
|
||||
assertFalse(queue.contains(el));
|
||||
}
|
||||
|
||||
assertEquals(false, queue.remove(elements[0]));
|
||||
assertEquals(true, queue.remove(Integer.valueOf((String) elements[0])));
|
||||
assertFalse(queue.remove(elements[0]));
|
||||
assertTrue(queue.remove(Integer.valueOf((String) elements[0])));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -146,7 +146,7 @@ public abstract class AbstractSetTest<E> extends AbstractCollectionTest<E> {
|
|||
|
||||
final Collection<E> set2 = makeConfirmedCollection();
|
||||
set2.add((E) "foo");
|
||||
assertTrue("Empty set shouldn't equal nonempty set", !getCollection().equals(set2));
|
||||
assertFalse("Empty set shouldn't equal nonempty set", getCollection().equals(set2));
|
||||
|
||||
resetFull();
|
||||
assertEquals("Full sets should be equal", getCollection(), getConfirmed());
|
||||
|
@ -154,7 +154,7 @@ public abstract class AbstractSetTest<E> extends AbstractCollectionTest<E> {
|
|||
|
||||
set2.clear();
|
||||
set2.addAll(Arrays.asList(getOtherElements()));
|
||||
assertTrue("Sets with different contents shouldn't be equal", !getCollection().equals(set2));
|
||||
assertFalse("Sets with different contents shouldn't be equal", getCollection().equals(set2));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -149,7 +149,7 @@ public class CompositeSetTest<E> extends AbstractSetTest<E> {
|
|||
set.addComposited(null, null, null);
|
||||
final CompositeSet<E> set2 = new CompositeSet<>(buildOne());
|
||||
set2.addComposited(buildTwo());
|
||||
assertTrue(set.equals(set2));
|
||||
assertEquals(set, set2);
|
||||
final HashSet<E> set3 = new HashSet<>();
|
||||
set3.add((E) "1");
|
||||
set3.add((E) "2");
|
||||
|
@ -158,7 +158,7 @@ public class CompositeSetTest<E> extends AbstractSetTest<E> {
|
|||
set4.add((E) "4");
|
||||
final CompositeSet<E> set5 = new CompositeSet<>(set3);
|
||||
set5.addComposited(set4);
|
||||
assertTrue(set.equals(set5));
|
||||
assertEquals(set, set5);
|
||||
try {
|
||||
set.addComposited(set3);
|
||||
fail("Expecting UnsupportedOperationException.");
|
||||
|
|
|
@ -69,7 +69,7 @@ public class PredicatedNavigableSetTest<E> extends AbstractNavigableSetTest<E> {
|
|||
|
||||
public void testGetSet() {
|
||||
final PredicatedNavigableSet<E> set = makeTestSet();
|
||||
assertTrue("returned set should not be null", set.decorated() != null);
|
||||
assertNotNull("returned set should not be null", set.decorated());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -82,7 +82,7 @@ public class PredicatedNavigableSetTest<E> extends AbstractNavigableSetTest<E> {
|
|||
} catch (final IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
assertTrue("Collection shouldn't contain illegal element", !set.contains(testString));
|
||||
assertFalse("Collection shouldn't contain illegal element", set.contains(testString));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -99,16 +99,16 @@ public class PredicatedNavigableSetTest<E> extends AbstractNavigableSetTest<E> {
|
|||
} catch (final IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
assertTrue("Set shouldn't contain illegal element", !set.contains("Aone"));
|
||||
assertTrue("Set shouldn't contain illegal element", !set.contains("Atwo"));
|
||||
assertTrue("Set shouldn't contain illegal element", !set.contains("Bthree"));
|
||||
assertTrue("Set shouldn't contain illegal element", !set.contains("Afour"));
|
||||
assertFalse("Set shouldn't contain illegal element", set.contains("Aone"));
|
||||
assertFalse("Set shouldn't contain illegal element", set.contains("Atwo"));
|
||||
assertFalse("Set shouldn't contain illegal element", set.contains("Bthree"));
|
||||
assertFalse("Set shouldn't contain illegal element", set.contains("Afour"));
|
||||
}
|
||||
|
||||
public void testComparator() {
|
||||
final NavigableSet<E> set = makeTestSet();
|
||||
final Comparator<? super E> c = set.comparator();
|
||||
assertTrue("natural order, so comparator should be null", c == null);
|
||||
assertNull("natural order, so comparator should be null", c);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -64,7 +64,7 @@ public class PredicatedSetTest<E> extends AbstractSetTest<E> {
|
|||
|
||||
public void testGetSet() {
|
||||
final PredicatedSet<E> set = makeTestSet();
|
||||
assertTrue("returned set should not be null", set.decorated() != null);
|
||||
assertNotNull("returned set should not be null", set.decorated());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -77,7 +77,7 @@ public class PredicatedSetTest<E> extends AbstractSetTest<E> {
|
|||
} catch (final IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
assertTrue("Collection shouldn't contain illegal element", !set.contains(i));
|
||||
assertFalse("Collection shouldn't contain illegal element", set.contains(i));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -94,10 +94,10 @@ public class PredicatedSetTest<E> extends AbstractSetTest<E> {
|
|||
} catch (final IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
assertTrue("Set shouldn't contain illegal element", !set.contains("one"));
|
||||
assertTrue("Set shouldn't contain illegal element", !set.contains("two"));
|
||||
assertTrue("Set shouldn't contain illegal element", !set.contains(Integer.valueOf(3)));
|
||||
assertTrue("Set shouldn't contain illegal element", !set.contains("four"));
|
||||
assertFalse("Set shouldn't contain illegal element", set.contains("one"));
|
||||
assertFalse("Set shouldn't contain illegal element", set.contains("two"));
|
||||
assertFalse("Set shouldn't contain illegal element", set.contains(Integer.valueOf(3)));
|
||||
assertFalse("Set shouldn't contain illegal element", set.contains("four"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -66,7 +66,7 @@ public class PredicatedSortedSetTest<E> extends AbstractSortedSetTest<E> {
|
|||
|
||||
public void testGetSet() {
|
||||
final PredicatedSortedSet<E> set = makeTestSet();
|
||||
assertTrue("returned set should not be null", set.decorated() != null);
|
||||
assertNotNull("returned set should not be null", set.decorated());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -79,7 +79,7 @@ public class PredicatedSortedSetTest<E> extends AbstractSortedSetTest<E> {
|
|||
} catch (final IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
assertTrue("Collection shouldn't contain illegal element", !set.contains(testString));
|
||||
assertFalse("Collection shouldn't contain illegal element", set.contains(testString));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -96,16 +96,16 @@ public class PredicatedSortedSetTest<E> extends AbstractSortedSetTest<E> {
|
|||
} catch (final IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
assertTrue("Set shouldn't contain illegal element", !set.contains("Aone"));
|
||||
assertTrue("Set shouldn't contain illegal element", !set.contains("Atwo"));
|
||||
assertTrue("Set shouldn't contain illegal element", !set.contains("Bthree"));
|
||||
assertTrue("Set shouldn't contain illegal element", !set.contains("Afour"));
|
||||
assertFalse("Set shouldn't contain illegal element", set.contains("Aone"));
|
||||
assertFalse("Set shouldn't contain illegal element", set.contains("Atwo"));
|
||||
assertFalse("Set shouldn't contain illegal element", set.contains("Bthree"));
|
||||
assertFalse("Set shouldn't contain illegal element", set.contains("Afour"));
|
||||
}
|
||||
|
||||
public void testComparator() {
|
||||
final SortedSet<E> set = makeTestSet();
|
||||
final Comparator<? super E> c = set.comparator();
|
||||
assertTrue("natural order, so comparator should be null", c == null);
|
||||
assertNull("natural order, so comparator should be null", c);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -68,10 +68,10 @@ public class TransformedNavigableSetTest<E> extends AbstractNavigableSetTest<E>
|
|||
for (int i = 0; i < els.length; i++) {
|
||||
set.add(els[i]);
|
||||
assertEquals(i + 1, set.size());
|
||||
assertEquals(true, set.contains(Integer.valueOf((String) els[i])));
|
||||
assertTrue(set.contains(Integer.valueOf((String) els[i])));
|
||||
}
|
||||
|
||||
assertEquals(true, set.remove(Integer.valueOf((String) els[0])));
|
||||
assertTrue(set.remove(Integer.valueOf((String) els[0])));
|
||||
}
|
||||
|
||||
public void testTransformedSet_decorateTransform() {
|
||||
|
@ -82,10 +82,10 @@ public class TransformedNavigableSetTest<E> extends AbstractNavigableSetTest<E>
|
|||
TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||
assertEquals(els.length, set.size());
|
||||
for (final Object el : els) {
|
||||
assertEquals(true, set.contains(Integer.valueOf((String) el)));
|
||||
assertTrue(set.contains(Integer.valueOf((String) el)));
|
||||
}
|
||||
|
||||
assertEquals(true, set.remove(Integer.valueOf((String) els[0])));
|
||||
assertTrue(set.remove(Integer.valueOf((String) els[0])));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -70,12 +70,12 @@ public class TransformedSetTest<E> extends AbstractSetTest<E> {
|
|||
for (int i = 0; i < els.length; i++) {
|
||||
set.add(els[i]);
|
||||
assertEquals(i + 1, set.size());
|
||||
assertEquals(true, set.contains(Integer.valueOf((String) els[i])));
|
||||
assertEquals(false, set.contains(els[i]));
|
||||
assertTrue(set.contains(Integer.valueOf((String) els[i])));
|
||||
assertFalse(set.contains(els[i]));
|
||||
}
|
||||
|
||||
assertEquals(false, set.remove(els[0]));
|
||||
assertEquals(true, set.remove(Integer.valueOf((String) els[0])));
|
||||
assertFalse(set.remove(els[0]));
|
||||
assertTrue(set.remove(Integer.valueOf((String) els[0])));
|
||||
|
||||
}
|
||||
|
||||
|
@ -86,12 +86,12 @@ public class TransformedSetTest<E> extends AbstractSetTest<E> {
|
|||
final Set<?> set = TransformedSet.transformedSet(originalSet, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||
assertEquals(els.length, set.size());
|
||||
for (final Object el : els) {
|
||||
assertEquals(true, set.contains(Integer.valueOf((String) el)));
|
||||
assertEquals(false, set.contains(el));
|
||||
assertTrue(set.contains(Integer.valueOf((String) el)));
|
||||
assertFalse(set.contains(el));
|
||||
}
|
||||
|
||||
assertEquals(false, set.remove(els[0]));
|
||||
assertEquals(true, set.remove(Integer.valueOf((String) els[0])));
|
||||
assertFalse(set.remove(els[0]));
|
||||
assertTrue(set.remove(Integer.valueOf((String) els[0])));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -66,10 +66,10 @@ public class TransformedSortedSetTest<E> extends AbstractSortedSetTest<E> {
|
|||
for (int i = 0; i < els.length; i++) {
|
||||
set.add(els[i]);
|
||||
assertEquals(i + 1, set.size());
|
||||
assertEquals(true, set.contains(Integer.valueOf((String) els[i])));
|
||||
assertTrue(set.contains(Integer.valueOf((String) els[i])));
|
||||
}
|
||||
|
||||
assertEquals(true, set.remove(Integer.valueOf((String) els[0])));
|
||||
assertTrue(set.remove(Integer.valueOf((String) els[0])));
|
||||
}
|
||||
|
||||
public void testTransformedSet_decorateTransform() {
|
||||
|
@ -79,10 +79,10 @@ public class TransformedSortedSetTest<E> extends AbstractSortedSetTest<E> {
|
|||
final Set<?> set = TransformedSet.transformedSet(originalSet, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
|
||||
assertEquals(els.length, set.size());
|
||||
for (final Object el : els) {
|
||||
assertEquals(true, set.contains(Integer.valueOf((String) el)));
|
||||
assertTrue(set.contains(Integer.valueOf((String) el)));
|
||||
}
|
||||
|
||||
assertEquals(true, set.remove(Integer.valueOf((String) els[0])));
|
||||
assertTrue(set.remove(Integer.valueOf((String) els[0])));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -143,7 +143,7 @@ public class UnmodifiableSortedSetTest<E> extends AbstractSortedSetTest<E> {
|
|||
public void testComparator() {
|
||||
setupSet();
|
||||
final Comparator<? super E> c = set.comparator();
|
||||
assertTrue("natural order, so comparator should be null", c == null);
|
||||
assertNull("natural order, so comparator should be null", c);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ public class TransformedSplitMapTest extends BulkTest {
|
|||
}
|
||||
|
||||
int sz = map.size();
|
||||
assertEquals(null, map.remove(k[0]));
|
||||
assertNull(map.remove(k[0]));
|
||||
assertEquals(sz, map.size());
|
||||
assertEquals(objectToClass.transform(v[0]), map.remove(intToString.transform(k[0])));
|
||||
assertEquals(--sz, map.size());
|
||||
|
|
Loading…
Reference in New Issue