You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2018/01/03 02:52:03 UTC
[2/3] commons-collections git commit: Use final.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
index 27fbd26..02c1fef 100644
--- a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java
@@ -731,21 +731,21 @@ public class CollectionUtilsTest extends MockTestCase {
lastElement = CollectionUtils.forAllButLastDo(col, testClosure);
assertNull(lastElement);
- Collection<String> strings = Arrays.asList("a", "b", "c");
+ final Collection<String> strings = Arrays.asList("a", "b", "c");
final StringBuffer result = new StringBuffer();
result.append(CollectionUtils.forAllButLastDo(strings, new Closure<String>() {
@Override
- public void execute(String input) {
+ public void execute(final String input) {
result.append(input+";");
}
}));
assertEquals("a;b;c", result.toString());
- Collection<String> oneString = Arrays.asList("a");
+ final Collection<String> oneString = Arrays.asList("a");
final StringBuffer resultOne = new StringBuffer();
resultOne.append(CollectionUtils.forAllButLastDo(oneString, new Closure<String>() {
@Override
- public void execute(String input) {
+ public void execute(final String input) {
resultOne.append(input+";");
}
}));
@@ -761,7 +761,7 @@ public class CollectionUtilsTest extends MockTestCase {
final Collection<List<? extends Number>> col = new ArrayList<>();
col.add(collectionA);
col.add(collectionB);
- List<? extends Number> lastElement = CollectionUtils.forAllButLastDo(col.iterator(), testClosure);
+ final List<? extends Number> lastElement = CollectionUtils.forAllButLastDo(col.iterator(), testClosure);
assertSame(lastElement, collectionB);
assertTrue(collectionA.isEmpty() && !collectionB.isEmpty());
@@ -1211,14 +1211,14 @@ public class CollectionUtilsTest extends MockTestCase {
@Test
public void selectWithOutputCollections() {
- List<Integer> input = new ArrayList<>();
+ final List<Integer> input = new ArrayList<>();
input.add(1);
input.add(2);
input.add(3);
input.add(4);
- List<Integer> output = new ArrayList<>();
- List<Integer> rejected = new ArrayList<>();
+ final List<Integer> output = new ArrayList<>();
+ final List<Integer> rejected = new ArrayList<>();
CollectionUtils.select(input, EQUALS_TWO, output, rejected);
@@ -1227,7 +1227,7 @@ public class CollectionUtilsTest extends MockTestCase {
assertEquals(2, CollectionUtils.extractSingleton(output).intValue());
// rejected contains 1, 3, and 4
- Integer[] expected = {1, 3, 4};
+ final Integer[] expected = {1, 3, 4};
Assert.assertArrayEquals(expected, rejected.toArray());
output.clear();
@@ -1363,7 +1363,7 @@ public class CollectionUtilsTest extends MockTestCase {
@Test
public void predicatedCollection() {
final Predicate<Object> predicate = PredicateUtils.instanceofPredicate(Integer.class);
- Collection<Number> collection = CollectionUtils.predicatedCollection(new ArrayList<Number>(), predicate);
+ final Collection<Number> collection = CollectionUtils.predicatedCollection(new ArrayList<Number>(), predicate);
assertTrue("returned object should be a PredicatedCollection", collection instanceof PredicatedCollection);
try {
CollectionUtils.predicatedCollection(new ArrayList<Number>(), null);
@@ -1538,7 +1538,7 @@ public class CollectionUtilsTest extends MockTestCase {
@Test
public void testTransformedCollection() {
final Transformer<Object, Object> transformer = TransformerUtils.nopTransformer();
- Collection<Object> collection = CollectionUtils.transformingCollection(new ArrayList<>(), transformer);
+ final Collection<Object> collection = CollectionUtils.transformingCollection(new ArrayList<>(), transformer);
assertTrue("returned object should be a TransformedCollection", collection instanceof TransformedCollection);
try {
CollectionUtils.transformingCollection(new ArrayList<>(), null);
@@ -1569,7 +1569,7 @@ public class CollectionUtilsTest extends MockTestCase {
@Test
@Deprecated
public void testSynchronizedCollection() {
- Collection<Object> col = CollectionUtils.synchronizedCollection(new ArrayList<>());
+ final Collection<Object> col = CollectionUtils.synchronizedCollection(new ArrayList<>());
assertTrue("Returned object should be a SynchronizedCollection.", col instanceof SynchronizedCollection);
try {
CollectionUtils.synchronizedCollection(null);
@@ -1582,7 +1582,7 @@ public class CollectionUtilsTest extends MockTestCase {
@Test
@Deprecated
public void testUnmodifiableCollection() {
- Collection<Object> col = CollectionUtils.unmodifiableCollection(new ArrayList<>());
+ final Collection<Object> col = CollectionUtils.unmodifiableCollection(new ArrayList<>());
assertTrue("Returned object should be a UnmodifiableCollection.", col instanceof UnmodifiableCollection);
try {
CollectionUtils.unmodifiableCollection(null);
@@ -1768,7 +1768,7 @@ public class CollectionUtilsTest extends MockTestCase {
List<Integer> result2 = CollectionUtils.collate(collectionE, collectionD);
assertEquals("Merge two lists 1", result1, result2);
- List<Integer> combinedList = new ArrayList<>();
+ final List<Integer> combinedList = new ArrayList<>();
combinedList.addAll(collectionD);
combinedList.addAll(collectionE);
Collections.sort(combinedList);
@@ -1793,14 +1793,14 @@ public class CollectionUtilsTest extends MockTestCase {
@Test
public void testCollateIgnoreDuplicates() {
- List<Integer> result1 = CollectionUtils.collate(collectionD, collectionE, false);
- List<Integer> result2 = CollectionUtils.collate(collectionE, collectionD, false);
+ final List<Integer> result1 = CollectionUtils.collate(collectionD, collectionE, false);
+ final List<Integer> result2 = CollectionUtils.collate(collectionE, collectionD, false);
assertEquals("Merge two lists 1 - ignore duplicates", result1, result2);
- Set<Integer> combinedSet = new HashSet<>();
+ final Set<Integer> combinedSet = new HashSet<>();
combinedSet.addAll(collectionD);
combinedSet.addAll(collectionE);
- List<Integer> combinedList = new ArrayList<>(combinedSet);
+ final List<Integer> combinedList = new ArrayList<>(combinedSet);
Collections.sort(combinedList);
assertEquals("Merge two lists 2 - ignore duplicates", combinedList, result2);
@@ -1813,11 +1813,11 @@ public class CollectionUtilsTest extends MockTestCase {
@Test
public void testPermutations() {
- List<Integer> sample = collectionA.subList(0, 5);
- Collection<List<Integer>> permutations = CollectionUtils.permutations(sample);
+ final List<Integer> sample = collectionA.subList(0, 5);
+ final Collection<List<Integer>> permutations = CollectionUtils.permutations(sample);
// result size = n!
- int collSize = sample.size();
+ final int collSize = sample.size();
int factorial = 1;
for (int i = 1; i <= collSize; i++) {
factorial *= i;
@@ -1831,17 +1831,17 @@ public class CollectionUtilsTest extends MockTestCase {
assertFalse(CollectionUtils.matchesAll(null, null));
assertFalse(CollectionUtils.matchesAll(collectionA, null));
- Predicate<Integer> lessThanFive = new Predicate<Integer>() {
+ final Predicate<Integer> lessThanFive = new Predicate<Integer>() {
@Override
- public boolean evaluate(Integer object) {
+ public boolean evaluate(final Integer object) {
return object < 5;
}
};
assertTrue(CollectionUtils.matchesAll(collectionA, lessThanFive));
- Predicate<Integer> lessThanFour = new Predicate<Integer>() {
+ final Predicate<Integer> lessThanFour = new Predicate<Integer>() {
@Override
- public boolean evaluate(Integer object) {
+ public boolean evaluate(final Integer object) {
return object < 4;
}
};
@@ -1867,12 +1867,12 @@ public class CollectionUtilsTest extends MockTestCase {
final Collection<String> result = CollectionUtils.removeAll(base, remove, new Equator<String>() {
@Override
- public boolean equate(String o1, String o2) {
+ public boolean equate(final String o1, final String o2) {
return o1.charAt(1) == o2.charAt(1);
}
@Override
- public int hash(String o) {
+ public int hash(final String o) {
return o.charAt(1);
}
});
@@ -1919,12 +1919,12 @@ public class CollectionUtilsTest extends MockTestCase {
final Collection<String> result = CollectionUtils.retainAll(base, retain, new Equator<String>() {
@Override
- public boolean equate(String o1, String o2) {
+ public boolean equate(final String o1, final String o2) {
return o1.charAt(1) == o2.charAt(1);
}
@Override
- public int hash(String o) {
+ public int hash(final String o) {
return o.charAt(1);
}
});
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/ComparatorUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/ComparatorUtilsTest.java b/src/test/java/org/apache/commons/collections4/ComparatorUtilsTest.java
index e8fabd4..040974a 100644
--- a/src/test/java/org/apache/commons/collections4/ComparatorUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/ComparatorUtilsTest.java
@@ -46,7 +46,7 @@ public class ComparatorUtilsTest {
@Test
public void chainedComparator() {
// simple test: chain 2 natural comparators
- Comparator<Integer> comp = ComparatorUtils.chainedComparator(ComparatorUtils.<Integer>naturalComparator(),
+ final Comparator<Integer> comp = ComparatorUtils.chainedComparator(ComparatorUtils.<Integer>naturalComparator(),
ComparatorUtils.<Integer>naturalComparator());
assertTrue(comp.compare(1, 2) < 0);
assertTrue(comp.compare(1, 1) == 0);
@@ -55,7 +55,7 @@ public class ComparatorUtilsTest {
@Test
public void max() {
- Comparator<Integer> reversed =
+ final Comparator<Integer> reversed =
ComparatorUtils.reversedComparator(ComparatorUtils.<Integer>naturalComparator());
assertEquals(Integer.valueOf(10), ComparatorUtils.max(1, 10, null));
@@ -67,21 +67,21 @@ public class ComparatorUtilsTest {
try {
ComparatorUtils.max(1, null, null);
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
try {
ComparatorUtils.max(null, 10, null);
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
}
@Test
public void min() {
- Comparator<Integer> reversed =
+ final Comparator<Integer> reversed =
ComparatorUtils.reversedComparator(ComparatorUtils.<Integer>naturalComparator());
assertEquals(Integer.valueOf(1), ComparatorUtils.min(1, 10, null));
@@ -93,21 +93,21 @@ public class ComparatorUtilsTest {
try {
ComparatorUtils.min(1, null, null);
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
try {
ComparatorUtils.min(null, 10, null);
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
}
@Test
public void nullLowComparator() {
- Comparator<Integer> comp = ComparatorUtils.nullLowComparator(null);
+ final Comparator<Integer> comp = ComparatorUtils.nullLowComparator(null);
assertTrue(comp.compare(null, 10) < 0);
assertTrue(comp.compare(null, null) == 0);
assertTrue(comp.compare(10, null) > 0);
@@ -115,7 +115,7 @@ public class ComparatorUtilsTest {
@Test
public void nullHighComparator() {
- Comparator<Integer> comp = ComparatorUtils.nullHighComparator(null);
+ final Comparator<Integer> comp = ComparatorUtils.nullHighComparator(null);
assertTrue(comp.compare(null, 10) > 0);
assertTrue(comp.compare(null, null) == 0);
assertTrue(comp.compare(10, null) < 0);
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java b/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java
index 697caac..5dcfcea 100644
--- a/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/FactoryUtilsTest.java
@@ -110,7 +110,7 @@ public class FactoryUtilsTest {
@Test
public void testPrototypeFactoryPublicCopyConstructor() throws Exception {
final Mock1 proto = new Mock1(6);
- Factory<Object> factory = FactoryUtils.<Object>prototypeFactory(proto);
+ final Factory<Object> factory = FactoryUtils.<Object>prototypeFactory(proto);
assertNotNull(factory);
final Object created = factory.create();
assertTrue(proto != created);
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/FluentIterableTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/FluentIterableTest.java b/src/test/java/org/apache/commons/collections4/FluentIterableTest.java
index 02b39eb..aca8d70 100644
--- a/src/test/java/org/apache/commons/collections4/FluentIterableTest.java
+++ b/src/test/java/org/apache/commons/collections4/FluentIterableTest.java
@@ -71,7 +71,7 @@ public class FluentIterableTest {
@Before
public void setUp() {
- Collection<Integer> collectionA = new ArrayList<>();
+ final Collection<Integer> collectionA = new ArrayList<>();
collectionA.add(1);
collectionA.add(2);
collectionA.add(2);
@@ -84,7 +84,7 @@ public class FluentIterableTest {
collectionA.add(4);
iterableA = collectionA;
- Collection<Long> collectionB = new LinkedList<>();
+ final Collection<Long> collectionB = new LinkedList<>();
collectionB.add(5L);
collectionB.add(4L);
collectionB.add(4L);
@@ -129,14 +129,14 @@ public class FluentIterableTest {
try {
FluentIterable.of(it).toList();
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
}
@Test
public void appendElements() {
- FluentIterable<Integer> it = FluentIterable.of(iterableA).append(10, 20, 30);
+ final FluentIterable<Integer> it = FluentIterable.of(iterableA).append(10, 20, 30);
assertEquals(IterableUtils.size(iterableA) + 3, IterableUtils.size(it));
assertTrue(IterableUtils.contains(it, 1));
assertTrue(IterableUtils.contains(it, 10));
@@ -144,14 +144,14 @@ public class FluentIterableTest {
assertTrue(IterableUtils.contains(it, 30));
assertFalse(IterableUtils.contains(it, 40));
- FluentIterable<Integer> empty = FluentIterable.of(emptyIterable).append();
+ final FluentIterable<Integer> empty = FluentIterable.of(emptyIterable).append();
assertTrue(IterableUtils.isEmpty(empty));
}
@Test
public void appendIterable() {
- List<Integer> listB = Arrays.asList(10, 20, 30);
- FluentIterable<Integer> it = FluentIterable.of(iterableA).append(listB);
+ final List<Integer> listB = Arrays.asList(10, 20, 30);
+ final FluentIterable<Integer> it = FluentIterable.of(iterableA).append(listB);
assertEquals(IterableUtils.size(iterableA) + listB.size(), IterableUtils.size(it));
assertTrue(IterableUtils.contains(it, 1));
assertTrue(IterableUtils.contains(it, 10));
@@ -162,8 +162,8 @@ public class FluentIterableTest {
@Test
public void collate() {
- List<Integer> result = FluentIterable.of(iterableOdd).collate(iterableEven).toList();
- List<Integer> combinedList = new ArrayList<>();
+ final List<Integer> result = FluentIterable.of(iterableOdd).collate(iterableEven).toList();
+ final List<Integer> combinedList = new ArrayList<>();
CollectionUtils.addAll(combinedList, iterableOdd);
CollectionUtils.addAll(combinedList, iterableEven);
Collections.sort(combinedList);
@@ -172,7 +172,7 @@ public class FluentIterableTest {
try {
FluentIterable.of(iterableOdd).collate(null).toList();
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
}
@@ -185,7 +185,7 @@ public class FluentIterableTest {
.collate(iterableEven, ComparatorUtils.<Integer>naturalComparator())
.toList();
- List<Integer> combinedList = new ArrayList<>();
+ final List<Integer> combinedList = new ArrayList<>();
CollectionUtils.addAll(combinedList, iterableOdd);
CollectionUtils.addAll(combinedList, iterableEven);
Collections.sort(combinedList);
@@ -198,9 +198,9 @@ public class FluentIterableTest {
@Test
public void filter() {
- Predicate<Integer> smallerThan3 = new Predicate<Integer>() {
+ final Predicate<Integer> smallerThan3 = new Predicate<Integer>() {
@Override
- public boolean evaluate(Integer object) {
+ public boolean evaluate(final Integer object) {
return object.intValue() < 3;
}
};
@@ -215,7 +215,7 @@ public class FluentIterableTest {
try {
FluentIterable.of(iterableA).filter(null).toList();
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
}
@@ -223,16 +223,16 @@ public class FluentIterableTest {
@Test
public void forEach() {
final AtomicInteger sum = new AtomicInteger(0);
- Closure<Integer> closure = new Closure<Integer>() {
+ final Closure<Integer> closure = new Closure<Integer>() {
@Override
- public void execute(Integer input) {
+ public void execute(final Integer input) {
sum.addAndGet(input);
}
};
FluentIterable.of(iterableA).forEach(closure);
int expectedSum = 0;
- for (Integer i : iterableA) {
+ for (final Integer i : iterableA) {
expectedSum += i;
}
assertEquals(expectedSum, sum.get());
@@ -240,7 +240,7 @@ public class FluentIterableTest {
try {
FluentIterable.of(iterableA).forEach((Closure<Integer>) null);
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
}
@@ -253,7 +253,7 @@ public class FluentIterableTest {
// limit larger than input
result = FluentIterable.of(iterableA).limit(100).toList();
- List<Integer> expected = IterableUtils.toList(iterableA);
+ final List<Integer> expected = IterableUtils.toList(iterableA);
assertEquals(expected.size(), result.size());
assertEquals(expected, result);
@@ -268,7 +268,7 @@ public class FluentIterableTest {
try {
FluentIterable.of(iterableA).limit(-2).toList();
fail("expecting IllegalArgumentException");
- } catch (IllegalArgumentException iae) {
+ } catch (final IllegalArgumentException iae) {
// expected
}
}
@@ -276,7 +276,7 @@ public class FluentIterableTest {
@Test
public void reverse() {
List<Integer> result = FluentIterable.of(iterableA).reverse().toList();
- List<Integer> expected = IterableUtils.toList(iterableA);
+ final List<Integer> expected = IterableUtils.toList(iterableA);
Collections.reverse(expected);
assertEquals(expected, result);
@@ -297,7 +297,7 @@ public class FluentIterableTest {
// skip 0 elements
result = FluentIterable.of(iterableA).skip(0).toList();
- List<Integer> expected = IterableUtils.toList(iterableA);
+ final List<Integer> expected = IterableUtils.toList(iterableA);
assertEquals(expected.size(), result.size());
assertEquals(expected, result);
@@ -308,16 +308,16 @@ public class FluentIterableTest {
try {
FluentIterable.of(iterableA).skip(-4).toList();
fail("expecting IllegalArgumentException");
- } catch (IllegalArgumentException iae) {
+ } catch (final IllegalArgumentException iae) {
// expected
}
}
@Test
public void transform() {
- Transformer<Integer, Integer> squared = new Transformer<Integer, Integer>() {
+ final Transformer<Integer, Integer> squared = new Transformer<Integer, Integer>() {
@Override
- public Integer transform(Integer object) {
+ public Integer transform(final Integer object) {
return object * object;
}
};
@@ -332,7 +332,7 @@ public class FluentIterableTest {
try {
FluentIterable.of(iterableA).transform(null).toList();
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
}
@@ -350,18 +350,18 @@ public class FluentIterableTest {
@Test
public void unmodifiable() {
- FluentIterable<Integer> iterable1 = FluentIterable.of(iterableA).unmodifiable();
- Iterator<Integer> it = iterable1.iterator();
+ final FluentIterable<Integer> iterable1 = FluentIterable.of(iterableA).unmodifiable();
+ final Iterator<Integer> it = iterable1.iterator();
assertEquals(1, it.next().intValue());
try {
it.remove();
fail("expecting UnsupportedOperationException");
- } catch (UnsupportedOperationException ise) {
+ } catch (final UnsupportedOperationException ise) {
// expected
}
// calling unmodifiable on an already unmodifiable iterable shall return the same instance
- FluentIterable<Integer> iterable2 = iterable1.unmodifiable();
+ final FluentIterable<Integer> iterable2 = iterable1.unmodifiable();
assertSame(iterable1, iterable2);
}
@@ -378,7 +378,7 @@ public class FluentIterableTest {
try {
FluentIterable.of(iterableOdd).zip((Iterable<Integer>) null).toList();
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
@@ -393,7 +393,7 @@ public class FluentIterableTest {
@Test
public void asEnumeration() {
Enumeration<Long> enumeration = FluentIterable.of(iterableB).asEnumeration();
- List<Long> result = EnumerationUtils.toList(enumeration);
+ final List<Long> result = EnumerationUtils.toList(enumeration);
assertEquals(iterableB, result);
enumeration = FluentIterable.<Long>empty().asEnumeration();
@@ -409,7 +409,7 @@ public class FluentIterableTest {
try {
FluentIterable.of(iterableEven).allMatch(null);
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
}
@@ -423,7 +423,7 @@ public class FluentIterableTest {
try {
FluentIterable.of(iterableEven).anyMatch(null);
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
}
@@ -439,7 +439,7 @@ public class FluentIterableTest {
try {
FluentIterable.of((Iterable<?>) null).size();
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
assertEquals(0, FluentIterable.of(emptyIterable).size());
@@ -448,10 +448,10 @@ public class FluentIterableTest {
@Test
public void eval() {
- List<Integer> listNumbers = new ArrayList<>();
+ final List<Integer> listNumbers = new ArrayList<>();
listNumbers.addAll(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
- FluentIterable<Integer> iterable = FluentIterable.of(listNumbers).filter(EVEN);
- FluentIterable<Integer> materialized = iterable.eval();
+ final FluentIterable<Integer> iterable = FluentIterable.of(listNumbers).filter(EVEN);
+ final FluentIterable<Integer> materialized = iterable.eval();
listNumbers.addAll(Arrays.asList(11, 12, 13, 14, 15, 16, 17, 18, 19, 20));
assertEquals(5, materialized.size());
@@ -493,7 +493,7 @@ public class FluentIterableTest {
try {
FluentIterable.of(iterableA).copyInto(null);
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
}
@@ -514,14 +514,14 @@ public class FluentIterableTest {
try {
FluentIterable.of(iterableEven).get(-1);
fail("expecting IndexOutOfBoundsException");
- } catch (IndexOutOfBoundsException ioe) {
+ } catch (final IndexOutOfBoundsException ioe) {
// expected
}
try {
FluentIterable.of(iterableEven).get(IterableUtils.size(iterableEven));
fail("expecting IndexOutOfBoundsException");
- } catch (IndexOutOfBoundsException ioe) {
+ } catch (final IndexOutOfBoundsException ioe) {
// expected
}
}
@@ -529,14 +529,14 @@ public class FluentIterableTest {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void toArray() {
- Long[] arr = new Long[] {1L, 2L, 3L, 4L, 5L};
- Long[] result = FluentIterable.of(arr).toArray(Long.class);
+ final Long[] arr = new Long[] {1L, 2L, 3L, 4L, 5L};
+ final Long[] result = FluentIterable.of(arr).toArray(Long.class);
assertNotNull(result);
assertArrayEquals(arr, result);
try {
FluentIterable.of(arr).toArray((Class) String.class);
- } catch (ArrayStoreException ase) {
+ } catch (final ArrayStoreException ase) {
// expected
}
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java b/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java
index 59ff2bb..494592c 100644
--- a/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/IterableUtilsTest.java
@@ -62,7 +62,7 @@ public class IterableUtilsTest {
@Before
public void setUp() {
- Collection<Integer> collectionA = new ArrayList<>();
+ final Collection<Integer> collectionA = new ArrayList<>();
collectionA.add(1);
collectionA.add(2);
collectionA.add(2);
@@ -75,7 +75,7 @@ public class IterableUtilsTest {
collectionA.add(4);
iterableA = collectionA;
- Collection<Long> collectionB = new LinkedList<>();
+ final Collection<Long> collectionB = new LinkedList<>();
collectionB.add(5L);
collectionB.add(4L);
collectionB.add(4L);
@@ -123,7 +123,7 @@ public class IterableUtilsTest {
try {
IterableUtils.forEach(col, null);
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
@@ -161,7 +161,7 @@ public class IterableUtilsTest {
try {
IterableUtils.forEachButLast(col, null);
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
@@ -184,12 +184,12 @@ public class IterableUtilsTest {
final Equator<String> secondLetterEquator = new Equator<String>() {
@Override
- public boolean equate(String o1, String o2) {
+ public boolean equate(final String o1, final String o2) {
return o1.charAt(1) == o2.charAt(1);
}
@Override
- public int hash(String o) {
+ public int hash(final String o) {
return o.charAt(1);
}
@@ -228,8 +228,8 @@ public class IterableUtilsTest {
// Ensure that generic bounds accept valid parameters, but return
// expected results
// e.g. no longs in the "int" Iterable<Number>, and vice versa.
- Iterable<Number> iterableIntAsNumber = Arrays.<Number>asList(1, 2, 3, 4, 5);
- Iterable<Number> iterableLongAsNumber = Arrays.<Number>asList(1L, 2L, 3L, 4L, 5L);
+ final Iterable<Number> iterableIntAsNumber = Arrays.<Number>asList(1, 2, 3, 4, 5);
+ final Iterable<Number> iterableLongAsNumber = Arrays.<Number>asList(1L, 2L, 3L, 4L, 5L);
assertEquals(0, IterableUtils.frequency(iterableIntAsNumber, 2L));
assertEquals(0, IterableUtils.frequency(iterableLongAsNumber, 2));
@@ -316,14 +316,14 @@ public class IterableUtilsTest {
try {
assertEquals(0, IterableUtils.countMatches(iterableA, null));
fail("predicate must not be null");
- } catch (NullPointerException ex) {
+ } catch (final NullPointerException ex) {
// expected
}
try {
assertEquals(0, IterableUtils.countMatches(null, null));
fail("predicate must not be null");
- } catch (NullPointerException ex) {
+ } catch (final NullPointerException ex) {
// expected
}
}
@@ -335,14 +335,14 @@ public class IterableUtilsTest {
try {
assertFalse(IterableUtils.matchesAny(null, null));
fail("predicate must not be null");
- } catch (NullPointerException ex) {
+ } catch (final NullPointerException ex) {
// expected
}
try {
assertFalse(IterableUtils.matchesAny(list, null));
fail("predicate must not be null");
- } catch (NullPointerException ex) {
+ } catch (final NullPointerException ex) {
// expected
}
@@ -362,28 +362,28 @@ public class IterableUtilsTest {
try {
assertFalse(IterableUtils.matchesAll(null, null));
fail("predicate must not be null");
- } catch (NullPointerException ex) {
+ } catch (final NullPointerException ex) {
// expected
}
try {
assertFalse(IterableUtils.matchesAll(iterableA, null));
fail("predicate must not be null");
- } catch (NullPointerException ex) {
+ } catch (final NullPointerException ex) {
// expected
}
- Predicate<Integer> lessThanFive = new Predicate<Integer>() {
+ final Predicate<Integer> lessThanFive = new Predicate<Integer>() {
@Override
- public boolean evaluate(Integer object) {
+ public boolean evaluate(final Integer object) {
return object < 5;
}
};
assertTrue(IterableUtils.matchesAll(iterableA, lessThanFive));
- Predicate<Integer> lessThanFour = new Predicate<Integer>() {
+ final Predicate<Integer> lessThanFour = new Predicate<Integer>() {
@Override
- public boolean evaluate(Integer object) {
+ public boolean evaluate(final Integer object) {
return object < 4;
}
};
@@ -407,7 +407,7 @@ public class IterableUtilsTest {
@SuppressWarnings("unchecked")
@Test
public void partition() {
- List<Integer> input = new ArrayList<>();
+ final List<Integer> input = new ArrayList<>();
input.add(1);
input.add(2);
input.add(3);
@@ -421,7 +421,7 @@ public class IterableUtilsTest {
assertEquals(2, CollectionUtils.extractSingleton(partition).intValue());
// second partition contains 1, 3, and 4
- Integer[] expected = {1, 3, 4};
+ final Integer[] expected = {1, 3, 4};
partition = partitions.get(1);
Assert.assertArrayEquals(expected, partition.toArray());
@@ -437,7 +437,7 @@ public class IterableUtilsTest {
try {
IterableUtils.partition(input, (Predicate<Integer>) null);
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
}
@@ -445,12 +445,12 @@ public class IterableUtilsTest {
@SuppressWarnings("unchecked")
@Test
public void partitionMultiplePredicates() {
- List<Integer> input = new ArrayList<>();
+ final List<Integer> input = new ArrayList<>();
input.add(1);
input.add(2);
input.add(3);
input.add(4);
- List<List<Integer>> partitions = IterableUtils.partition(input, EQUALS_TWO, EVEN);
+ final List<List<Integer>> partitions = IterableUtils.partition(input, EQUALS_TWO, EVEN);
// first partition contains 2
Collection<Integer> partition = partitions.get(0);
@@ -463,13 +463,13 @@ public class IterableUtilsTest {
assertEquals(4, partition.iterator().next().intValue());
// third partition contains 1 and 3
- Integer[] expected = {1, 3};
+ final Integer[] expected = {1, 3};
partition = partitions.get(2);
Assert.assertArrayEquals(expected, partition.toArray());
try {
IterableUtils.partition(input, EQUALS_TWO, null);
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
}
@@ -487,7 +487,7 @@ public class IterableUtilsTest {
result = IterableUtils.toString(iterableA, new Transformer<Integer, String>() {
@Override
- public String transform(Integer input) {
+ public String transform(final Integer input) {
return new Integer(input * 2).toString();
}
});
@@ -495,7 +495,7 @@ public class IterableUtilsTest {
result = IterableUtils.toString(new ArrayList<Integer>(), new Transformer<Integer, String>() {
@Override
- public String transform(Integer input) {
+ public String transform(final Integer input) {
fail("not supposed to reach here");
return "";
}
@@ -504,7 +504,7 @@ public class IterableUtilsTest {
result = IterableUtils.toString(null, new Transformer<Integer, String>() {
@Override
- public String transform(Integer input) {
+ public String transform(final Integer input) {
fail("not supposed to reach here");
return "";
}
@@ -515,9 +515,9 @@ public class IterableUtilsTest {
@Test
public void testToStringDelimiter() {
- Transformer<Integer, String> transformer = new Transformer<Integer, String>() {
+ final Transformer<Integer, String> transformer = new Transformer<Integer, String>() {
@Override
- public String transform(Integer input) {
+ public String transform(final Integer input) {
return new Integer(input * 2).toString();
}
};
@@ -552,9 +552,9 @@ public class IterableUtilsTest {
@Test
public void testToStringWithNullArguments() {
- String result = IterableUtils.toString(null, new Transformer<Integer, String>() {
+ final String result = IterableUtils.toString(null, new Transformer<Integer, String>() {
@Override
- public String transform(Integer input) {
+ public String transform(final Integer input) {
fail("not supposed to reach here");
return "";
}
@@ -571,7 +571,7 @@ public class IterableUtilsTest {
try {
IterableUtils.toString(new ArrayList<Integer>(), new Transformer<Integer, String>() {
@Override
- public String transform(Integer input) {
+ public String transform(final Integer input) {
fail("not supposed to reach here");
return "";
}
@@ -584,7 +584,7 @@ public class IterableUtilsTest {
try {
IterableUtils.toString(new ArrayList<Integer>(), new Transformer<Integer, String>() {
@Override
- public String transform(Integer input) {
+ public String transform(final Integer input) {
fail("not supposed to reach here");
return "";
}
@@ -597,7 +597,7 @@ public class IterableUtilsTest {
try {
IterableUtils.toString(new ArrayList<Integer>(), new Transformer<Integer, String>() {
@Override
- public String transform(Integer input) {
+ public String transform(final Integer input) {
fail("not supposed to reach here");
return "";
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java b/src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java
index 09fe803..7210388 100644
--- a/src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/IteratorUtilsTest.java
@@ -960,14 +960,14 @@ public class IteratorUtilsTest {
try {
IteratorUtils.collatedIterator(null, collectionOdd.iterator(), null);
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
try {
IteratorUtils.collatedIterator(null, null, collectionEven.iterator());
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
@@ -978,7 +978,7 @@ public class IteratorUtilsTest {
List<Integer> result = IteratorUtils.toList(it);
assertEquals(12, result.size());
- List<Integer> combinedList = new ArrayList<>();
+ final List<Integer> combinedList = new ArrayList<>();
combinedList.addAll(collectionOdd);
combinedList.addAll(collectionEven);
Collections.sort(combinedList);
@@ -1021,7 +1021,7 @@ public class IteratorUtilsTest {
try {
IteratorUtils.forEach(col.iterator(), null);
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
@@ -1051,7 +1051,7 @@ public class IteratorUtilsTest {
try {
IteratorUtils.forEachButLast(col.iterator(), null);
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/ListUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/ListUtilsTest.java b/src/test/java/org/apache/commons/collections4/ListUtilsTest.java
index fee6460..69747b7 100644
--- a/src/test/java/org/apache/commons/collections4/ListUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/ListUtilsTest.java
@@ -128,7 +128,7 @@ public class ListUtilsTest {
return o instanceof String;
}
};
- List<Object> list = ListUtils.predicatedList(new ArrayList<>(), predicate);
+ final List<Object> list = ListUtils.predicatedList(new ArrayList<>(), predicate);
assertTrue("returned object should be a PredicatedList", list instanceof PredicatedList);
try {
ListUtils.predicatedList(new ArrayList<>(), null);
@@ -339,20 +339,20 @@ public class ListUtilsTest {
List<Character> lcs = ListUtils.longestCommonSubsequence(Collections.EMPTY_LIST, Collections.EMPTY_LIST);
assertEquals(0, lcs.size());
- List<Character> list1 = Arrays.asList('B', 'A', 'N', 'A', 'N', 'A');
- List<Character> list2 = Arrays.asList('A', 'N', 'A', 'N', 'A', 'S');
+ final List<Character> list1 = Arrays.asList('B', 'A', 'N', 'A', 'N', 'A');
+ final List<Character> list2 = Arrays.asList('A', 'N', 'A', 'N', 'A', 'S');
lcs = ListUtils.longestCommonSubsequence(list1, list2);
List<Character> expected = Arrays.asList('A', 'N', 'A', 'N', 'A');
assertEquals(expected, lcs);
- List<Character> list3 = Arrays.asList('A', 'T', 'A', 'N', 'A');
+ final List<Character> list3 = Arrays.asList('A', 'T', 'A', 'N', 'A');
lcs = ListUtils.longestCommonSubsequence(list1, list3);
expected = Arrays.asList('A', 'A', 'N', 'A');
assertEquals(expected, lcs);
- List<Character> listZorro = Arrays.asList('Z', 'O', 'R', 'R', 'O');
+ final List<Character> listZorro = Arrays.asList('Z', 'O', 'R', 'R', 'O');
lcs = ListUtils.longestCommonSubsequence(list1, listZorro);
assertTrue(lcs.isEmpty());
@@ -379,18 +379,18 @@ public class ListUtilsTest {
String lcs = ListUtils.longestCommonSubsequence("", "");
assertEquals(0, lcs.length());
- String banana = "BANANA";
- String ananas = "ANANAS";
+ final String banana = "BANANA";
+ final String ananas = "ANANAS";
lcs = ListUtils.longestCommonSubsequence(banana, ananas);
assertEquals("ANANA", lcs);
- String atana = "ATANA";
+ final String atana = "ATANA";
lcs = ListUtils.longestCommonSubsequence(banana, atana);
assertEquals("AANA", lcs);
- String zorro = "ZORRO";
+ final String zorro = "ZORRO";
lcs = ListUtils.longestCommonSubsequence(banana, zorro);
assertEquals(0, lcs.length());
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
index 879a605..676a3ab 100644
--- a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
@@ -57,7 +57,7 @@ import org.junit.Test;
@SuppressWarnings("boxing")
public class MapUtilsTest extends AbstractAvailableLocalesTest {
- public MapUtilsTest(Locale locale) {
+ public MapUtilsTest(final Locale locale) {
super(locale);
}
@@ -73,7 +73,7 @@ public class MapUtilsTest extends AbstractAvailableLocalesTest {
@Test
public void testPredicatedMap() {
final Predicate<Object> p = getPredicate();
- Map<Object, Object> map = MapUtils.predicatedMap(new HashMap<>(), p, p);
+ final Map<Object, Object> map = MapUtils.predicatedMap(new HashMap<>(), p, p);
assertTrue("returned object should be a PredicatedMap", map instanceof PredicatedMap);
try {
MapUtils.predicatedMap(null, p, p);
@@ -832,13 +832,13 @@ public class MapUtilsTest extends AbstractAvailableLocalesTest {
int key;
String name;
- public X(int key, String name) {
+ public X(final int key, final String name) {
this.key = key;
this.name = name;
}
@Override
- public int compareTo(X o) {
+ public int compareTo(final X o) {
return key - o.key | name.compareTo(o.name);
}
@@ -858,7 +858,7 @@ public class MapUtilsTest extends AbstractAvailableLocalesTest {
final MultiValueMap<Integer, X> map = MultiValueMap.multiValueMap(new TreeMap<Integer, Collection<X>>());
MapUtils.populateMap(map, list, new Transformer<X, Integer>() {
@Override
- public Integer transform(X input) {
+ public Integer transform(final X input) {
return input.key;
}
}, TransformerUtils.<X> nopTransformer());
@@ -959,7 +959,7 @@ public class MapUtilsTest extends AbstractAvailableLocalesTest {
final Map<String, String> inStr = new HashMap<>();
- char decimalSeparator = getDecimalSeparator();
+ final char decimalSeparator = getDecimalSeparator();
inStr.put("str1", "2" + decimalSeparator + "0");
assertEquals(MapUtils.getDoubleValue(inStr,"str1", 0.0), 2.0, 0);
@@ -978,7 +978,7 @@ public class MapUtilsTest extends AbstractAvailableLocalesTest {
assertEquals(1.0, MapUtils.getFloat(in,"noKey", 1.0f), 0);
final Map<String, String> inStr = new HashMap<>();
- char decimalSeparator = getDecimalSeparator();
+ final char decimalSeparator = getDecimalSeparator();
inStr.put("str1", "2" + decimalSeparator + "0");
assertEquals(MapUtils.getFloatValue(inStr,"str1", 0.0f), 2.0, 0);
@@ -1152,12 +1152,12 @@ public class MapUtilsTest extends AbstractAvailableLocalesTest {
final Map<String, String> inMap = new HashMap<>();
inMap.put("key1", "value1");
inMap.put("key2", "value2");
- Map<String, String> map = MapUtils.orderedMap(inMap);
+ final Map<String, String> map = MapUtils.orderedMap(inMap);
assertTrue("returned object should be a OrderedMap", map instanceof OrderedMap);
}
private char getDecimalSeparator() {
- NumberFormat numberFormat = NumberFormat.getInstance();
+ final NumberFormat numberFormat = NumberFormat.getInstance();
if (numberFormat instanceof DecimalFormat) {
return ((DecimalFormat) numberFormat).getDecimalFormatSymbols().getDecimalSeparator();
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/MultiMapUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/MultiMapUtilsTest.java b/src/test/java/org/apache/commons/collections4/MultiMapUtilsTest.java
index 4e14559..4806ba0 100644
--- a/src/test/java/org/apache/commons/collections4/MultiMapUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/MultiMapUtilsTest.java
@@ -44,7 +44,7 @@ public class MultiMapUtilsTest {
try {
map.put("key", "value");
fail("Should throw UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
}
@@ -55,7 +55,7 @@ public class MultiMapUtilsTest {
try {
map.put("key", "value");
fail("Should throw UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
}
@@ -91,14 +91,14 @@ public class MultiMapUtilsTest {
public void testGetCollection() {
assertNull(MultiMapUtils.getCollection(null, "key1"));
- String values[] = { "v1", "v2", "v3" };
+ final String values[] = { "v1", "v2", "v3" };
final MultiValuedMap<String, String> map = new ArrayListValuedHashMap<>();
- for (String val : values) {
+ for (final String val : values) {
map.put("key1", val);
}
- Collection<String> col = MultiMapUtils.getCollection(map, "key1");
- for (String val : values) {
+ final Collection<String> col = MultiMapUtils.getCollection(map, "key1");
+ for (final String val : values) {
assertTrue(col.contains(val));
}
}
@@ -107,15 +107,15 @@ public class MultiMapUtilsTest {
public void testGetValuesAsList() {
assertNull(MultiMapUtils.getValuesAsList(null, "key1"));
- String values[] = { "v1", "v2", "v3" };
+ final String values[] = { "v1", "v2", "v3" };
final MultiValuedMap<String, String> map = new ArrayListValuedHashMap<>();
- for (String val : values) {
+ for (final String val : values) {
map.put("key1", val);
}
- List<String> list = MultiMapUtils.getValuesAsList(map, "key1");
+ final List<String> list = MultiMapUtils.getValuesAsList(map, "key1");
int i = 0;
- for (String val : list) {
+ for (final String val : list) {
assertTrue(val.equals(values[i++]));
}
}
@@ -124,16 +124,16 @@ public class MultiMapUtilsTest {
public void testGetValuesAsSet() {
assertNull(MultiMapUtils.getValuesAsList(null, "key1"));
- String values[] = { "v1", "v2", "v3" };
+ final String values[] = { "v1", "v2", "v3" };
final MultiValuedMap<String, String> map = new ArrayListValuedHashMap<>();
- for (String val : values) {
+ for (final String val : values) {
map.put("key1", val);
map.put("key1", val);
}
- Set<String> set = MultiMapUtils.getValuesAsSet(map, "key1");
+ final Set<String> set = MultiMapUtils.getValuesAsSet(map, "key1");
assertEquals(3, set.size());
- for (String val : values) {
+ for (final String val : values) {
assertTrue(set.contains(val));
}
}
@@ -142,16 +142,16 @@ public class MultiMapUtilsTest {
public void testGetValuesAsBag() {
assertNull(MultiMapUtils.getValuesAsBag(null, "key1"));
- String values[] = { "v1", "v2", "v3" };
+ final String values[] = { "v1", "v2", "v3" };
final MultiValuedMap<String, String> map = new ArrayListValuedHashMap<>();
- for (String val : values) {
+ for (final String val : values) {
map.put("key1", val);
map.put("key1", val);
}
- Bag<String> bag = MultiMapUtils.getValuesAsBag(map, "key1");
+ final Bag<String> bag = MultiMapUtils.getValuesAsBag(map, "key1");
assertEquals(6, bag.size());
- for (String val : values) {
+ for (final String val : values) {
assertTrue(bag.contains(val));
assertEquals(2, bag.getCount(val));
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/QueueUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/QueueUtilsTest.java b/src/test/java/org/apache/commons/collections4/QueueUtilsTest.java
index 12be711..418dd86 100644
--- a/src/test/java/org/apache/commons/collections4/QueueUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/QueueUtilsTest.java
@@ -43,7 +43,7 @@ public class QueueUtilsTest {
@Test
public void testSynchronizedQueue() {
- Queue<Object> queue = QueueUtils.synchronizedQueue(new LinkedList<Object>());
+ final Queue<Object> queue = QueueUtils.synchronizedQueue(new LinkedList<Object>());
assertTrue("Returned object should be a SynchronizedQueue.", queue instanceof SynchronizedQueue);
try {
QueueUtils.synchronizedQueue(null);
@@ -55,7 +55,7 @@ public class QueueUtilsTest {
@Test
public void testUnmodifiableQueue() {
- Queue<Object> queue = QueueUtils.unmodifiableQueue(new LinkedList<>());
+ final Queue<Object> queue = QueueUtils.unmodifiableQueue(new LinkedList<>());
assertTrue("Returned object should be an UnmodifiableQueue.", queue instanceof UnmodifiableQueue);
try {
QueueUtils.unmodifiableQueue(null);
@@ -69,7 +69,7 @@ public class QueueUtilsTest {
@Test
public void testPredicatedQueue() {
- Queue<Object> queue = QueueUtils.predicatedQueue(new LinkedList<>(), truePredicate);
+ final Queue<Object> queue = QueueUtils.predicatedQueue(new LinkedList<>(), truePredicate);
assertTrue("Returned object should be a PredicatedQueue.", queue instanceof PredicatedQueue);
try {
QueueUtils.predicatedQueue(null, truePredicate);
@@ -87,7 +87,7 @@ public class QueueUtilsTest {
@Test
public void testTransformedQueue() {
- Queue<Object> queue = QueueUtils.transformingQueue(new LinkedList<>(), nopTransformer);
+ final Queue<Object> queue = QueueUtils.transformingQueue(new LinkedList<>(), nopTransformer);
assertTrue("Returned object should be an TransformedQueue.", queue instanceof TransformedQueue);
try {
QueueUtils.transformingQueue(null, nopTransformer);
@@ -105,7 +105,7 @@ public class QueueUtilsTest {
@Test
public void testEmptyQueue() {
- Queue<Object> queue = QueueUtils.emptyQueue();
+ final Queue<Object> queue = QueueUtils.emptyQueue();
assertTrue("Returned object should be an UnmodifiableQueue.", queue instanceof UnmodifiableQueue);
assertTrue("Returned queue is not empty.", queue.isEmpty());
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/SetUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/SetUtilsTest.java b/src/test/java/org/apache/commons/collections4/SetUtilsTest.java
index 9dc08ef..68fdabe 100644
--- a/src/test/java/org/apache/commons/collections4/SetUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/SetUtilsTest.java
@@ -68,7 +68,7 @@ public class SetUtilsTest {
return o instanceof String;
}
};
- Set<Object> set = SetUtils.predicatedSet(new HashSet<>(), predicate);
+ final Set<Object> set = SetUtils.predicatedSet(new HashSet<>(), predicate);
assertTrue("returned object should be a PredicatedSet", set instanceof PredicatedSet);
try {
SetUtils.predicatedSet(new HashSet<>(), null);
@@ -126,8 +126,8 @@ public class SetUtilsTest {
@Test
public void testNewIdentityHashSet() {
- Set<String> set = SetUtils.newIdentityHashSet();
- String a = new String("a");
+ final Set<String> set = SetUtils.newIdentityHashSet();
+ final String a = new String("a");
set.add(a);
set.add(new String("b"));
set.add(a);
@@ -154,14 +154,14 @@ public class SetUtilsTest {
try {
SetUtils.union(setA, null);
fail("Expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
try {
SetUtils.union(null, setA);
fail("Expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
}
@@ -172,7 +172,7 @@ public class SetUtilsTest {
assertEquals(2, set.size());
assertTrue(set.contains(1));
assertTrue(set.contains(2));
- for (Integer i : setB) {
+ for (final Integer i : setB) {
assertFalse(set.contains(i));
}
@@ -182,14 +182,14 @@ public class SetUtilsTest {
try {
SetUtils.difference(setA, null);
fail("Expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
try {
SetUtils.difference(null, setA);
fail("Expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
}
@@ -212,14 +212,14 @@ public class SetUtilsTest {
try {
SetUtils.intersection(setA, null);
fail("Expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
try {
SetUtils.intersection(null, setA);
fail("Expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
}
@@ -242,14 +242,14 @@ public class SetUtilsTest {
try {
SetUtils.disjunction(setA, null);
fail("Expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
try {
SetUtils.disjunction(null, setA);
fail("Expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java b/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java
index 4b875b8..b31db39 100644
--- a/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java
@@ -247,9 +247,9 @@ public class TransformerUtilsTest {
assertEquals("A", TransformerUtils.ifTransformer(TruePredicate.truePredicate(), a, b).transform(null));
assertEquals("B", TransformerUtils.ifTransformer(FalsePredicate.falsePredicate(), a, b).transform(null));
- Predicate<Integer> lessThanFivePredicate = new Predicate<Integer>() {
+ final Predicate<Integer> lessThanFivePredicate = new Predicate<Integer>() {
@Override
- public boolean evaluate(Integer value) {
+ public boolean evaluate(final Integer value) {
return value < 5;
}
};
@@ -258,7 +258,7 @@ public class TransformerUtilsTest {
assertEquals("B", TransformerUtils.<Integer, String>ifTransformer(lessThanFivePredicate, a, b).transform(5));
// if tests
- Predicate<String> equalsAPredicate = EqualPredicate.equalPredicate("A");
+ final Predicate<String> equalsAPredicate = EqualPredicate.equalPredicate("A");
assertEquals("C", TransformerUtils.<String>ifTransformer(equalsAPredicate, c).transform("A"));
assertEquals("B", TransformerUtils.<String>ifTransformer(equalsAPredicate, c).transform("B"));
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/TrieUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/TrieUtilsTest.java b/src/test/java/org/apache/commons/collections4/TrieUtilsTest.java
index d2f31d1..1c78852 100644
--- a/src/test/java/org/apache/commons/collections4/TrieUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/TrieUtilsTest.java
@@ -32,7 +32,7 @@ public class TrieUtilsTest {
@Test
public void testUnmodifiableTrie() {
- Trie<String, Object> trie = TrieUtils.unmodifiableTrie(new PatriciaTrie<>());
+ final Trie<String, Object> trie = TrieUtils.unmodifiableTrie(new PatriciaTrie<>());
assertTrue("Returned object should be an UnmodifiableTrie.",
trie instanceof UnmodifiableTrie);
try {
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/bag/TreeBagTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/bag/TreeBagTest.java b/src/test/java/org/apache/commons/collections4/bag/TreeBagTest.java
index 593c536..380eecc 100644
--- a/src/test/java/org/apache/commons/collections4/bag/TreeBagTest.java
+++ b/src/test/java/org/apache/commons/collections4/bag/TreeBagTest.java
@@ -77,7 +77,7 @@ public class TreeBagTest<T> extends AbstractSortedBagTest<T> {
final Bag<String> bag2 = new TreeBag<>(new Comparator<String>() {
@Override
- public int compare(String o1, String o2) {
+ public int compare(final String o1, final String o2) {
return o1.compareTo(o2);
}
});
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/bidimap/DualTreeBidiMap2Test.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/bidimap/DualTreeBidiMap2Test.java b/src/test/java/org/apache/commons/collections4/bidimap/DualTreeBidiMap2Test.java
index 2c3978d..486b0de 100644
--- a/src/test/java/org/apache/commons/collections4/bidimap/DualTreeBidiMap2Test.java
+++ b/src/test/java/org/apache/commons/collections4/bidimap/DualTreeBidiMap2Test.java
@@ -153,7 +153,7 @@ public class DualTreeBidiMap2Test<K extends Comparable<K>, V extends Comparable<
*/
@Override
public String[] ignoredTests() {
- String recursiveTest = "DualTreeBidiMap2Test.bulkTestInverseMap.bulkTestInverseMap";
+ final String recursiveTest = "DualTreeBidiMap2Test.bulkTestInverseMap.bulkTestInverseMap";
if (IBMJDK16) {
final String preSub = "DualTreeBidiMap2Test.bulkTestSubMap.";
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java b/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java
index 08a7eee..f9b1a18 100644
--- a/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java
+++ b/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java
@@ -671,7 +671,7 @@ public abstract class AbstractCollectionTest<E> extends AbstractObjectTest {
resetFull();
elements = getOtherElements();
- for (Object element : elements) {
+ for (final Object element : elements) {
assertTrue("Full collection shouldn't contain element",
!getCollection().contains(element));
}
@@ -861,7 +861,7 @@ public abstract class AbstractCollectionTest<E> extends AbstractObjectTest {
resetEmpty();
final E[] elements = getFullElements();
- for (E element : elements) {
+ for (final E element : elements) {
assertTrue("Shouldn't remove nonexistent element", !getCollection().remove(element));
verify();
}
@@ -869,7 +869,7 @@ public abstract class AbstractCollectionTest<E> extends AbstractObjectTest {
final E[] other = getOtherElements();
resetFull();
- for (E element : other) {
+ for (final E element : other) {
assertTrue("Shouldn't remove nonexistent other element", !getCollection().remove(element));
verify();
}
@@ -939,7 +939,7 @@ public abstract class AbstractCollectionTest<E> extends AbstractObjectTest {
verify();
assertTrue("Collection should shrink after removeAll", getCollection().size() < size);
- for (E element : all) {
+ for (final E element : all) {
assertTrue("Collection shouldn't contain removed element", !getCollection().contains(element));
}
}
@@ -991,7 +991,7 @@ public abstract class AbstractCollectionTest<E> extends AbstractObjectTest {
getConfirmed().retainAll(elements.subList(min, max));
verify();
- for (E element : getCollection()) {
+ for (final E element : getCollection()) {
assertTrue("Collection only contains retained element", elements.subList(min, max).contains(element));
}
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionBuilderTest.java
----------------------------------------------------------------------
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 4159a60..37334a2 100644
--- a/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionBuilderTest.java
+++ b/src/test/java/org/apache/commons/collections4/collection/PredicatedCollectionBuilderTest.java
@@ -39,7 +39,7 @@ public class PredicatedCollectionBuilderTest {
*/
@Test
public void addPass() {
- PredicatedCollection.Builder<String> builder = PredicatedCollection.notNullBuilder();
+ final PredicatedCollection.Builder<String> builder = PredicatedCollection.notNullBuilder();
builder.add("test");
Assert.assertEquals(builder.createPredicatedList().size(), 1);
}
@@ -49,7 +49,7 @@ public class PredicatedCollectionBuilderTest {
*/
@Test
public void addFail() {
- PredicatedCollection.Builder<String> builder = PredicatedCollection.notNullBuilder();
+ final PredicatedCollection.Builder<String> builder = PredicatedCollection.notNullBuilder();
builder.add((String) null);
Assert.assertTrue(builder.createPredicatedList().isEmpty());
@@ -61,27 +61,27 @@ public class PredicatedCollectionBuilderTest {
*/
@Test
public void addAllPass() {
- PredicatedCollection.Builder<String> builder = PredicatedCollection.notNullBuilder();
+ final PredicatedCollection.Builder<String> builder = PredicatedCollection.notNullBuilder();
builder.addAll(Arrays.asList("test1", null, "test2"));
Assert.assertEquals(builder.createPredicatedList().size(), 2);
}
@Test
public void createPredicatedCollectionWithNotNullPredicate() {
- PredicatedCollection.Builder<String> builder = PredicatedCollection.notNullBuilder();
+ final PredicatedCollection.Builder<String> builder = PredicatedCollection.notNullBuilder();
builder.add("test1");
builder.add((String) null);
- List<String> predicatedList = builder.createPredicatedList();
+ final List<String> predicatedList = builder.createPredicatedList();
checkPredicatedCollection1(predicatedList);
- Set<String> predicatedSet = builder.createPredicatedSet();
+ final Set<String> predicatedSet = builder.createPredicatedSet();
checkPredicatedCollection1(predicatedSet);
- Bag<String> predicatedBag = builder.createPredicatedBag();
+ final Bag<String> predicatedBag = builder.createPredicatedBag();
checkPredicatedCollection1(predicatedBag);
- Queue<String> predicatedQueue = builder.createPredicatedQueue();
+ final Queue<String> predicatedQueue = builder.createPredicatedQueue();
checkPredicatedCollection1(predicatedQueue);
}
@@ -94,30 +94,30 @@ public class PredicatedCollectionBuilderTest {
try {
collection.add(null);
Assert.fail("Expecting IllegalArgumentException for failing predicate!");
- } catch (IllegalArgumentException iae) {
+ } catch (final IllegalArgumentException iae) {
// expected
}
}
@Test
public void createPredicatedCollectionWithPredicate() {
- OddPredicate p = new OddPredicate();
- PredicatedCollection.Builder<Integer> builder = PredicatedCollection.builder(p);
+ final OddPredicate p = new OddPredicate();
+ final PredicatedCollection.Builder<Integer> builder = PredicatedCollection.builder(p);
builder.add(1);
builder.add(2);
builder.add(3);
- List<Integer> predicatedList = builder.createPredicatedList();
+ final List<Integer> predicatedList = builder.createPredicatedList();
checkPredicatedCollection2(predicatedList);
- Set<Integer> predicatedSet = builder.createPredicatedSet();
+ final Set<Integer> predicatedSet = builder.createPredicatedSet();
checkPredicatedCollection2(predicatedSet);
- Bag<Integer> predicatedBag = builder.createPredicatedBag();
+ final Bag<Integer> predicatedBag = builder.createPredicatedBag();
checkPredicatedCollection2(predicatedBag);
- Queue<Integer> predicatedQueue = builder.createPredicatedQueue();
+ final Queue<Integer> predicatedQueue = builder.createPredicatedQueue();
checkPredicatedCollection2(predicatedQueue);
}
@@ -127,7 +127,7 @@ public class PredicatedCollectionBuilderTest {
try {
collection.add(4);
Assert.fail("Expecting IllegalArgumentException for failing predicate!");
- } catch (IllegalArgumentException iae) {
+ } catch (final IllegalArgumentException iae) {
}
Assert.assertEquals(2, collection.size());
@@ -137,7 +137,7 @@ public class PredicatedCollectionBuilderTest {
private static class OddPredicate implements Predicate<Integer> {
@Override
- public boolean evaluate(Integer value) {
+ public boolean evaluate(final Integer value) {
return value % 2 == 1;
}
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/comparators/TransformingComparatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/comparators/TransformingComparatorTest.java b/src/test/java/org/apache/commons/collections4/comparators/TransformingComparatorTest.java
index 11cbd27..81d8481 100644
--- a/src/test/java/org/apache/commons/collections4/comparators/TransformingComparatorTest.java
+++ b/src/test/java/org/apache/commons/collections4/comparators/TransformingComparatorTest.java
@@ -61,9 +61,9 @@ public class TransformingComparatorTest extends AbstractComparatorTest<Integer>
}
public void testEquals() {
- Transformer<String, String> t1 = TransformerUtils.nopTransformer();
- TransformingComparator<String, String> comp1 = new TransformingComparator<>(t1);
- TransformingComparator<String, String> comp2 = new TransformingComparator<>(t1, comp1);
+ final Transformer<String, String> t1 = TransformerUtils.nopTransformer();
+ final TransformingComparator<String, String> comp1 = new TransformingComparator<>(t1);
+ final TransformingComparator<String, String> comp2 = new TransformingComparator<>(t1, comp1);
// Checks the contract: equals-hashcode on comp1 and comp2
assertTrue("Contract failed: equals-hashcode",
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/iterators/BoundedIteratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/iterators/BoundedIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/BoundedIteratorTest.java
index 0d868cb..7cf6372 100644
--- a/src/test/java/org/apache/commons/collections4/iterators/BoundedIteratorTest.java
+++ b/src/test/java/org/apache/commons/collections4/iterators/BoundedIteratorTest.java
@@ -66,7 +66,7 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
*/
@Test
public void testBounded() {
- Iterator<E> iter = new BoundedIterator<>(testList.iterator(), 2, 4);
+ final Iterator<E> iter = new BoundedIterator<>(testList.iterator(), 2, 4);
assertTrue(iter.hasNext());
assertEquals("c", iter.next());
@@ -81,7 +81,7 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
try {
iter.next();
fail("Expected NoSuchElementException.");
- } catch (NoSuchElementException nsee) { /* Success case */
+ } catch (final NoSuchElementException nsee) { /* Success case */
}
}
@@ -92,7 +92,7 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
*/
@Test
public void testSameAsDecorated() {
- Iterator<E> iter = new BoundedIterator<>(testList.iterator(), 0,
+ final Iterator<E> iter = new BoundedIterator<>(testList.iterator(), 0,
testList.size());
assertTrue(iter.hasNext());
@@ -114,7 +114,7 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
try {
iter.next();
fail("Expected NoSuchElementException.");
- } catch (NoSuchElementException nsee) { /* Success case */
+ } catch (final NoSuchElementException nsee) { /* Success case */
}
}
@@ -125,12 +125,12 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
*/
@Test
public void testEmptyBounded() {
- Iterator<E> iter = new BoundedIterator<>(testList.iterator(), 3, 0);
+ final Iterator<E> iter = new BoundedIterator<>(testList.iterator(), 3, 0);
assertFalse(iter.hasNext());
try {
iter.next();
fail("Expected NoSuchElementException.");
- } catch (NoSuchElementException nsee) { /* Success case */
+ } catch (final NoSuchElementException nsee) { /* Success case */
}
}
@@ -143,7 +143,7 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
try {
new BoundedIterator<>(testList.iterator(), -1, 4);
fail("Expected IllegalArgumentException.");
- } catch (IllegalArgumentException iae) { /* Success case */
+ } catch (final IllegalArgumentException iae) { /* Success case */
}
}
@@ -156,7 +156,7 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
try {
new BoundedIterator<>(testList.iterator(), 3, -1);
fail("Expected IllegalArgumentException.");
- } catch (IllegalArgumentException iae) { /* Success case */
+ } catch (final IllegalArgumentException iae) { /* Success case */
}
}
@@ -167,12 +167,12 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
*/
@Test
public void testOffsetGreaterThanSize() {
- Iterator<E> iter = new BoundedIterator<>(testList.iterator(), 10, 4);
+ final Iterator<E> iter = new BoundedIterator<>(testList.iterator(), 10, 4);
assertFalse(iter.hasNext());
try {
iter.next();
fail("Expected NoSuchElementException.");
- } catch (NoSuchElementException nsee) { /* Success case */
+ } catch (final NoSuchElementException nsee) { /* Success case */
}
}
@@ -184,7 +184,7 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
*/
@Test
public void testMaxGreaterThanSize() {
- Iterator<E> iter = new BoundedIterator<>(testList.iterator(), 1, 10);
+ final Iterator<E> iter = new BoundedIterator<>(testList.iterator(), 1, 10);
assertTrue(iter.hasNext());
assertEquals("b", iter.next());
@@ -203,7 +203,7 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
try {
iter.next();
fail("Expected NoSuchElementException.");
- } catch (NoSuchElementException nsee) { /* Success case */
+ } catch (final NoSuchElementException nsee) { /* Success case */
}
}
@@ -213,13 +213,13 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
*/
@Test
public void testRemoveWithoutCallingNext() {
- List<E> testListCopy = new ArrayList<>(testList);
- Iterator<E> iter = new BoundedIterator<>(testListCopy.iterator(), 1, 5);
+ final List<E> testListCopy = new ArrayList<>(testList);
+ final Iterator<E> iter = new BoundedIterator<>(testListCopy.iterator(), 1, 5);
try {
iter.remove();
fail("Expected IllegalStateException.");
- } catch (IllegalStateException ise) { /* Success case */
+ } catch (final IllegalStateException ise) { /* Success case */
}
}
@@ -229,8 +229,8 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
*/
@Test
public void testRemoveCalledTwice() {
- List<E> testListCopy = new ArrayList<>(testList);
- Iterator<E> iter = new BoundedIterator<>(testListCopy.iterator(), 1, 5);
+ final List<E> testListCopy = new ArrayList<>(testList);
+ final Iterator<E> iter = new BoundedIterator<>(testListCopy.iterator(), 1, 5);
assertTrue(iter.hasNext());
assertEquals("b", iter.next());
@@ -239,7 +239,7 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
try {
iter.remove();
fail("Expected IllegalStateException.");
- } catch (IllegalStateException ise) { /* Success case */
+ } catch (final IllegalStateException ise) { /* Success case */
}
}
@@ -249,8 +249,8 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
*/
@Test
public void testRemoveFirst() {
- List<E> testListCopy = new ArrayList<>(testList);
- Iterator<E> iter = new BoundedIterator<>(testListCopy.iterator(), 1, 5);
+ final List<E> testListCopy = new ArrayList<>(testList);
+ final Iterator<E> iter = new BoundedIterator<>(testListCopy.iterator(), 1, 5);
assertTrue(iter.hasNext());
assertEquals("b", iter.next());
@@ -271,7 +271,7 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
try {
iter.next();
fail("Expected NoSuchElementException.");
- } catch (NoSuchElementException nsee) { /* Success case */
+ } catch (final NoSuchElementException nsee) { /* Success case */
}
}
@@ -281,8 +281,8 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
*/
@Test
public void testRemoveMiddle() {
- List<E> testListCopy = new ArrayList<>(testList);
- Iterator<E> iter = new BoundedIterator<>(testListCopy.iterator(), 1, 5);
+ final List<E> testListCopy = new ArrayList<>(testList);
+ final Iterator<E> iter = new BoundedIterator<>(testListCopy.iterator(), 1, 5);
assertTrue(iter.hasNext());
assertEquals("b", iter.next());
@@ -303,7 +303,7 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
try {
iter.next();
fail("Expected NoSuchElementException.");
- } catch (NoSuchElementException nsee) { /* Success case */
+ } catch (final NoSuchElementException nsee) { /* Success case */
}
}
@@ -313,8 +313,8 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
*/
@Test
public void testRemoveLast() {
- List<E> testListCopy = new ArrayList<>(testList);
- Iterator<E> iter = new BoundedIterator<>(testListCopy.iterator(), 1, 5);
+ final List<E> testListCopy = new ArrayList<>(testList);
+ final Iterator<E> iter = new BoundedIterator<>(testListCopy.iterator(), 1, 5);
assertTrue(iter.hasNext());
assertEquals("b", iter.next());
@@ -331,7 +331,7 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
try {
iter.next();
fail("Expected NoSuchElementException.");
- } catch (NoSuchElementException nsee) { /* Success case */
+ } catch (final NoSuchElementException nsee) { /* Success case */
}
iter.remove();
@@ -341,7 +341,7 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
try {
iter.next();
fail("Expected NoSuchElementException.");
- } catch (NoSuchElementException nsee) { /* Success case */
+ } catch (final NoSuchElementException nsee) { /* Success case */
}
}
@@ -351,20 +351,20 @@ public class BoundedIteratorTest<E> extends AbstractIteratorTest<E> {
*/
@Test
public void testRemoveUnsupported() {
- Iterator<E> mockIterator = new AbstractIteratorDecorator<E>(testList.iterator()) {
+ final Iterator<E> mockIterator = new AbstractIteratorDecorator<E>(testList.iterator()) {
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
- Iterator<E> iter = new BoundedIterator<>(mockIterator, 1, 5);
+ final Iterator<E> iter = new BoundedIterator<>(mockIterator, 1, 5);
assertTrue(iter.hasNext());
assertEquals("b", iter.next());
try {
iter.remove();
fail("Expected UnsupportedOperationException.");
- } catch (UnsupportedOperationException usoe) { /* Success case */
+ } catch (final UnsupportedOperationException usoe) { /* Success case */
}
}
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/iterators/IteratorEnumerationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/iterators/IteratorEnumerationTest.java b/src/test/java/org/apache/commons/collections4/iterators/IteratorEnumerationTest.java
index 7c24463..436dfb7 100644
--- a/src/test/java/org/apache/commons/collections4/iterators/IteratorEnumerationTest.java
+++ b/src/test/java/org/apache/commons/collections4/iterators/IteratorEnumerationTest.java
@@ -30,8 +30,8 @@ import junit.framework.TestCase;
public class IteratorEnumerationTest extends TestCase {
public void testEnumeration() {
- Iterator<String> iterator = Arrays.asList("a", "b", "c").iterator();
- IteratorEnumeration<String> enumeration = new IteratorEnumeration<>(iterator);
+ final Iterator<String> iterator = Arrays.asList("a", "b", "c").iterator();
+ final IteratorEnumeration<String> enumeration = new IteratorEnumeration<>(iterator);
assertEquals(iterator, enumeration.getIterator());
@@ -44,7 +44,7 @@ public class IteratorEnumerationTest extends TestCase {
try {
enumeration.nextElement();
fail("NoSuchElementException expected");
- } catch (NoSuchElementException e) {
+ } catch (final NoSuchElementException e) {
// expected
}
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/iterators/PeekingIteratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/iterators/PeekingIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/PeekingIteratorTest.java
index 85a5f15..66be1d8 100644
--- a/src/test/java/org/apache/commons/collections4/iterators/PeekingIteratorTest.java
+++ b/src/test/java/org/apache/commons/collections4/iterators/PeekingIteratorTest.java
@@ -70,14 +70,14 @@ public class PeekingIteratorTest<E> extends AbstractIteratorTest<E> {
@Test
public void testEmpty() {
- Iterator<E> it = makeEmptyIterator();
+ final Iterator<E> it = makeEmptyIterator();
assertFalse(it.hasNext());
}
@Test
@SuppressWarnings("unchecked")
public void testSinglePeek() {
- PeekingIterator<E> it = makeObject();
+ final PeekingIterator<E> it = makeObject();
assertEquals("a", it.peek());
assertEquals("a", it.element());
validate(it, (E[]) testArray);
@@ -85,7 +85,7 @@ public class PeekingIteratorTest<E> extends AbstractIteratorTest<E> {
@Test
public void testMultiplePeek() {
- PeekingIterator<E> it = makeObject();
+ final PeekingIterator<E> it = makeObject();
assertEquals("a", it.peek());
assertEquals("a", it.peek());
assertEquals("a", it.next());
@@ -102,7 +102,7 @@ public class PeekingIteratorTest<E> extends AbstractIteratorTest<E> {
@Test
public void testIteratorExhausted() {
- PeekingIterator<E> it = makeObject();
+ final PeekingIterator<E> it = makeObject();
it.next();
it.next();
it.next();
@@ -112,14 +112,14 @@ public class PeekingIteratorTest<E> extends AbstractIteratorTest<E> {
try {
it.element();
fail();
- } catch (NoSuchElementException e) {
+ } catch (final NoSuchElementException e) {
// expected
}
}
@Test
public void testIllegalRemove() {
- PeekingIterator<E> it = makeObject();
+ final PeekingIterator<E> it = makeObject();
it.next();
it.remove(); // supported
@@ -129,13 +129,13 @@ public class PeekingIteratorTest<E> extends AbstractIteratorTest<E> {
try {
it.remove();
fail();
- } catch (IllegalStateException e) {
+ } catch (final IllegalStateException e) {
// expected
}
}
- private void validate(Iterator<E> iter, E... items) {
- for (E x : items) {
+ private void validate(final Iterator<E> iter, final E... items) {
+ for (final E x : items) {
assertTrue(iter.hasNext());
assertEquals(x, iter.next());
}