From 03e5b0ee3bd2c92c87982143a180acc517059422 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 1 Sep 2024 19:08:34 -0400 Subject: [PATCH] Use Assertions.assertInstanceOf() --- .../commons/collections4/BagUtilsTest.java | 18 +++++++++--------- .../collections4/CollectionUtilsTest.java | 9 +++++---- .../commons/collections4/ListUtilsTest.java | 3 ++- .../commons/collections4/MapUtilsTest.java | 9 +++++---- .../commons/collections4/QueueUtilsTest.java | 11 ++++++----- .../commons/collections4/SetUtilsTest.java | 3 ++- .../collections4/SplitMapUtilsTest.java | 3 ++- .../commons/collections4/TrieUtilsTest.java | 4 ++-- .../comparators/AbstractComparatorTest.java | 4 ++-- .../keyvalue/UnmodifiableMapEntryTest.java | 4 ++-- .../collections4/map/LazySortedMapTest.java | 4 ++-- .../collections4/map/SingletonMapTest.java | 5 +++-- 12 files changed, 42 insertions(+), 35 deletions(-) diff --git a/src/test/java/org/apache/commons/collections4/BagUtilsTest.java b/src/test/java/org/apache/commons/collections4/BagUtilsTest.java index 1218470c4b..7de5425c2d 100644 --- a/src/test/java/org/apache/commons/collections4/BagUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/BagUtilsTest.java @@ -17,9 +17,9 @@ package org.apache.commons.collections4; import static org.junit.jupiter.api.Assertions.assertAll; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; import org.apache.commons.collections4.bag.HashBag; import org.apache.commons.collections4.bag.PredicatedBag; @@ -45,7 +45,7 @@ public class BagUtilsTest { @Test public void testPredicatedBag() { final Bag bag = BagUtils.predicatedBag(new HashBag<>(), truePredicate); - assertTrue(bag instanceof PredicatedBag, "Returned object should be a PredicatedBag."); + assertInstanceOf(PredicatedBag.class, bag, "Returned object should be a PredicatedBag."); assertAll( () -> assertThrows(NullPointerException.class, () -> BagUtils.predicatedBag(null, truePredicate), "Expecting NullPointerException for null bag."), @@ -57,7 +57,7 @@ public void testPredicatedBag() { @Test public void testPredicatedSortedBag() { final Bag bag = BagUtils.predicatedSortedBag(new TreeBag<>(), truePredicate); - assertTrue(bag instanceof PredicatedSortedBag, "Returned object should be a PredicatedSortedBag."); + assertInstanceOf(PredicatedSortedBag.class, bag, "Returned object should be a PredicatedSortedBag."); assertAll( () -> assertThrows(NullPointerException.class, () -> BagUtils.predicatedSortedBag(null, truePredicate), "Expecting NullPointerException for null bag."), @@ -69,7 +69,7 @@ public void testPredicatedSortedBag() { @Test public void testSynchronizedBag() { final Bag bag = BagUtils.synchronizedBag(new HashBag<>()); - assertTrue(bag instanceof SynchronizedBag, "Returned object should be a SynchronizedBag."); + assertInstanceOf(SynchronizedBag.class, bag, "Returned object should be a SynchronizedBag."); assertThrows(NullPointerException.class, () -> BagUtils.synchronizedBag(null), "Expecting NullPointerException for null bag."); } @@ -77,7 +77,7 @@ public void testSynchronizedBag() { @Test public void testSynchronizedSortedBag() { final Bag bag = BagUtils.synchronizedSortedBag(new TreeBag<>()); - assertTrue(bag instanceof SynchronizedSortedBag, "Returned object should be a SynchronizedSortedBag."); + assertInstanceOf(SynchronizedSortedBag.class, bag, "Returned object should be a SynchronizedSortedBag."); assertThrows(NullPointerException.class, () -> BagUtils.synchronizedSortedBag(null), "Expecting NullPointerException for null bag."); } @@ -85,7 +85,7 @@ public void testSynchronizedSortedBag() { @Test public void testTransformedBag() { final Bag bag = BagUtils.transformingBag(new HashBag<>(), nopTransformer); - assertTrue(bag instanceof TransformedBag, "Returned object should be an TransformedBag."); + assertInstanceOf(TransformedBag.class, bag, "Returned object should be an TransformedBag."); assertAll( () -> assertThrows(NullPointerException.class, () -> BagUtils.transformingBag(null, nopTransformer), "Expecting NullPointerException for null bag."), @@ -97,7 +97,7 @@ public void testTransformedBag() { @Test public void testTransformedSortedBag() { final Bag bag = BagUtils.transformingSortedBag(new TreeBag<>(), nopTransformer); - assertTrue(bag instanceof TransformedSortedBag, "Returned object should be an TransformedSortedBag"); + assertInstanceOf(TransformedSortedBag.class, bag, "Returned object should be an TransformedSortedBag"); assertAll( () -> assertThrows(NullPointerException.class, () -> BagUtils.transformingSortedBag(null, nopTransformer), "Expecting NullPointerException for null bag."), @@ -109,7 +109,7 @@ public void testTransformedSortedBag() { @Test public void testUnmodifiableBag() { final Bag bag = BagUtils.unmodifiableBag(new HashBag<>()); - assertTrue(bag instanceof UnmodifiableBag, "Returned object should be an UnmodifiableBag."); + assertInstanceOf(UnmodifiableBag.class, bag, "Returned object should be an UnmodifiableBag."); assertThrows(NullPointerException.class, () -> BagUtils.unmodifiableBag(null), "Expecting NullPointerException for null bag."); assertSame(bag, BagUtils.unmodifiableBag(bag), "UnmodifiableBag shall not be decorated"); @@ -118,7 +118,7 @@ public void testUnmodifiableBag() { @Test public void testUnmodifiableSortedBag() { final SortedBag bag = BagUtils.unmodifiableSortedBag(new TreeBag<>()); - assertTrue(bag instanceof UnmodifiableSortedBag, "Returned object should be an UnmodifiableSortedBag."); + assertInstanceOf(UnmodifiableSortedBag.class, bag, "Returned object should be an UnmodifiableSortedBag."); assertThrows(NullPointerException.class, () -> BagUtils.unmodifiableSortedBag(null), "Expecting NullPointerException for null bag."); assertSame(bag, BagUtils.unmodifiableSortedBag(bag), "UnmodifiableSortedBag shall not be decorated"); diff --git a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java index 8113960678..cb507a0ecb 100644 --- a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java @@ -21,6 +21,7 @@ import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -1746,7 +1747,7 @@ public void testPermutationsWithNullCollection() { public void testPredicatedCollection() { final Predicate predicate = PredicateUtils.instanceofPredicate(Integer.class); final Collection collection = CollectionUtils.predicatedCollection(new ArrayList<>(), predicate); - assertTrue(collection instanceof PredicatedCollection, "returned object should be a PredicatedCollection"); + assertInstanceOf(PredicatedCollection.class, collection, "returned object should be a PredicatedCollection"); } @Test @@ -2321,7 +2322,7 @@ public void testSubtractWithPredicate() { @Deprecated public void testSynchronizedCollection() { final Collection col = CollectionUtils.synchronizedCollection(new ArrayList<>()); - assertTrue(col instanceof SynchronizedCollection, "Returned object should be a SynchronizedCollection."); + assertInstanceOf(SynchronizedCollection.class, col, "Returned object should be a SynchronizedCollection."); assertThrows(NullPointerException.class, () -> CollectionUtils.synchronizedCollection(null), "Expecting NullPointerException for null collection."); @@ -2366,7 +2367,7 @@ public void testTransform2() { public void testTransformedCollection() { final Transformer transformer = TransformerUtils.nopTransformer(); final Collection collection = CollectionUtils.transformingCollection(new ArrayList<>(), transformer); - assertTrue(collection instanceof TransformedCollection, "returned object should be a TransformedCollection"); + assertInstanceOf(TransformedCollection.class, collection, "returned object should be a TransformedCollection"); } @Test @@ -2430,7 +2431,7 @@ public void testUnionNullColl2() { @Deprecated public void testUnmodifiableCollection() { final Collection col = CollectionUtils.unmodifiableCollection(new ArrayList<>()); - assertTrue(col instanceof UnmodifiableCollection, "Returned object should be a UnmodifiableCollection."); + assertInstanceOf(UnmodifiableCollection.class, col, "Returned object should be a UnmodifiableCollection."); assertThrows(NullPointerException.class, () -> CollectionUtils.unmodifiableCollection(null), "Expecting NullPointerException for null collection."); diff --git a/src/test/java/org/apache/commons/collections4/ListUtilsTest.java b/src/test/java/org/apache/commons/collections4/ListUtilsTest.java index 8d232cb4aa..70c0b3426b 100644 --- a/src/test/java/org/apache/commons/collections4/ListUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/ListUtilsTest.java @@ -19,6 +19,7 @@ import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertSame; @@ -365,7 +366,7 @@ public void testPartition() { public void testPredicatedList() { final Predicate predicate = String.class::isInstance; final List list = ListUtils.predicatedList(new ArrayList<>(), predicate); - assertTrue(list instanceof PredicatedList, "returned object should be a PredicatedList"); + assertInstanceOf(PredicatedList.class, list, "returned object should be a PredicatedList"); assertAll( () -> assertThrows(NullPointerException.class, () -> ListUtils.predicatedList(new ArrayList<>(), null), "Expecting IllegalArgumentException for null predicate."), diff --git a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java index 676dd231f7..d292d70409 100644 --- a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java @@ -19,6 +19,7 @@ import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertSame; @@ -737,7 +738,7 @@ public void testLazyMap() { public void testLazyMapFactory() { final Factory factory = FactoryUtils.constantFactory(Integer.valueOf(5)); Map map = MapUtils.lazyMap(new HashMap<>(), factory); - assertTrue(map instanceof LazyMap); + assertInstanceOf(LazyMap.class, map); assertAll( () -> assertThrows(NullPointerException.class, () -> MapUtils.lazyMap(new HashMap<>(), (Factory) null), "Expecting NullPointerException for null factory"), @@ -747,7 +748,7 @@ public void testLazyMapFactory() { final Transformer transformer = TransformerUtils.asTransformer(factory); map = MapUtils.lazyMap(new HashMap<>(), transformer); - assertTrue(map instanceof LazyMap); + assertInstanceOf(LazyMap.class, map); assertAll( () -> assertThrows(NullPointerException.class, () -> MapUtils.lazyMap(new HashMap<>(), (Transformer) null), "Expecting NullPointerException for null transformer"), @@ -811,7 +812,7 @@ public void testOrderedMap() { inMap.put("key1", "value1"); inMap.put("key2", "value2"); final Map map = MapUtils.orderedMap(inMap); - assertTrue(map instanceof OrderedMap); + assertInstanceOf(OrderedMap.class, map); } @Test @@ -876,7 +877,7 @@ public void testPopulateMultiMap() { public void testPredicatedMap() { final Predicate p = getPredicate(); final Map map = MapUtils.predicatedMap(new HashMap<>(), p, p); - assertTrue(map instanceof PredicatedMap); + assertInstanceOf(PredicatedMap.class, map); assertThrows(NullPointerException.class, () -> MapUtils.predicatedMap(null, p, p), "Expecting NullPointerException for null map."); diff --git a/src/test/java/org/apache/commons/collections4/QueueUtilsTest.java b/src/test/java/org/apache/commons/collections4/QueueUtilsTest.java index ca8521ceaa..268e3dfb81 100644 --- a/src/test/java/org/apache/commons/collections4/QueueUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/QueueUtilsTest.java @@ -16,6 +16,7 @@ */ package org.apache.commons.collections4; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -41,7 +42,7 @@ public class QueueUtilsTest { @Test public void testEmptyQueue() { final Queue queue = QueueUtils.emptyQueue(); - assertTrue(queue instanceof UnmodifiableQueue, "Returned object should be an UnmodifiableQueue."); + assertInstanceOf(UnmodifiableQueue.class, queue, "Returned object should be an UnmodifiableQueue."); assertTrue(queue.isEmpty(), "Returned queue is not empty."); assertThrows(UnsupportedOperationException.class, () -> queue.add(new Object()), @@ -51,7 +52,7 @@ public void testEmptyQueue() { @Test public void testPredicatedQueue() { final Queue queue = QueueUtils.predicatedQueue(new LinkedList<>(), truePredicate); - assertTrue(queue instanceof PredicatedQueue, "Returned object should be a PredicatedQueue."); + assertInstanceOf(PredicatedQueue.class, queue, "Returned object should be a PredicatedQueue."); assertThrows(NullPointerException.class, () -> QueueUtils.predicatedQueue(null, truePredicate), "Expecting NullPointerException for null queue."); @@ -63,7 +64,7 @@ public void testPredicatedQueue() { @Test public void testSynchronizedQueue() { final Queue queue = QueueUtils.synchronizedQueue(new LinkedList<>()); - assertTrue(queue instanceof SynchronizedQueue, "Returned object should be a SynchronizedQueue."); + assertInstanceOf(SynchronizedQueue.class, queue, "Returned object should be a SynchronizedQueue."); assertThrows(NullPointerException.class, () -> QueueUtils.synchronizedQueue(null), "Expecting NullPointerException for null queue."); @@ -72,7 +73,7 @@ public void testSynchronizedQueue() { @Test public void testTransformedQueue() { final Queue queue = QueueUtils.transformingQueue(new LinkedList<>(), nopTransformer); - assertTrue(queue instanceof TransformedQueue, "Returned object should be an TransformedQueue."); + assertInstanceOf(TransformedQueue.class, queue, "Returned object should be an TransformedQueue."); assertThrows(NullPointerException.class, () -> QueueUtils.transformingQueue(null, nopTransformer), "Expecting NullPointerException for null queue."); @@ -84,7 +85,7 @@ public void testTransformedQueue() { @Test public void testUnmodifiableQueue() { final Queue queue = QueueUtils.unmodifiableQueue(new LinkedList<>()); - assertTrue(queue instanceof UnmodifiableQueue, "Returned object should be an UnmodifiableQueue."); + assertInstanceOf(UnmodifiableQueue.class, queue, "Returned object should be an UnmodifiableQueue."); assertThrows(NullPointerException.class, () -> QueueUtils.unmodifiableQueue(null), "Expecting NullPointerException for null queue."); diff --git a/src/test/java/org/apache/commons/collections4/SetUtilsTest.java b/src/test/java/org/apache/commons/collections4/SetUtilsTest.java index b3cc533379..7a1b8dd604 100644 --- a/src/test/java/org/apache/commons/collections4/SetUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/SetUtilsTest.java @@ -19,6 +19,7 @@ import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertSame; @@ -210,7 +211,7 @@ public void testNewIdentityHashSet() { public void testpredicatedSet() { final Predicate predicate = String.class::isInstance; final Set set = SetUtils.predicatedSet(new HashSet<>(), predicate); - assertTrue(set instanceof PredicatedSet, "returned object should be a PredicatedSet"); + assertInstanceOf(PredicatedSet.class, set, "returned object should be a PredicatedSet"); assertAll( () -> assertThrows(NullPointerException.class, () -> SetUtils.predicatedSet(new HashSet<>(), null), "Expecting NullPointerException for null predicate."), diff --git a/src/test/java/org/apache/commons/collections4/SplitMapUtilsTest.java b/src/test/java/org/apache/commons/collections4/SplitMapUtilsTest.java index fcf312714a..50425406e0 100644 --- a/src/test/java/org/apache/commons/collections4/SplitMapUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/SplitMapUtilsTest.java @@ -18,6 +18,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -93,7 +94,7 @@ public void testReadableMap() { } // unmodifiable - assertTrue(map instanceof Unmodifiable); + assertInstanceOf(Unmodifiable.class, map); // check individual operations int sz = map.size(); diff --git a/src/test/java/org/apache/commons/collections4/TrieUtilsTest.java b/src/test/java/org/apache/commons/collections4/TrieUtilsTest.java index ec6ab5729a..3b5bc04422 100644 --- a/src/test/java/org/apache/commons/collections4/TrieUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/TrieUtilsTest.java @@ -16,9 +16,9 @@ */ package org.apache.commons.collections4; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; import org.apache.commons.collections4.trie.PatriciaTrie; import org.apache.commons.collections4.trie.UnmodifiableTrie; @@ -32,7 +32,7 @@ public class TrieUtilsTest { @Test public void testUnmodifiableTrie() { final Trie trie = TrieUtils.unmodifiableTrie(new PatriciaTrie<>()); - assertTrue(trie instanceof UnmodifiableTrie, "Returned object should be an UnmodifiableTrie."); + assertInstanceOf(UnmodifiableTrie.class, trie, "Returned object should be an UnmodifiableTrie."); assertThrows(NullPointerException.class, () -> TrieUtils.unmodifiableTrie(null)); diff --git a/src/test/java/org/apache/commons/collections4/comparators/AbstractComparatorTest.java b/src/test/java/org/apache/commons/collections4/comparators/AbstractComparatorTest.java index f26196a8ea..4759e5d20b 100644 --- a/src/test/java/org/apache/commons/collections4/comparators/AbstractComparatorTest.java +++ b/src/test/java/org/apache/commons/collections4/comparators/AbstractComparatorTest.java @@ -17,7 +17,7 @@ package org.apache.commons.collections4.comparators; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.fail; import java.io.FileNotFoundException; @@ -159,7 +159,7 @@ public void testComparatorCompatibility() throws IOException, ClassNotFoundExcep @Test public void testComparatorIsSerializable() { final Comparator comparator = makeObject(); - assertTrue(comparator instanceof Serializable, + assertInstanceOf(Serializable.class, comparator, "This comparator should be Serializable."); } diff --git a/src/test/java/org/apache/commons/collections4/keyvalue/UnmodifiableMapEntryTest.java b/src/test/java/org/apache/commons/collections4/keyvalue/UnmodifiableMapEntryTest.java index 095473528a..a6be43ba1d 100644 --- a/src/test/java/org/apache/commons/collections4/keyvalue/UnmodifiableMapEntryTest.java +++ b/src/test/java/org/apache/commons/collections4/keyvalue/UnmodifiableMapEntryTest.java @@ -16,9 +16,9 @@ */ package org.apache.commons.collections4.keyvalue; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Map; @@ -89,7 +89,7 @@ public void testConstructors() { assertSame(key, entry2.getKey()); assertSame(value, entry2.getValue()); - assertTrue(entry instanceof Unmodifiable); + assertInstanceOf(Unmodifiable.class, entry); } @Test diff --git a/src/test/java/org/apache/commons/collections4/map/LazySortedMapTest.java b/src/test/java/org/apache/commons/collections4/map/LazySortedMapTest.java index 007ae2e562..418e1fccd9 100644 --- a/src/test/java/org/apache/commons/collections4/map/LazySortedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/LazySortedMapTest.java @@ -19,10 +19,10 @@ import static org.apache.commons.collections4.map.LazySortedMap.lazySortedMap; import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Comparator; import java.util.Map; @@ -133,7 +133,7 @@ public void testSortOrder() { public void testTransformerDecorate() { final Transformer transformer = TransformerUtils.asTransformer(oneFactory); final SortedMap map = lazySortedMap(new TreeMap<>(), transformer); - assertTrue(map instanceof LazySortedMap); + assertInstanceOf(LazySortedMap.class, map); assertAll( () -> assertThrows(NullPointerException.class, () -> lazySortedMap(new TreeMap<>(), (Transformer) null), "Expecting NullPointerException for null transformer"), diff --git a/src/test/java/org/apache/commons/collections4/map/SingletonMapTest.java b/src/test/java/org/apache/commons/collections4/map/SingletonMapTest.java index 7141f23ab3..dfd074ab92 100644 --- a/src/test/java/org/apache/commons/collections4/map/SingletonMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/SingletonMapTest.java @@ -17,6 +17,7 @@ package org.apache.commons.collections4.map; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.HashMap; @@ -101,7 +102,7 @@ public void testBoundedMap() { assertEquals(1, map.size()); assertTrue(map.isFull()); assertEquals(1, map.maxSize()); - assertTrue(map instanceof BoundedMap); + assertInstanceOf(BoundedMap.class, map); } @Test @@ -167,7 +168,7 @@ public void testKeyValue() { assertEquals(1, map.size()); assertEquals(ONE, map.getKey()); assertEquals(TWO, map.getValue()); - assertTrue(map instanceof KeyValue); + assertInstanceOf(KeyValue.class, map); } // public void testCreate() throws Exception {