From eba4b8cbc51969d2d3a6baa6078a883d6b353fb8 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Fri, 3 Nov 2023 09:44:17 -0400 Subject: [PATCH] Normalize test method names Skip bloom filter package due to WIP PR --- .../collections4/CollectionUtilsTest.java | 90 +++++++++---------- .../collections4/ComparatorUtilsTest.java | 12 +-- .../collections4/EnumerationUtilsTest.java | 2 +- .../collections4/FactoryUtilsTest.java | 10 +-- .../collections4/FluentIterableTest.java | 46 +++++----- .../collections4/IterableUtilsTest.java | 32 +++---- .../commons/collections4/SetUtilsTest.java | 8 +- .../PredicatedCollectionBuilderTest.java | 10 +-- .../functors/AbstractClosureTest.java | 2 +- .../functors/AbstractPredicateTest.java | 2 +- .../functors/AllPredicateTest.java | 10 +-- .../functors/ComparatorPredicateTest.java | 10 +-- .../functors/EqualPredicateTest.java | 2 +- .../functors/NullPredicateTest.java | 2 +- .../commons/collections4/map/LazyMapTest.java | 4 +- .../collections4/map/LazySortedMapTest.java | 8 +- 16 files changed, 122 insertions(+), 128 deletions(-) diff --git a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java index a562524168..e13a47038e 100644 --- a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java @@ -123,13 +123,13 @@ public class CollectionUtilsTest extends MockTestCase { Transformer TRANSFORM_TO_INTEGER = input -> Integer.valueOf(((Long) input).intValue()); @Test - public void addAllForElements() { + public void testAddAllForElements() { CollectionUtils.addAll(collectionA, 5); assertTrue(collectionA.contains(5)); } @Test - public void addAllForEnumeration() { + public void testAddAllForEnumeration() { final Hashtable h = new Hashtable<>(); h.put(5, 5); final Enumeration enumeration = h.keys(); @@ -144,7 +144,7 @@ public void addAllForEnumeration() { * {@link Collection#addAll(Collection)} is called instead of iterating. */ @Test - public void addAllForIterable() { + public void testAddAllForIterable() { final Collection inputCollection = createMock(Collection.class); final Iterable inputIterable = inputCollection; final Iterable iterable = createMock(Iterable.class); @@ -180,7 +180,7 @@ public void addAllForIterable() { } @Test - public void addIgnoreNull() { + public void testAddIgnoreNull() { final Set set = new HashSet<>(); set.add("1"); set.add("2"); @@ -291,22 +291,22 @@ public void cardinalityOfNull() { } @Test - public void collateException0() { + public void testCollateException0() { assertThrows(NullPointerException.class, () -> CollectionUtils.collate(null, collectionC)); } @Test - public void collateException1() { + public void testCollateException1() { assertThrows(NullPointerException.class, () -> CollectionUtils.collate(collectionA, null)); } @Test - public void collateException2() { + public void testCollateException2() { assertThrows(NullPointerException.class, () -> CollectionUtils.collate(collectionA, collectionC, null)); } @Test - public void collect() { + public void testCollect() { final Transformer transformer = TransformerUtils.constantTransformer(2L); Collection collection = CollectionUtils.collect(iterableA, transformer); assertEquals(collection.size(), collectionA.size()); @@ -340,7 +340,7 @@ public void collect() { } @Test - public void containsAll() { + public void testContainsAll() { final Collection empty = new ArrayList<>(0); final Collection one = new ArrayList<>(1); one.add("1"); @@ -376,7 +376,7 @@ public void containsAll() { } @Test - public void containsAnyInArray() { + public void testContainsAnyInArray() { final Collection empty = new ArrayList<>(0); final String[] emptyArr = {}; final Collection one = new ArrayList<>(1); @@ -410,7 +410,7 @@ public void containsAnyInArray() { } @Test - public void containsAnyInCollection() { + public void testContainsAnyInCollection() { final Collection empty = new ArrayList<>(0); final Collection one = new ArrayList<>(1); one.add("1"); @@ -448,7 +448,7 @@ public void countMatches() { } @Test - public void disjunction() { + public void testDisjunction() { final Collection col = CollectionUtils.disjunction(iterableA, iterableC); final Map freq = CollectionUtils.getCardinalityMap(col); assertEquals(Integer.valueOf(1), freq.get(1)); @@ -467,13 +467,13 @@ public void disjunction() { } @Test - public void emptyCollection() throws Exception { + public void testEmptyCollection() throws Exception { final Collection coll = CollectionUtils.emptyCollection(); assertEquals(CollectionUtils.EMPTY_COLLECTION, coll); } @Test - public void emptyIfNull() { + public void testEmptyIfNull() { assertTrue(CollectionUtils.emptyIfNull(null).isEmpty()); final Collection collection = new ArrayList<>(); assertSame(collection, CollectionUtils.emptyIfNull(collection)); @@ -497,7 +497,7 @@ public void exists() { } @Test - public void extractSingleton() { + public void testExtractSingleton() { assertAll( () -> { final ArrayList collNull = null; @@ -523,7 +523,7 @@ public void extractSingleton() { //Up to here @Test - public void filter() { + public void testFilter() { final List ints = new ArrayList<>(); ints.add(1); ints.add(2); @@ -536,7 +536,7 @@ public void filter() { } @Test - public void filterInverse() { + public void testFilterInverse() { final List ints = new ArrayList<>(); ints.add(1); ints.add(2); @@ -551,7 +551,7 @@ public void filterInverse() { } @Test - public void filterInverseNullParameters() throws Exception { + public void testFilterInverseNullParameters() throws Exception { final List longs = Collections.nCopies(4, 10L); assertFalse(CollectionUtils.filterInverse(longs, null)); assertEquals(4, longs.size()); @@ -562,7 +562,7 @@ public void filterInverseNullParameters() throws Exception { } @Test - public void filterNullParameters() throws Exception { + public void testFilterNullParameters() throws Exception { final List longs = Collections.nCopies(4, 10L); assertFalse(CollectionUtils.filter(longs, null)); assertEquals(4, longs.size()); @@ -684,7 +684,7 @@ public void forAllDoIterator() { } @Test - public void get() { + public void testGet() { assertEquals(2, CollectionUtils.get((Object) collectionA, 2)); assertEquals(2, CollectionUtils.get((Object) collectionA.iterator(), 2)); final Map map = CollectionUtils.getCardinalityMap(collectionA); @@ -694,12 +694,12 @@ public void get() { } @Test - public void get1() { + public void testGet1() { assertThrows(IllegalArgumentException.class, () -> CollectionUtils.get((Object) null, 0)); } @Test - public void getCardinalityMap() { + public void testGetCardinalityMap() { final Map freqA = CollectionUtils.getCardinalityMap(iterableA); assertEquals(1, (int) freqA.get(1)); assertEquals(2, (int) freqA.get(2)); @@ -716,7 +716,7 @@ public void getCardinalityMap() { } @Test - public void getEnumeration() { + public void testGetEnumeration() { final Vector vectorA = new Vector<>(collectionA); final Enumeration e = vectorA.elements(); assertEquals(Integer.valueOf(2), CollectionUtils.get(e, 2)); @@ -746,7 +746,7 @@ public void getFromEnumeration() throws Exception { } @Test - public void getFromHashMap() { + public void testGetFromHashMap() { // Unordered map, entries exist final Map expected = new HashMap<>(); expected.put("zeroKey", "zero"); @@ -796,7 +796,7 @@ public void getFromIterator() throws Exception { } @Test - public void getFromLinkedHashMap() { + public void testGetFromLinkedHashMap() { // Ordered map, entries exist final Map expected = new LinkedHashMap<>(); expected.put("zeroKey", "zero"); @@ -815,7 +815,7 @@ public void getFromLinkedHashMap() { * {@link List#get(int)}. */ @Test - public void getFromList() throws Exception { + public void testGetFromList() throws Exception { // List, entry exists final List list = createMock(List.class); expect(list.get(0)).andReturn("zero"); @@ -829,7 +829,7 @@ public void getFromList() throws Exception { } @Test - public void getFromMapIndexOutOfRange() { + public void testGetFromMapIndexOutOfRange() { // Ordered map, entries exist final Map expected = new LinkedHashMap<>(); expected.put("zeroKey", "zero"); @@ -845,14 +845,14 @@ public void getFromMapIndexOutOfRange() { } @Test - public void getFromObject() throws Exception { + public void testGetFromObject() throws Exception { // Invalid object final Object obj = new Object(); assertThrows(IllegalArgumentException.class, () -> CollectionUtils.get(obj, 0)); } @Test - public void getFromObjectArray() throws Exception { + public void testGetFromObjectArray() throws Exception { // Object array, entry exists final Object[] objArray = new Object[2]; objArray[0] = "zero"; @@ -866,7 +866,7 @@ public void getFromObjectArray() throws Exception { } @Test - public void getFromPrimitiveArray() throws Exception { + public void testGetFromPrimitiveArray() throws Exception { // Primitive array, entry exists final int[] array = new int[2]; array[0] = 10; @@ -880,7 +880,7 @@ public void getFromPrimitiveArray() throws Exception { } @Test - public void getFromTreeMap() { + public void testGetFromTreeMap() { // Ordered map, entries exist final Map expected = new LinkedHashMap<>(); expected.put("zeroKey", "zero"); @@ -899,7 +899,7 @@ public void getFromTreeMap() { } @Test - public void getIterator() { + public void testGetIterator() { final Iterator it = collectionA.iterator(); assertEquals(Integer.valueOf(2), CollectionUtils.get((Object) it, 2)); assertTrue(it.hasNext()); @@ -908,17 +908,17 @@ public void getIterator() { } @Test - public void getNegative() { + public void testGetNegative() { assertThrows(IndexOutOfBoundsException.class, () -> CollectionUtils.get((Object) collectionA, -3)); } @Test - public void getPositiveOutOfBounds() { + public void testGetPositiveOutOfBounds() { assertThrows(IndexOutOfBoundsException.class, () -> CollectionUtils.get((Object) collectionA.iterator(), 30)); } @Test - public void intersection() { + public void testIntersection() { final Collection col = CollectionUtils.intersection(iterableA, iterableC); final Map freq = CollectionUtils.getCardinalityMap(col); assertNull(freq.get(1)); @@ -937,7 +937,7 @@ public void intersection() { } @Test - public void intersectionUsesMethodEquals() { + public void testIntersectionUsesMethodEquals() { // Let elta and eltb be objects... final Integer elta = 17; final Integer eltb = 17; @@ -974,13 +974,13 @@ public void intersectionUsesMethodEquals() { } @Test - public void isEmpty() { + public void testIsEmpty() { assertFalse(CollectionUtils.isNotEmpty(null)); assertTrue(CollectionUtils.isNotEmpty(collectionA)); } @Test - public void isFull() { + public void testIsFull() { final Set set = new HashSet<>(); set.add("1"); set.add("2"); @@ -996,7 +996,7 @@ public void isFull() { } @Test - public void maxSize() { + public void testMaxSize() { final Set set = new HashSet<>(); set.add("1"); set.add("2"); @@ -1020,14 +1020,14 @@ private void next(final Iterator iterator, final T t) { } @Test - public void predicatedCollection() { + 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"); } @Test - public void reverse() { + public void testReverse() { CollectionUtils.reverseArray(new Object[] {}); final Integer[] a = collectionA.toArray(ArrayUtils.EMPTY_INTEGER_OBJECT_ARRAY); CollectionUtils.reverseArray(a); @@ -1037,7 +1037,7 @@ public void reverse() { } @Test - public void select() { + public void testSelect() { final List list = new ArrayList<>(); list.add(1); list.add(2); @@ -1054,7 +1054,7 @@ public void select() { } @Test - public void selectRejected() { + public void testSelectRejected() { final List list = new ArrayList<>(); list.add(1L); list.add(2L); @@ -1073,7 +1073,7 @@ public void selectRejected() { } @Test - public void selectWithOutputCollections() { + public void testSelectWithOutputCollections() { final List input = new ArrayList<>(); input.add(1); input.add(2); @@ -2284,7 +2284,7 @@ public void transform2() { } @Test - public void union() { + public void testUnion() { final Collection col = CollectionUtils.union(iterableA, iterableC); final Map freq = CollectionUtils.getCardinalityMap(col); assertEquals(Integer.valueOf(1), freq.get(1)); diff --git a/src/test/java/org/apache/commons/collections4/ComparatorUtilsTest.java b/src/test/java/org/apache/commons/collections4/ComparatorUtilsTest.java index 119a54da28..10861942dc 100644 --- a/src/test/java/org/apache/commons/collections4/ComparatorUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/ComparatorUtilsTest.java @@ -31,7 +31,7 @@ public class ComparatorUtilsTest { @Test - public void booleanComparator() { + public void testBooleanComparator() { Comparator comp = ComparatorUtils.booleanComparator(true); assertTrue(comp.compare(Boolean.TRUE, Boolean.FALSE) < 0); assertEquals(0, comp.compare(Boolean.TRUE, Boolean.TRUE)); @@ -44,7 +44,7 @@ public void booleanComparator() { } @Test - public void chainedComparator() { + public void testChainedComparator() { // simple test: chain 2 natural comparators final Comparator comp = ComparatorUtils.chainedComparator(ComparatorUtils.naturalComparator(), ComparatorUtils.naturalComparator()); @@ -54,7 +54,7 @@ public void chainedComparator() { } @Test - public void max() { + public void testMax() { final Comparator reversed = ComparatorUtils.reversedComparator(ComparatorUtils.naturalComparator()); @@ -72,7 +72,7 @@ public void max() { } @Test - public void min() { + public void testMin() { final Comparator reversed = ComparatorUtils.reversedComparator(ComparatorUtils.naturalComparator()); @@ -90,7 +90,7 @@ public void min() { } @Test - public void nullLowComparator() { + public void testNullLowComparator() { final Comparator comp = ComparatorUtils.nullLowComparator(null); assertTrue(comp.compare(null, 10) < 0); assertEquals(0, comp.compare(null, null)); @@ -98,7 +98,7 @@ public void nullLowComparator() { } @Test - public void nullHighComparator() { + public void testNullHighComparator() { final Comparator comp = ComparatorUtils.nullHighComparator(null); assertTrue(comp.compare(null, 10) > 0); assertEquals(0, comp.compare(null, null)); diff --git a/src/test/java/org/apache/commons/collections4/EnumerationUtilsTest.java b/src/test/java/org/apache/commons/collections4/EnumerationUtilsTest.java index c70816771b..6d863b8e46 100644 --- a/src/test/java/org/apache/commons/collections4/EnumerationUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/EnumerationUtilsTest.java @@ -39,7 +39,7 @@ public class EnumerationUtilsTest { public static final String TO_LIST_FIXTURE = "this is a test"; @Test - public void getFromEnumeration() throws Exception { + public void testGetFromEnumeration() throws Exception { // Enumeration, entry exists final Vector vector = new Vector<>(); vector.addElement("zero"); diff --git a/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java b/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java index 3ed25c8c8e..bd3076e63a 100644 --- a/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java @@ -179,12 +179,12 @@ public int getValue() { } @Test - public void instantiateFactoryNull() { + public void testInstantiateFactoryNull() { assertThrows(NullPointerException.class, () -> FactoryUtils.instantiateFactory(null)); } @Test - public void instantiateFactorySimple() { + public void testInstantiateFactorySimple() { final Factory factory = FactoryUtils.instantiateFactory(Mock3.class); assertNotNull(factory); Mock3 created = factory.create(); @@ -194,17 +194,17 @@ public void instantiateFactorySimple() { } @Test - public void instantiateFactoryMismatch() { + public void testInstantiateFactoryMismatch() { assertThrows(IllegalArgumentException.class, () -> FactoryUtils.instantiateFactory(Date.class, null, new Object[] {null})); } @Test - public void instantiateFactoryNoConstructor() { + public void testInstantiateFactoryNoConstructor() { assertThrows(IllegalArgumentException.class, () -> FactoryUtils.instantiateFactory(Date.class, new Class[] {Long.class}, new Object[] {null})); } @Test - public void instantiateFactoryComplex() { + public void testInstantiateFactoryComplex() { TimeZone.setDefault(TimeZone.getTimeZone("GMT")); // 2nd Jan 1970 final Factory factory = FactoryUtils.instantiateFactory(Date.class, diff --git a/src/test/java/org/apache/commons/collections4/FluentIterableTest.java b/src/test/java/org/apache/commons/collections4/FluentIterableTest.java index 5f4481218c..7a39356d79 100644 --- a/src/test/java/org/apache/commons/collections4/FluentIterableTest.java +++ b/src/test/java/org/apache/commons/collections4/FluentIterableTest.java @@ -106,7 +106,7 @@ public void setUp() { private static final Predicate EVEN = input -> input.intValue() % 2 == 0; @Test - public void factoryMethodOf() { + public void testFactoryMethodOf() { FluentIterable iterable = FluentIterable.of(1, 2, 3, 4, 5); List result = iterable.toList(); assertEquals(Arrays.asList(1, 2, 3, 4, 5), result); @@ -125,7 +125,7 @@ public void factoryMethodOf() { } @Test - public void appendElements() { + public void testAppendElements() { final FluentIterable it = FluentIterable.of(iterableA).append(10, 20, 30); assertEquals(IterableUtils.size(iterableA) + 3, IterableUtils.size(it)); assertTrue(IterableUtils.contains(it, 1)); @@ -139,7 +139,7 @@ public void appendElements() { } @Test - public void appendIterable() { + public void testAppendIterable() { final List listB = Arrays.asList(10, 20, 30); final FluentIterable it = FluentIterable.of(iterableA).append(listB); assertEquals(IterableUtils.size(iterableA) + listB.size(), IterableUtils.size(it)); @@ -151,7 +151,7 @@ public void appendIterable() { } @Test - public void collate() { + public void testCollate() { final List result = FluentIterable.of(iterableOdd).collate(iterableEven).toList(); final List combinedList = new ArrayList<>(); CollectionUtils.addAll(combinedList, iterableOdd); @@ -164,7 +164,7 @@ public void collate() { } @Test - public void collateWithComparator() { + public void testCollateWithComparator() { List result = FluentIterable .of(iterableOdd) @@ -183,7 +183,7 @@ public void collateWithComparator() { } @Test - public void filter() { + public void testFilter() { final Predicate smallerThan3 = object -> object.intValue() < 3; List result = FluentIterable.of(iterableA).filter(smallerThan3).toList(); assertEquals(3, result.size()); @@ -198,7 +198,7 @@ public void filter() { } @Test - public void forEach() { + public void testForEach() { final AtomicInteger sum = new AtomicInteger(0); final Closure closure = sum::addAndGet; @@ -214,7 +214,7 @@ public void forEach() { } @Test - public void limit() { + public void testLimit() { List result = FluentIterable.of(iterableA).limit(3).toList(); assertEquals(3, result.size()); assertEquals(Arrays.asList(1, 2, 2), result); @@ -238,7 +238,7 @@ public void limit() { } @Test - public void reverse() { + public void testReverse() { List result = FluentIterable.of(iterableA).reverse().toList(); final List expected = IterableUtils.toList(iterableA); Collections.reverse(expected); @@ -250,7 +250,7 @@ public void reverse() { } @Test - public void skip() { + public void testSkip() { List result = FluentIterable.of(iterableA).skip(4).toList(); assertEquals(6, result.size()); assertEquals(Arrays.asList(3, 3, 4, 4, 4, 4), result); @@ -289,7 +289,7 @@ public void transform() { } @Test - public void unique() { + public void testUnique() { List result = FluentIterable.of(iterableA).unique().toList(); assertEquals(4, result.size()); assertEquals(Arrays.asList(1, 2, 3, 4), result); @@ -300,7 +300,7 @@ public void unique() { } @Test - public void unmodifiable() { + public void testUnmodifiable() { final FluentIterable iterable1 = FluentIterable.of(iterableA).unmodifiable(); final Iterator it = iterable1.iterator(); assertEquals(1, it.next().intValue()); @@ -315,7 +315,7 @@ public void unmodifiable() { @SuppressWarnings("unchecked") @Test - public void zip() { + public void testZip() { List result = FluentIterable.of(iterableOdd).zip(iterableEven).toList(); List combinedList = new ArrayList<>(); CollectionUtils.addAll(combinedList, iterableOdd); @@ -335,7 +335,7 @@ public void zip() { } @Test - public void asEnumeration() { + public void testAsEnumeration() { Enumeration enumeration = FluentIterable.of(iterableB).asEnumeration(); final List result = EnumerationUtils.toList(enumeration); assertEquals(iterableB, result); @@ -345,7 +345,7 @@ public void asEnumeration() { } @Test - public void allMatch() { + public void testAllMatch() { assertTrue(FluentIterable.of(iterableEven).allMatch(EVEN)); assertFalse(FluentIterable.of(iterableOdd).allMatch(EVEN)); assertFalse(FluentIterable.of(iterableA).allMatch(EVEN)); @@ -355,7 +355,7 @@ public void allMatch() { } @Test - public void anyMatch() { + public void testAnyMatch() { assertTrue(FluentIterable.of(iterableEven).anyMatch(EVEN)); assertFalse(FluentIterable.of(iterableOdd).anyMatch(EVEN)); assertTrue(FluentIterable.of(iterableA).anyMatch(EVEN)); @@ -365,19 +365,19 @@ public void anyMatch() { } @Test - public void isEmpty() { + public void testIsEmpty() { assertTrue(FluentIterable.of(emptyIterable).isEmpty()); assertFalse(FluentIterable.of(iterableOdd).isEmpty()); } @Test - public void size() { + public void testSize() { assertEquals(0, FluentIterable.of(emptyIterable).size()); assertEquals(IterableUtils.toList(iterableOdd).size(), FluentIterable.of(iterableOdd).size()); } @Test - public void eval() { + public void testEval() { final List listNumbers = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); final FluentIterable iterable = FluentIterable.of(listNumbers).filter(EVEN); final FluentIterable materialized = iterable.eval(); @@ -391,7 +391,7 @@ public void eval() { } @Test - public void contains() { + public void testContains() { assertTrue(FluentIterable.of(iterableEven).contains(2)); assertFalse(FluentIterable.of(iterableEven).contains(1)); assertFalse(FluentIterable.of(iterableEven).contains(null)); @@ -399,7 +399,7 @@ public void contains() { } @Test - public void copyInto() { + public void testCopyInto() { List result = new ArrayList<>(); FluentIterable.of(iterableA).copyInto(result); @@ -423,7 +423,7 @@ public void copyInto() { } @Test - public void iterator() { + public void testIterator() { Iterator iterator = FluentIterable.of(iterableA).iterator(); assertTrue(iterator.hasNext()); @@ -432,7 +432,7 @@ public void iterator() { } @Test - public void get() { + public void testGet() { assertEquals(2, FluentIterable.of(iterableEven).get(0).intValue()); assertThrows(IndexOutOfBoundsException.class, () -> FluentIterable.of(iterableEven).get(-1), diff --git a/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java b/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java index 028121ab44..419db8683f 100644 --- a/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java @@ -98,7 +98,7 @@ public void setUp() { private static final Predicate EVEN = input -> input.intValue() % 2 == 0; @Test - public void forEach() { + public void testForEach() { final List listA = new ArrayList<>(); listA.add(1); @@ -123,7 +123,7 @@ public void forEach() { } @Test - public void forEachFailure() { + public void testForEachFailure() { final Closure testClosure = ClosureUtils.invokerClosure("clear"); final Collection col = new ArrayList<>(); col.add("x"); @@ -131,7 +131,7 @@ public void forEachFailure() { } @Test - public void forEachButLast() { + public void testForEachButLast() { final List listA = new ArrayList<>(); listA.add(1); @@ -159,7 +159,7 @@ public void forEachButLast() { } @Test - public void containsWithEquator() { + public void testContainsWithEquator() { final List base = new ArrayList<>(); base.add("AC"); base.add("BB"); @@ -190,7 +190,7 @@ public int hash(final String o) { } @Test - public void frequency() { + public void testFrequency() { // null iterable test assertEquals(0, IterableUtils.frequency(null, 1)); @@ -238,7 +238,7 @@ public void frequency() { } @Test - public void frequencyOfNull() { + public void testFrequencyOfNull() { final List list = new ArrayList<>(); assertEquals(0, IterableUtils.frequency(list, null)); list.add("A"); @@ -256,7 +256,7 @@ public void frequencyOfNull() { } @Test - public void find() { + public void testFind() { Predicate testPredicate = equalPredicate(4); Integer test = IterableUtils.find(iterableA, testPredicate); assertEquals(4, (int) test); @@ -270,7 +270,7 @@ public void find() { } @Test - public void indexOf() { + public void testIndexOf() { Predicate testPredicate = equalPredicate((Number) 4); int index = IterableUtils.indexOf(iterableA, testPredicate); assertEquals(6, index); @@ -284,7 +284,7 @@ public void indexOf() { } @Test - public void countMatches() { + public void testCountMatches() { assertEquals(4, IterableUtils.countMatches(iterableB, EQUALS_TWO)); assertEquals(0, IterableUtils.countMatches(null, EQUALS_TWO)); assertAll( @@ -296,7 +296,7 @@ public void countMatches() { } @Test - public void matchesAny() { + public void testMatchesAny() { final List list = new ArrayList<>(); assertThrows(NullPointerException.class, () -> assertFalse(IterableUtils.matchesAny(null, null)), @@ -317,7 +317,7 @@ public void matchesAny() { } @Test - public void matchesAll() { + public void testMatchesAll() { assertThrows(NullPointerException.class, () -> assertFalse(IterableUtils.matchesAll(null, null)), "predicate must not be null"); @@ -342,7 +342,7 @@ public void getFromIterable() throws Exception { } @Test - public void getFromIterableIndexOutOfBoundsException() throws Exception { + public void testGetFromIterableIndexOutOfBoundsException() throws Exception { // Collection, entry exists final Bag bag = new HashBag<>(); bag.add("element", 1); @@ -358,7 +358,7 @@ public void firstFromIterable() throws Exception { } @Test - public void firstFromIterableIndexOutOfBoundsException() throws Exception { + public void testFirstFromIterableIndexOutOfBoundsException() throws Exception { // Collection, entry exists final Bag bag = new HashBag<>(); // Collection, non-existent entry @@ -367,7 +367,7 @@ public void firstFromIterableIndexOutOfBoundsException() throws Exception { @SuppressWarnings("unchecked") @Test - public void partition() { + public void testPartition() { final List input = new ArrayList<>(); input.add(1); input.add(2); @@ -401,7 +401,7 @@ public void partition() { @SuppressWarnings("unchecked") @Test - public void partitionMultiplePredicates() { + public void testPartitionMultiplePredicates() { final List input = new ArrayList<>(); input.add(1); input.add(2); @@ -517,7 +517,7 @@ public void testToStringWithNullArguments() { } @Test - public void size() { + public void testSize() { assertEquals(0, IterableUtils.size(null)); } diff --git a/src/test/java/org/apache/commons/collections4/SetUtilsTest.java b/src/test/java/org/apache/commons/collections4/SetUtilsTest.java index 47d6b3b9db..c7fb0f76ff 100644 --- a/src/test/java/org/apache/commons/collections4/SetUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/SetUtilsTest.java @@ -44,7 +44,7 @@ public class SetUtilsTest { private Set setB; @Test - public void difference() { + public void testDifference() { final SetView set = SetUtils.difference(setA, setB); assertEquals(2, set.size()); assertTrue(set.contains(1)); @@ -64,7 +64,7 @@ public void difference() { } @Test - public void disjunction() { + public void testDisjunction() { final SetView set = SetUtils.disjunction(setA, setB); assertEquals(4, set.size()); assertTrue(set.contains(1)); @@ -86,7 +86,7 @@ public void disjunction() { } @Test - public void intersection() { + public void testIntersection() { final SetView set = SetUtils.intersection(setA, setB); assertEquals(3, set.size()); assertTrue(set.contains(3)); @@ -252,7 +252,7 @@ public void testUnmodifiableSetWrap() { } @Test - public void union() { + public void testUnion() { final SetView set = SetUtils.union(setA, setB); assertEquals(7, set.size()); assertTrue(set.containsAll(setA)); diff --git a/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionBuilderTest.java b/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionBuilderTest.java index 8c25f77763..d442db9957 100644 --- a/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionBuilderTest.java +++ b/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionBuilderTest.java @@ -41,7 +41,7 @@ public class PredicatedCollectionBuilderTest { * Verify that passing the Predicate means ending up in the buffer. */ @Test - public void addPass() { + public void testAddPass() { final PredicatedCollection.Builder builder = PredicatedCollection.notNullBuilder(); builder.add("test"); assertEquals(builder.createPredicatedList().size(), 1); @@ -51,7 +51,7 @@ public void addPass() { * Verify that failing the Predicate means NOT ending up in the buffer. */ @Test - public void addFail() { + public void testAddFail() { final PredicatedCollection.Builder builder = PredicatedCollection.notNullBuilder(); builder.add((String) null); assertTrue(builder.createPredicatedList().isEmpty()); @@ -63,14 +63,14 @@ public void addFail() { * Verify that only items that pass the Predicate end up in the buffer. */ @Test - public void addAllPass() { + public void testAddAllPass() { final PredicatedCollection.Builder builder = PredicatedCollection.notNullBuilder(); builder.addAll(Arrays.asList("test1", null, "test2")); assertEquals(builder.createPredicatedList().size(), 2); } @Test - public void createPredicatedCollectionWithNotNullPredicate() { + public void testCreatePredicatedCollectionWithNotNullPredicate() { final PredicatedCollection.Builder builder = PredicatedCollection.notNullBuilder(); builder.add("test1"); builder.add((String) null); @@ -99,7 +99,7 @@ private void checkPredicatedCollection1(final Collection collection) { } @Test - public void createPredicatedCollectionWithPredicate() { + public void testCreatePredicatedCollectionWithPredicate() { final OddPredicate p = new OddPredicate(); final PredicatedCollection.Builder builder = PredicatedCollection.builder(p); diff --git a/src/test/java/org/apache/commons/collections4/functors/AbstractClosureTest.java b/src/test/java/org/apache/commons/collections4/functors/AbstractClosureTest.java index 3806b81929..e07ee15342 100644 --- a/src/test/java/org/apache/commons/collections4/functors/AbstractClosureTest.java +++ b/src/test/java/org/apache/commons/collections4/functors/AbstractClosureTest.java @@ -24,7 +24,7 @@ public abstract class AbstractClosureTest { @Test - public void closureSanityTests() throws Exception { + public void testClosureSanityTests() throws Exception { final Closure closure = generateClosure(); assertNotNull(closure); } diff --git a/src/test/java/org/apache/commons/collections4/functors/AbstractPredicateTest.java b/src/test/java/org/apache/commons/collections4/functors/AbstractPredicateTest.java index 893b06bed3..4affab4c15 100644 --- a/src/test/java/org/apache/commons/collections4/functors/AbstractPredicateTest.java +++ b/src/test/java/org/apache/commons/collections4/functors/AbstractPredicateTest.java @@ -38,7 +38,7 @@ public void initializeTestObjects() throws Exception { } @Test - public void predicateSanityTests() throws Exception { + public void testPredicateSanityTests() throws Exception { final Predicate predicate = generatePredicate(); assertNotNull(predicate); } diff --git a/src/test/java/org/apache/commons/collections4/functors/AllPredicateTest.java b/src/test/java/org/apache/commons/collections4/functors/AllPredicateTest.java index d3e6975238..64558645ef 100644 --- a/src/test/java/org/apache/commons/collections4/functors/AllPredicateTest.java +++ b/src/test/java/org/apache/commons/collections4/functors/AllPredicateTest.java @@ -62,7 +62,7 @@ protected final Predicate getPredicateInstance(final Collection allPredicate = getPredicateInstance( Collections.>emptyList()); assertTrue(allPredicate.evaluate(getTestValue()), "empty collection not true"); @@ -81,7 +81,7 @@ public void emptyCollectionToGetInstance() { */ @SuppressWarnings("unchecked") @Test - public void oneTruePredicate() { + public void testOneTruePredicate() { // use the constructor directly, as getInstance() returns the original predicate when passed // an array of size one. final Predicate predicate = createMockPredicate(true); @@ -94,7 +94,7 @@ public void oneTruePredicate() { */ @SuppressWarnings("unchecked") @Test - public void oneFalsePredicate() { + public void testOneFalsePredicate() { // use the constructor directly, as getInstance() returns the original predicate when passed // an array of size one. final Predicate predicate = createMockPredicate(false); @@ -106,7 +106,7 @@ public void oneFalsePredicate() { * Tests whether multiple true predicates evaluates to true. */ @Test - public void allTrue() { + public void testAllTrue() { assertTrue(getPredicateInstance(true, true).evaluate(getTestValue()), "multiple true predicates evaluated to false"); assertTrue(getPredicateInstance(true, true, true).evaluate(getTestValue()), diff --git a/src/test/java/org/apache/commons/collections4/functors/ComparatorPredicateTest.java b/src/test/java/org/apache/commons/collections4/functors/ComparatorPredicateTest.java index c3a92a867e..77a11bd898 100644 --- a/src/test/java/org/apache/commons/collections4/functors/ComparatorPredicateTest.java +++ b/src/test/java/org/apache/commons/collections4/functors/ComparatorPredicateTest.java @@ -34,7 +34,7 @@ public int compare(final T first, final T second) { } @Test - public void compareEquals() { + public void testCompareEquals() { final Integer value = Integer.valueOf(10); final Predicate p = comparatorPredicate(value, new TestComparator<>()); assertPredicateFalse(p, Integer.valueOf(value.intValue() - 1)); @@ -43,7 +43,7 @@ public void compareEquals() { } @Test - public void compareGreater() { + public void testCompareGreater() { final Integer value = Integer.valueOf(10); final Predicate p = comparatorPredicate(value, new TestComparator<>(), Criterion.GREATER); assertPredicateTrue(p, Integer.valueOf(value.intValue() - 1)); @@ -52,7 +52,7 @@ public void compareGreater() { } @Test - public void compareLess() { + public void testCompareLess() { final Integer value = Integer.valueOf(10); final Predicate p = comparatorPredicate(value, new TestComparator<>(), Criterion.LESS); assertPredicateFalse(p, Integer.valueOf(value.intValue() - 1)); @@ -61,7 +61,7 @@ public void compareLess() { } @Test - public void compareGreaterOrEqual() { + public void testCompareGreaterOrEqual() { final Integer value = Integer.valueOf(10); final Predicate p = comparatorPredicate(value, new TestComparator<>(), Criterion.GREATER_OR_EQUAL); assertPredicateTrue(p, Integer.valueOf(value.intValue() - 1)); @@ -70,7 +70,7 @@ public void compareGreaterOrEqual() { } @Test - public void compareLessOrEqual() { + public void testCompareLessOrEqual() { final Integer value = Integer.valueOf(10); final Predicate p = comparatorPredicate(value, new TestComparator<>(), Criterion.LESS_OR_EQUAL); assertPredicateFalse(p, Integer.valueOf(value.intValue() - 1)); diff --git a/src/test/java/org/apache/commons/collections4/functors/EqualPredicateTest.java b/src/test/java/org/apache/commons/collections4/functors/EqualPredicateTest.java index 1695ab5c2d..5243725c16 100644 --- a/src/test/java/org/apache/commons/collections4/functors/EqualPredicateTest.java +++ b/src/test/java/org/apache/commons/collections4/functors/EqualPredicateTest.java @@ -39,7 +39,7 @@ public void testNullArgumentEqualsNullPredicate() throws Exception { } @Test - public void objectFactoryUsesEqualsForTest() throws Exception { + public void testObjectFactoryUsesEqualsForTest() throws Exception { final Predicate predicate = equalPredicate(FALSE_OBJECT); assertPredicateFalse(predicate, FALSE_OBJECT); assertPredicateTrue(equalPredicate(TRUE_OBJECT), TRUE_OBJECT); diff --git a/src/test/java/org/apache/commons/collections4/functors/NullPredicateTest.java b/src/test/java/org/apache/commons/collections4/functors/NullPredicateTest.java index d41d8dcdb6..1866a6bf42 100644 --- a/src/test/java/org/apache/commons/collections4/functors/NullPredicateTest.java +++ b/src/test/java/org/apache/commons/collections4/functors/NullPredicateTest.java @@ -30,7 +30,7 @@ public void testNullPredicate() { } @Test - public void ensurePredicateCanBeTypedWithoutWarning() throws Exception { + public void testEnsurePredicateCanBeTypedWithoutWarning() throws Exception { final Predicate predicate = NullPredicate.nullPredicate(); assertPredicateFalse(predicate, cString); } diff --git a/src/test/java/org/apache/commons/collections4/map/LazyMapTest.java b/src/test/java/org/apache/commons/collections4/map/LazyMapTest.java index 13311090db..2f74d2652b 100644 --- a/src/test/java/org/apache/commons/collections4/map/LazyMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/LazyMapTest.java @@ -56,7 +56,7 @@ public void testMapGet() { } @Test - public void mapGetWithFactory() { + public void testMapGetWithFactory() { Map map = lazyMap(new HashMap<>(), oneFactory); assertEquals(0, map.size()); final Number i1 = map.get("Five"); @@ -74,7 +74,7 @@ public void mapGetWithFactory() { } @Test - public void mapGetWithTransformer() { + public void testMapGetWithTransformer() { final Transformer intConverter = Number::intValue; final Map map = lazyMap(new HashMap<>(), intConverter); assertEquals(0, map.size()); 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 39429c955f..f4628279a1 100644 --- a/src/test/java/org/apache/commons/collections4/map/LazySortedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/LazySortedMapTest.java @@ -72,15 +72,9 @@ public boolean isAllowNullKey() { return false; } - // from LazyMapTest - @Test @Override - public void testMapGet() { - //TODO eliminate need for this via superclass - see svn history. - } - @Test - public void mapGet() { + public void testMapGet() { Map map = lazySortedMap(new TreeMap<>(), oneFactory); assertEquals(0, map.size()); final Number i1 = map.get(5);