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 2017/10/11 22:26:10 UTC
[2/3] commons-collections git commit: Use final for locals.
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/712ddb1e/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 13d881b..7f78a95 100644
--- a/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/TransformerUtilsTest.java
@@ -247,7 +247,7 @@ 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(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/712ddb1e/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 21dd335..f6a2526 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/712ddb1e/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 cc4f7aa..d50cc71 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/712ddb1e/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 6960043..5aaa5f6 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/712ddb1e/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 0c8c5a8..12344c4 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());
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/712ddb1e/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/712ddb1e/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/712ddb1e/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 1f60052..05aca00 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/712ddb1e/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 3876861..455d9d4 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(final Iterator<E> iter, final E... items) {
- for (E x : items) {
+ for (final E x : items) {
assertTrue(iter.hasNext());
assertEquals(x, iter.next());
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/712ddb1e/src/test/java/org/apache/commons/collections4/iterators/PermutationIteratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/iterators/PermutationIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/PermutationIteratorTest.java
index e8119f3..0cb9ba6 100644
--- a/src/test/java/org/apache/commons/collections4/iterators/PermutationIteratorTest.java
+++ b/src/test/java/org/apache/commons/collections4/iterators/PermutationIteratorTest.java
@@ -73,11 +73,11 @@ public class PermutationIteratorTest extends AbstractIteratorTest<List<Character
public void testPermutationResultSize() {
int factorial = 1;
for (int i = 0; i < 8; i++, factorial*=i) {
- List<Integer> list = new ArrayList<>();
+ final List<Integer> list = new ArrayList<>();
for (int j = 0; j < i; j++) {
list.add(j);
}
- Iterator<List<Integer>> it = new PermutationIterator<>(list);
+ final Iterator<List<Integer>> it = new PermutationIterator<>(list);
int count = 0;
while (it.hasNext()) {
it.next();
@@ -92,12 +92,12 @@ public class PermutationIteratorTest extends AbstractIteratorTest<List<Character
*/
@SuppressWarnings("boxing") // OK in test code
public void testPermutationExhaustivity() {
- List<Character> perm1 = new ArrayList<>();
- List<Character> perm2 = new ArrayList<>();
- List<Character> perm3 = new ArrayList<>();
- List<Character> perm4 = new ArrayList<>();
- List<Character> perm5 = new ArrayList<>();
- List<Character> perm6 = new ArrayList<>();
+ final List<Character> perm1 = new ArrayList<>();
+ final List<Character> perm2 = new ArrayList<>();
+ final List<Character> perm3 = new ArrayList<>();
+ final List<Character> perm4 = new ArrayList<>();
+ final List<Character> perm5 = new ArrayList<>();
+ final List<Character> perm6 = new ArrayList<>();
perm1.add('A');
perm2.add('A');
@@ -120,11 +120,11 @@ public class PermutationIteratorTest extends AbstractIteratorTest<List<Character
perm5.add('B');
perm6.add('A');
- List<List<Character>> results = new ArrayList<>();
+ final List<List<Character>> results = new ArrayList<>();
- PermutationIterator<Character> it = makeObject();
+ final PermutationIterator<Character> it = makeObject();
while (it.hasNext()) {
- List<Character> next = it.next();
+ final List<Character> next = it.next();
results.add(next);
}
//3! permutation for 3 elements
@@ -141,12 +141,12 @@ public class PermutationIteratorTest extends AbstractIteratorTest<List<Character
* test checking that all the permutations are returned only once.
*/
public void testPermutationUnicity() {
- List<List<Character>> resultsList = new ArrayList<>();
- Set<List<Character>> resultsSet = new HashSet<>();
+ final List<List<Character>> resultsList = new ArrayList<>();
+ final Set<List<Character>> resultsSet = new HashSet<>();
- PermutationIterator<Character> it = makeObject();
+ final PermutationIterator<Character> it = makeObject();
while (it.hasNext()) {
- List<Character> permutation = it.next();
+ final List<Character> permutation = it.next();
resultsList.add(permutation);
resultsSet.add(permutation);
}
@@ -156,24 +156,24 @@ public class PermutationIteratorTest extends AbstractIteratorTest<List<Character
}
public void testPermutationException() {
- List<List<Character>> resultsList = new ArrayList<>();
+ final List<List<Character>> resultsList = new ArrayList<>();
- PermutationIterator<Character> it = makeObject();
+ final PermutationIterator<Character> it = makeObject();
while (it.hasNext()) {
- List<Character> permutation = it.next();
+ final List<Character> permutation = it.next();
resultsList.add(permutation);
}
//asking for another permutation should throw an exception
try {
it.next();
fail();
- } catch (NoSuchElementException e) {
+ } catch (final NoSuchElementException e) {
// expected
}
}
public void testPermutatorHasMore() {
- PermutationIterator<Character> it = makeObject();
+ final PermutationIterator<Character> it = makeObject();
for (int i = 0; i < 6; i++) {
assertTrue(it.hasNext());
it.next();
@@ -182,11 +182,11 @@ public class PermutationIteratorTest extends AbstractIteratorTest<List<Character
}
public void testEmptyCollection() {
- PermutationIterator<Character> it = makeEmptyIterator();
+ final PermutationIterator<Character> it = makeEmptyIterator();
// there is one permutation for an empty set: 0! = 1
assertTrue(it.hasNext());
- List<Character> nextPermutation = it.next();
+ final List<Character> nextPermutation = it.next();
assertEquals(0, nextPermutation.size());
assertFalse(it.hasNext());
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/712ddb1e/src/test/java/org/apache/commons/collections4/iterators/PushbackIteratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/iterators/PushbackIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/PushbackIteratorTest.java
index 3b7a9c0..ad30e8d 100644
--- a/src/test/java/org/apache/commons/collections4/iterators/PushbackIteratorTest.java
+++ b/src/test/java/org/apache/commons/collections4/iterators/PushbackIteratorTest.java
@@ -68,7 +68,7 @@ public class PushbackIteratorTest<E> extends AbstractIteratorTest<E> {
@Test
public void testNormalIteration() {
- PushbackIterator<E> iter = makeObject();
+ final PushbackIterator<E> iter = makeObject();
assertEquals("a", iter.next());
assertEquals("b", iter.next());
assertEquals("c", iter.next());
@@ -78,7 +78,7 @@ public class PushbackIteratorTest<E> extends AbstractIteratorTest<E> {
@Test
@SuppressWarnings("unchecked")
public void testImmediatePushback() {
- PushbackIterator<E> iter = makeObject();
+ final PushbackIterator<E> iter = makeObject();
iter.pushback((E) "x");
assertEquals("x", iter.next());
assertEquals("a", iter.next());
@@ -88,7 +88,7 @@ public class PushbackIteratorTest<E> extends AbstractIteratorTest<E> {
@Test
@SuppressWarnings("unchecked")
public void testDelayedPushback() {
- PushbackIterator<E> iter = makeObject();
+ final PushbackIterator<E> iter = makeObject();
assertEquals("a", iter.next());
iter.pushback((E) "x");
assertEquals("x", iter.next());
@@ -99,7 +99,7 @@ public class PushbackIteratorTest<E> extends AbstractIteratorTest<E> {
@Test
@SuppressWarnings("unchecked")
public void testMultiplePushback() {
- PushbackIterator<E> iter = makeObject();
+ final PushbackIterator<E> iter = makeObject();
assertEquals("a", iter.next());
iter.pushback((E) "x");
iter.pushback((E) "y");
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/712ddb1e/src/test/java/org/apache/commons/collections4/iterators/SkippingIteratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/iterators/SkippingIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/SkippingIteratorTest.java
index 052201a..c0ebf41 100644
--- a/src/test/java/org/apache/commons/collections4/iterators/SkippingIteratorTest.java
+++ b/src/test/java/org/apache/commons/collections4/iterators/SkippingIteratorTest.java
@@ -66,7 +66,7 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> {
*/
@Test
public void testSkipping() {
- Iterator<E> iter = new SkippingIterator<>(testList.iterator(), 2);
+ final Iterator<E> iter = new SkippingIterator<>(testList.iterator(), 2);
assertTrue(iter.hasNext());
assertEquals("c", iter.next());
@@ -83,7 +83,7 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> {
try {
iter.next();
fail("Expected NoSuchElementException.");
- } catch (NoSuchElementException nsee) { /* Success case */
+ } catch (final NoSuchElementException nsee) { /* Success case */
}
}
@@ -94,7 +94,7 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> {
*/
@Test
public void testSameAsDecorated() {
- Iterator<E> iter = new SkippingIterator<>(testList.iterator(), 0);
+ final Iterator<E> iter = new SkippingIterator<>(testList.iterator(), 0);
assertTrue(iter.hasNext());
assertEquals("a", iter.next());
@@ -115,7 +115,7 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> {
try {
iter.next();
fail("Expected NoSuchElementException.");
- } catch (NoSuchElementException nsee) { /* Success case */
+ } catch (final NoSuchElementException nsee) { /* Success case */
}
}
@@ -126,12 +126,12 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> {
*/
@Test
public void testOffsetGreaterThanSize() {
- Iterator<E> iter = new SkippingIterator<>(testList.iterator(), 10);
+ final Iterator<E> iter = new SkippingIterator<>(testList.iterator(), 10);
assertFalse(iter.hasNext());
try {
iter.next();
fail("Expected NoSuchElementException.");
- } catch (NoSuchElementException nsee) { /* Success case */
+ } catch (final NoSuchElementException nsee) { /* Success case */
}
}
@@ -144,7 +144,7 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> {
try {
new SkippingIterator<>(testList.iterator(), -1);
fail("Expected IllegalArgumentException.");
- } catch (IllegalArgumentException iae) { /* Success case */
+ } catch (final IllegalArgumentException iae) { /* Success case */
}
}
@@ -154,13 +154,13 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> {
*/
@Test
public void testRemoveWithoutCallingNext() {
- List<E> testListCopy = new ArrayList<>(testList);
- Iterator<E> iter = new SkippingIterator<>(testListCopy.iterator(), 1);
+ final List<E> testListCopy = new ArrayList<>(testList);
+ final Iterator<E> iter = new SkippingIterator<>(testListCopy.iterator(), 1);
try {
iter.remove();
fail("Expected IllegalStateException.");
- } catch (IllegalStateException ise) { /* Success case */
+ } catch (final IllegalStateException ise) { /* Success case */
}
}
@@ -170,8 +170,8 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> {
*/
@Test
public void testRemoveCalledTwice() {
- List<E> testListCopy = new ArrayList<>(testList);
- Iterator<E> iter = new SkippingIterator<>(testListCopy.iterator(), 1);
+ final List<E> testListCopy = new ArrayList<>(testList);
+ final Iterator<E> iter = new SkippingIterator<>(testListCopy.iterator(), 1);
assertTrue(iter.hasNext());
assertEquals("b", iter.next());
@@ -180,7 +180,7 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> {
try {
iter.remove();
fail("Expected IllegalStateException.");
- } catch (IllegalStateException ise) { /* Success case */
+ } catch (final IllegalStateException ise) { /* Success case */
}
}
@@ -190,8 +190,8 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> {
*/
@Test
public void testRemoveFirst() {
- List<E> testListCopy = new ArrayList<>(testList);
- Iterator<E> iter = new SkippingIterator<>(testListCopy.iterator(), 4);
+ final List<E> testListCopy = new ArrayList<>(testList);
+ final Iterator<E> iter = new SkippingIterator<>(testListCopy.iterator(), 4);
assertTrue(iter.hasNext());
assertEquals("e", iter.next());
@@ -208,7 +208,7 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> {
try {
iter.next();
fail("Expected NoSuchElementException.");
- } catch (NoSuchElementException nsee) { /* Success case */
+ } catch (final NoSuchElementException nsee) { /* Success case */
}
}
@@ -218,8 +218,8 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> {
*/
@Test
public void testRemoveMiddle() {
- List<E> testListCopy = new ArrayList<>(testList);
- Iterator<E> iter = new SkippingIterator<>(testListCopy.iterator(), 3);
+ final List<E> testListCopy = new ArrayList<>(testList);
+ final Iterator<E> iter = new SkippingIterator<>(testListCopy.iterator(), 3);
assertTrue(iter.hasNext());
assertEquals("d", iter.next());
@@ -238,7 +238,7 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> {
try {
iter.next();
fail("Expected NoSuchElementException.");
- } catch (NoSuchElementException nsee) { /* Success case */
+ } catch (final NoSuchElementException nsee) { /* Success case */
}
}
@@ -248,8 +248,8 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> {
*/
@Test
public void testRemoveLast() {
- List<E> testListCopy = new ArrayList<>(testList);
- Iterator<E> iter = new SkippingIterator<>(testListCopy.iterator(), 5);
+ final List<E> testListCopy = new ArrayList<>(testList);
+ final Iterator<E> iter = new SkippingIterator<>(testListCopy.iterator(), 5);
assertTrue(iter.hasNext());
assertEquals("f", iter.next());
@@ -260,7 +260,7 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> {
try {
iter.next();
fail("Expected NoSuchElementException.");
- } catch (NoSuchElementException nsee) { /* Success case */
+ } catch (final NoSuchElementException nsee) { /* Success case */
}
iter.remove();
@@ -270,7 +270,7 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> {
try {
iter.next();
fail("Expected NoSuchElementException.");
- } catch (NoSuchElementException nsee) { /* Success case */
+ } catch (final NoSuchElementException nsee) { /* Success case */
}
}
@@ -280,20 +280,20 @@ public class SkippingIteratorTest<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 SkippingIterator<>(mockIterator, 1);
+ final Iterator<E> iter = new SkippingIterator<>(mockIterator, 1);
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/712ddb1e/src/test/java/org/apache/commons/collections4/iterators/ZippingIteratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/iterators/ZippingIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/ZippingIteratorTest.java
index 104acf2..59d3eb3 100644
--- a/src/test/java/org/apache/commons/collections4/iterators/ZippingIteratorTest.java
+++ b/src/test/java/org/apache/commons/collections4/iterators/ZippingIteratorTest.java
@@ -100,7 +100,7 @@ public class ZippingIteratorTest extends AbstractIteratorTest<Integer> {
final ZippingIterator<Integer> iter = new ZippingIterator<>(odds.iterator(), evens.iterator());
for (int i = 0, j = 0; i < 20; i++) {
assertTrue(iter.hasNext());
- int val = iter.next();
+ final int val = iter.next();
if (i % 2 == 0) {
assertEquals(odds.get(j).intValue(), val);
} else {
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/712ddb1e/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java b/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java
index bb6741f..5285674 100644
--- a/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java
+++ b/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java
@@ -472,7 +472,7 @@ public abstract class AbstractListTest<E> extends AbstractCollectionTest<E> {
final List<E> list1 = getCollection();
final List<E> list2 = getConfirmed();
- for (E element : list2) {
+ for (final E element : list2) {
assertEquals("indexOf should return correct result",
list1.indexOf(element), list2.indexOf(element));
verify();
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/712ddb1e/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java b/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java
index 01b5e2f..1207dc8 100644
--- a/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java
+++ b/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java
@@ -463,11 +463,11 @@ public class SetUniqueListTest<E> extends AbstractListTest<E> {
public void testSubListIsUnmodifiable() {
resetFull();
- List<E> subList = getCollection().subList(1, 3);
+ final List<E> subList = getCollection().subList(1, 3);
try {
subList.remove(0);
fail("subList should be unmodifiable");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
// expected
}
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/712ddb1e/src/test/java/org/apache/commons/collections4/list/TreeListTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/list/TreeListTest.java b/src/test/java/org/apache/commons/collections4/list/TreeListTest.java
index b077b7a..5b0dba9 100644
--- a/src/test/java/org/apache/commons/collections4/list/TreeListTest.java
+++ b/src/test/java/org/apache/commons/collections4/list/TreeListTest.java
@@ -273,20 +273,20 @@ public class TreeListTest<E> extends AbstractListTest<E> {
// when initializing the TreeList with another collection
for (int size = 1; size < 1000; size++) {
- List<Integer> other = new ArrayList<>(size);
+ final List<Integer> other = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
other.add(i);
}
- TreeList<Integer> l = new TreeList<>(other);
- ListIterator<Integer> it = l.listIterator();
+ final TreeList<Integer> l = new TreeList<>(other);
+ final ListIterator<Integer> it = l.listIterator();
int i = 0;
while (it.hasNext()) {
- Integer val = it.next();
+ final Integer val = it.next();
assertEquals(i++, val.intValue());
}
while (it.hasPrevious()) {
- Integer val = it.previous();
+ final Integer val = it.previous();
assertEquals(--i, val.intValue());
}
}
@@ -301,28 +301,28 @@ public class TreeListTest<E> extends AbstractListTest<E> {
// to simulate different cases in addAll, do different runs where
// the number of elements already in the list and being added by addAll differ
- int size = 1000;
+ final int size = 1000;
for (int i = 0; i < 100; i++) {
- List<Integer> other = new ArrayList<>(size);
+ final List<Integer> other = new ArrayList<>(size);
for (int j = i; j < size; j++) {
other.add(j);
}
- TreeList<Integer> l = new TreeList<>();
+ final TreeList<Integer> l = new TreeList<>();
for (int j = 0; j < i; j++) {
l.add(j);
}
l.addAll(other);
- ListIterator<Integer> it = l.listIterator();
+ final ListIterator<Integer> it = l.listIterator();
int cnt = 0;
while (it.hasNext()) {
- Integer val = it.next();
+ final Integer val = it.next();
assertEquals(cnt++, val.intValue());
}
while (it.hasPrevious()) {
- Integer val = it.previous();
+ final Integer val = it.previous();
assertEquals(--cnt, val.intValue());
}
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/712ddb1e/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java b/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java
index ccd1fc3..50c09af 100644
--- a/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java
@@ -624,14 +624,14 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest {
final Object[] keys = getSampleKeys();
resetEmpty();
- for (Object key : keys) {
+ for (final Object key : keys) {
assertTrue("Map must not contain key when map is empty",
!getMap().containsKey(key));
}
verify();
resetFull();
- for (Object key : keys) {
+ for (final Object key : keys) {
assertTrue("Map must contain key for a mapping in the map. " +
"Missing: " + key, getMap().containsKey(key));
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/712ddb1e/src/test/java/org/apache/commons/collections4/map/AbstractSortedMapTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/map/AbstractSortedMapTest.java b/src/test/java/org/apache/commons/collections4/map/AbstractSortedMapTest.java
index 7a33ae4..86a9bb9 100644
--- a/src/test/java/org/apache/commons/collections4/map/AbstractSortedMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/AbstractSortedMapTest.java
@@ -90,7 +90,7 @@ public abstract class AbstractSortedMapTest<K, V> extends AbstractMapTest<K, V>
public void testLastKey() {
final SortedMap<K, V> sm = makeFullMap();
K obj = null;
- for (K k : sm.keySet()) {
+ for (final K k : sm.keySet()) {
obj = k;
}
assertSame(obj, sm.lastKey());
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/712ddb1e/src/test/java/org/apache/commons/collections4/map/LRUMapTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/map/LRUMapTest.java b/src/test/java/org/apache/commons/collections4/map/LRUMapTest.java
index fb6ee99..ff9fc1b 100644
--- a/src/test/java/org/apache/commons/collections4/map/LRUMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/LRUMapTest.java
@@ -74,42 +74,42 @@ public class LRUMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
try {
new LRUMap<K, V>(0);
fail("maxSize must be positive");
- } catch(IllegalArgumentException ex) {
+ } catch(final IllegalArgumentException ex) {
// expected
}
try {
new LRUMap<K, V>(-1, 12, 0.75f, false);
fail("maxSize must be positive");
- } catch(IllegalArgumentException ex) {
+ } catch(final IllegalArgumentException ex) {
// expected
}
try {
new LRUMap<K, V>(10, -1);
fail("initialSize must not be negative");
- } catch(IllegalArgumentException ex) {
+ } catch(final IllegalArgumentException ex) {
// expected
}
try {
new LRUMap<K, V>(10, 12);
fail("initialSize must not be larger than maxSize");
- } catch(IllegalArgumentException ex) {
+ } catch(final IllegalArgumentException ex) {
// expected
}
try {
new LRUMap<K, V>(10, -1, 0.75f, false);
fail("initialSize must not be negative");
- } catch(IllegalArgumentException ex) {
+ } catch(final IllegalArgumentException ex) {
// expected
}
try {
new LRUMap<K, V>(10, 12, 0.75f, false);
fail("initialSize must not be larger than maxSize");
- } catch(IllegalArgumentException ex) {
+ } catch(final IllegalArgumentException ex) {
// expected
}
}
@@ -280,7 +280,7 @@ public class LRUMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
Iterator<V> vit = null;
resetEmpty();
- LRUMap<K, V> lruMap = (LRUMap<K, V>) map;
+ final LRUMap<K, V> lruMap = (LRUMap<K, V>) map;
lruMap.put(keys[0], values[0]);
lruMap.put(keys[1], values[1]);
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/712ddb1e/src/test/java/org/apache/commons/collections4/map/ListOrderedMapTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/map/ListOrderedMapTest.java b/src/test/java/org/apache/commons/collections4/map/ListOrderedMapTest.java
index a79227b..b0238c6 100644
--- a/src/test/java/org/apache/commons/collections4/map/ListOrderedMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/ListOrderedMapTest.java
@@ -386,13 +386,13 @@ public class ListOrderedMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
}
public void testCOLLECTIONS_474_nullValues () {
- Object key1 = new Object();
- Object key2 = new Object();
- HashMap<Object, Object> hmap = new HashMap<>();
+ final Object key1 = new Object();
+ final Object key2 = new Object();
+ final HashMap<Object, Object> hmap = new HashMap<>();
hmap.put(key1, null);
hmap.put(key2, null);
assertEquals("Should have two elements", 2, hmap.size());
- ListOrderedMap<Object, Object> listMap = new ListOrderedMap<>();
+ final ListOrderedMap<Object, Object> listMap = new ListOrderedMap<>();
listMap.put(key1, null);
listMap.put(key2, null);
assertEquals("Should have two elements", 2, listMap.size());
@@ -400,13 +400,13 @@ public class ListOrderedMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
}
public void testCOLLECTIONS_474_nonNullValues () {
- Object key1 = new Object();
- Object key2 = new Object();
- HashMap<Object, Object> hmap = new HashMap<>();
+ final Object key1 = new Object();
+ final Object key2 = new Object();
+ final HashMap<Object, Object> hmap = new HashMap<>();
hmap.put(key1, "1");
hmap.put(key2, "2");
assertEquals("Should have two elements", 2, hmap.size());
- ListOrderedMap<Object, Object> listMap = new ListOrderedMap<>();
+ final ListOrderedMap<Object, Object> listMap = new ListOrderedMap<>();
listMap.put(key1, "3");
listMap.put(key2, "4");
assertEquals("Should have two elements", 2, listMap.size());
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/712ddb1e/src/test/java/org/apache/commons/collections4/map/MultiValueMapTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/map/MultiValueMapTest.java b/src/test/java/org/apache/commons/collections4/map/MultiValueMapTest.java
index 64310d3..5f63f02 100644
--- a/src/test/java/org/apache/commons/collections4/map/MultiValueMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/MultiValueMapTest.java
@@ -152,10 +152,11 @@ public class MultiValueMapTest<K, V> extends AbstractObjectTest {
public void testIterator() {
final MultiValueMap<K, V> map = createTestMap();
@SuppressWarnings("unchecked")
+ final
Collection<V> values = new ArrayList<>((Collection<V>) map.values());
- Iterator<Map.Entry<K, V>> iterator = map.iterator();
+ final Iterator<Map.Entry<K, V>> iterator = map.iterator();
while (iterator.hasNext()) {
- Map.Entry<K, V> entry = iterator.next();
+ final Map.Entry<K, V> entry = iterator.next();
assertTrue(map.containsValue(entry.getKey(), entry.getValue()));
assertTrue(values.contains(entry.getValue()));
assertTrue(values.remove(entry.getValue()));
@@ -392,24 +393,24 @@ public class MultiValueMapTest<K, V> extends AbstractObjectTest {
}
public void testUnsafeDeSerialization() throws Exception {
- MultiValueMap map1 = MultiValueMap.multiValueMap(new HashMap(), ArrayList.class);
+ final MultiValueMap map1 = MultiValueMap.multiValueMap(new HashMap(), ArrayList.class);
byte[] bytes = serialize(map1);
Object result = deserialize(bytes);
assertEquals(map1, result);
- MultiValueMap map2 = MultiValueMap.multiValueMap(new HashMap(), (Class) String.class);
+ final MultiValueMap map2 = MultiValueMap.multiValueMap(new HashMap(), (Class) String.class);
bytes = serialize(map2);
try {
result = deserialize(bytes);
fail("unsafe clazz accepted when de-serializing MultiValueMap");
- } catch (UnsupportedOperationException ex) {
+ } catch (final UnsupportedOperationException ex) {
// expected
}
}
private byte[] serialize(final Object object) throws IOException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(object);
oos.close();
@@ -418,8 +419,8 @@ public class MultiValueMapTest<K, V> extends AbstractObjectTest {
}
private Object deserialize(final byte[] data) throws IOException, ClassNotFoundException {
- ByteArrayInputStream bais = new ByteArrayInputStream(data);
- ObjectInputStream iis = new ObjectInputStream(bais);
+ final ByteArrayInputStream bais = new ByteArrayInputStream(data);
+ final ObjectInputStream iis = new ObjectInputStream(bais);
return iis.readObject();
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/712ddb1e/src/test/java/org/apache/commons/collections4/map/PassiveExpiringMapTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/map/PassiveExpiringMapTest.java b/src/test/java/org/apache/commons/collections4/map/PassiveExpiringMapTest.java
index 8da6831..6e42b84 100644
--- a/src/test/java/org/apache/commons/collections4/map/PassiveExpiringMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/PassiveExpiringMapTest.java
@@ -241,7 +241,7 @@ public class PassiveExpiringMapTest<K, V> extends AbstractMapTest<K, V> {
try {
Thread.sleep(2 * timeout);
- } catch (InterruptedException e) {
+ } catch (final InterruptedException e) {
fail();
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/712ddb1e/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java b/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java
index 41d92f7..78e8d17 100644
--- a/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java
@@ -206,6 +206,7 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
public void testMultipleValues() {
final MultiValuedMap<K, V> map = makeFullMap();
@SuppressWarnings("unchecked")
+ final
Collection<V> col = map.get((K) "one");
assertTrue(col.contains("uno"));
assertTrue(col.contains("un"));
@@ -229,8 +230,8 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
}
resetEmpty();
final MultiValuedMap<K, V> map = getMap();
- Collection<V> col1 = map.get((K) "one");
- Collection<V> col2 = map.get((K) "one");
+ final Collection<V> col1 = map.get((K) "one");
+ final Collection<V> col2 = map.get((K) "one");
assertTrue(col1.isEmpty());
assertTrue(col2.isEmpty());
assertEquals(0, map.size());
@@ -275,6 +276,7 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
resetFull();
final MultiValuedMap<K, V> map = getMap();
@SuppressWarnings("unchecked")
+ final
Iterator<V> it = map.get((K) "one").iterator();
while (it.hasNext()) {
it.next();
@@ -286,7 +288,7 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
assertFalse(map.containsValue("uno"));
assertFalse(map.containsValue("un"));
assertEquals(4, map.size());
- Collection<V> coll = map.remove("one");
+ final Collection<V> coll = map.remove("one");
assertNotNull(coll);
assertEquals(0, coll.size());
}
@@ -354,7 +356,7 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
return;
}
final MultiValuedMap<K, V> map = makeFullMap();
- Collection<V> values = map.values();
+ final Collection<V> values = map.values();
values.remove("uno");
values.remove("un");
assertFalse(map.containsKey("one"));
@@ -388,10 +390,10 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
public void testEntriesCollectionIterator() {
final MultiValuedMap<K, V> map = makeFullMap();
- Collection<V> values = new ArrayList<>(map.values());
- Iterator<Map.Entry<K, V>> iterator = map.entries().iterator();
+ final Collection<V> values = new ArrayList<>(map.values());
+ final Iterator<Map.Entry<K, V>> iterator = map.entries().iterator();
while (iterator.hasNext()) {
- Map.Entry<K, V> entry = iterator.next();
+ final Map.Entry<K, V> entry = iterator.next();
assertTrue(map.containsMapping(entry.getKey(), entry.getValue()));
assertTrue(values.contains(entry.getValue()));
if (isRemoveSupported()) {
@@ -596,7 +598,7 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
try {
map.putAll((K) "A", null);
fail("expecting NullPointerException");
- } catch (NullPointerException npe) {
+ } catch (final NullPointerException npe) {
// expected
}
@@ -638,8 +640,8 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
}
public void testKeysMultiSet() {
- MultiValuedMap<K, V> map = makeFullMap();
- MultiSet<K> keyMultiSet = map.keys();
+ final MultiValuedMap<K, V> map = makeFullMap();
+ final MultiSet<K> keyMultiSet = map.keys();
assertEquals(2, keyMultiSet.getCount("one"));
assertEquals(2, keyMultiSet.getCount("two"));
assertEquals(2, keyMultiSet.getCount("three"));
@@ -647,13 +649,13 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
}
public void testKeysBagIterator() {
- MultiValuedMap<K, V> map = makeFullMap();
- Collection<K> col = new ArrayList<>();
- Iterator<K> it = map.keys().iterator();
+ final MultiValuedMap<K, V> map = makeFullMap();
+ final Collection<K> col = new ArrayList<>();
+ final Iterator<K> it = map.keys().iterator();
while (it.hasNext()) {
col.add(it.next());
}
- Bag<K> bag = new HashBag<>(col);
+ final Bag<K> bag = new HashBag<>(col);
assertEquals(2, bag.getCount("one"));
assertEquals(2, bag.getCount("two"));
assertEquals(2, bag.getCount("three"));
@@ -662,9 +664,9 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
@SuppressWarnings("unchecked")
public void testKeysBagContainsAll() {
- MultiValuedMap<K, V> map = makeFullMap();
- MultiSet<K> keyMultiSet = map.keys();
- Collection<K> col = (Collection<K>) Arrays.asList("one", "two", "three", "one", "two", "three");
+ final MultiValuedMap<K, V> map = makeFullMap();
+ final MultiSet<K> keyMultiSet = map.keys();
+ final Collection<K> col = (Collection<K>) Arrays.asList("one", "two", "three", "one", "two", "three");
assertTrue(keyMultiSet.containsAll(col));
}
@@ -676,7 +678,7 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
resetFull();
mapCol = getMap().asMap();
- Collection<V> col = mapCol.get("one");
+ final Collection<V> col = mapCol.get("one");
assertNotNull(col);
assertTrue(col.contains("un"));
assertTrue(col.contains("uno"));
@@ -687,7 +689,7 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
return;
}
resetFull();
- Map<K, Collection<V>> mapCol = getMap().asMap();
+ final Map<K, Collection<V>> mapCol = getMap().asMap();
mapCol.remove("one");
assertFalse(getMap().containsKey("one"));
assertEquals(4, getMap().size());
@@ -701,8 +703,8 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
resetFull();
mapIt = getMap().mapIterator();
while (mapIt.hasNext()) {
- K key = mapIt.next();
- V value = mapIt.getValue();
+ final K key = mapIt.next();
+ final V value = mapIt.getValue();
assertTrue(getMap().containsMapping(key, value));
}
}
@@ -712,7 +714,7 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
return;
}
resetFull();
- MapIterator<K, V> mapIt = getMap().mapIterator();
+ final MapIterator<K, V> mapIt = getMap().mapIterator();
while (mapIt.hasNext()) {
mapIt.next();
mapIt.remove();
@@ -723,12 +725,12 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
@SuppressWarnings("unchecked")
public void testMapIteratorUnsupportedSet() {
resetFull();
- MapIterator<K, V> mapIt = getMap().mapIterator();
+ final MapIterator<K, V> mapIt = getMap().mapIterator();
mapIt.next();
try {
mapIt.setValue((V) "some value");
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
}
@@ -1075,8 +1077,8 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
@Override
@SuppressWarnings("unchecked")
public K[] getSampleKeys() {
- K[] samplekeys = AbstractMultiValuedMapTest.this.getSampleKeys();
- Object[] finalKeys = new Object[3];
+ final K[] samplekeys = AbstractMultiValuedMapTest.this.getSampleKeys();
+ final Object[] finalKeys = new Object[3];
for (int i = 0; i < 3; i++) {
finalKeys[i] = samplekeys[i * 2];
}
@@ -1086,11 +1088,11 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
@Override
@SuppressWarnings("unchecked")
public Collection<V>[] getSampleValues() {
- boolean isSetValuedMap = AbstractMultiValuedMapTest.this.getMap() instanceof SetValuedMap;
- V[] sampleValues = AbstractMultiValuedMapTest.this.getSampleValues();
- Collection<V>[] colArr = new Collection[3];
+ final boolean isSetValuedMap = AbstractMultiValuedMapTest.this.getMap() instanceof SetValuedMap;
+ final V[] sampleValues = AbstractMultiValuedMapTest.this.getSampleValues();
+ final Collection<V>[] colArr = new Collection[3];
for(int i = 0; i < 3; i++) {
- Collection<V> coll = Arrays.asList(sampleValues[i*2], sampleValues[i*2 + 1]);
+ final Collection<V> coll = Arrays.asList(sampleValues[i*2], sampleValues[i*2 + 1]);
colArr[i] = isSetValuedMap ? new HashSet<>(coll) : coll;
}
return colArr;
@@ -1099,11 +1101,11 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
@Override
@SuppressWarnings("unchecked")
public Collection<V>[] getNewSampleValues() {
- boolean isSetValuedMap = AbstractMultiValuedMapTest.this.getMap() instanceof SetValuedMap;
- Object[] sampleValues = { "ein", "ek", "zwei", "duey", "drei", "teen" };
- Collection<V>[] colArr = new Collection[3];
+ final boolean isSetValuedMap = AbstractMultiValuedMapTest.this.getMap() instanceof SetValuedMap;
+ final Object[] sampleValues = { "ein", "ek", "zwei", "duey", "drei", "teen" };
+ final Collection<V>[] colArr = new Collection[3];
for (int i = 0; i < 3; i++) {
- Collection<V> coll = Arrays.asList((V) sampleValues[i * 2], (V) sampleValues[i * 2 + 1]);
+ final Collection<V> coll = Arrays.asList((V) sampleValues[i * 2], (V) sampleValues[i * 2 + 1]);
colArr[i] = isSetValuedMap ? new HashSet<>(coll) : coll;
}
return colArr;
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/712ddb1e/src/test/java/org/apache/commons/collections4/multimap/ArrayListValuedHashMapTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/multimap/ArrayListValuedHashMapTest.java b/src/test/java/org/apache/commons/collections4/multimap/ArrayListValuedHashMapTest.java
index 57b38f6..260947c 100644
--- a/src/test/java/org/apache/commons/collections4/multimap/ArrayListValuedHashMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/multimap/ArrayListValuedHashMapTest.java
@@ -51,7 +51,7 @@ public class ArrayListValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest
public void testListValuedMapAdd() {
final ListValuedMap<K, V> listMap = makeObject();
assertTrue(listMap.get((K) "whatever") instanceof List);
- List<V> list = listMap.get((K) "A");
+ final List<V> list = listMap.get((K) "A");
list.add((V) "a1");
assertEquals(1, listMap.size());
assertTrue(listMap.containsKey("A"));
@@ -60,7 +60,7 @@ public class ArrayListValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest
@SuppressWarnings("unchecked")
public void testListValuedMapAddViaListIterator() {
final ListValuedMap<K, V> listMap = makeObject();
- ListIterator<V> listIt = listMap.get((K) "B").listIterator();
+ final ListIterator<V> listIt = listMap.get((K) "B").listIterator();
assertFalse(listIt.hasNext());
listIt.add((V) "b1");
listIt.add((V) "b2");
@@ -74,7 +74,7 @@ public class ArrayListValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest
@SuppressWarnings("unchecked")
public void testListValuedMapRemove() {
final ListValuedMap<K, V> listMap = makeObject();
- List<V> list = listMap.get((K) "A");
+ final List<V> list = listMap.get((K) "A");
list.add((V) "a1");
list.add((V) "a2");
list.add((V) "a3");
@@ -110,8 +110,8 @@ public class ArrayListValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testEqualsHashCodeContract() {
- MultiValuedMap map1 = makeObject();
- MultiValuedMap map2 = makeObject();
+ final MultiValuedMap map1 = makeObject();
+ final MultiValuedMap map2 = makeObject();
map1.put("a", "a1");
map1.put("a", "a2");
@@ -127,8 +127,8 @@ public class ArrayListValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testListValuedMapEqualsHashCodeContract() {
- ListValuedMap map1 = makeObject();
- ListValuedMap map2 = makeObject();
+ final ListValuedMap map1 = makeObject();
+ final ListValuedMap map2 = makeObject();
map1.put("a", "a1");
map1.put("a", "a2");
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/712ddb1e/src/test/java/org/apache/commons/collections4/multimap/HashSetValuedHashMapTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/multimap/HashSetValuedHashMapTest.java b/src/test/java/org/apache/commons/collections4/multimap/HashSetValuedHashMapTest.java
index 7455831..2a46641 100644
--- a/src/test/java/org/apache/commons/collections4/multimap/HashSetValuedHashMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/multimap/HashSetValuedHashMapTest.java
@@ -57,7 +57,7 @@ public class HashSetValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest<K
final SetValuedMap<K, V> setMap = makeObject();
assertTrue(setMap.get((K) "whatever") instanceof Set);
- Set<V> set = setMap.get((K) "A");
+ final Set<V> set = setMap.get((K) "A");
assertTrue(set.add((V) "a1"));
assertTrue(set.add((V) "a2"));
assertFalse(set.add((V) "a1"));
@@ -70,7 +70,7 @@ public class HashSetValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest<K
final SetValuedMap<K, V> setMap = makeObject();
assertTrue(setMap.get((K) "whatever") instanceof Set);
- Set<V> set = setMap.get((K) "A");
+ final Set<V> set = setMap.get((K) "A");
assertTrue(set.add((V) "a1"));
assertTrue(set.add((V) "a2"));
assertFalse(set.add((V) "a1"));
@@ -90,12 +90,12 @@ public class HashSetValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest<K
final SetValuedMap<K, V> setMap = makeObject();
assertTrue(setMap.get((K) "whatever") instanceof Set);
- Set<V> set = setMap.get((K) "A");
+ final Set<V> set = setMap.get((K) "A");
set.add((V) "a1");
set.add((V) "a2");
set.add((V) "a1");
- Iterator<V> it = set.iterator();
+ final Iterator<V> it = set.iterator();
while (it.hasNext()) {
it.next();
it.remove();
@@ -106,8 +106,8 @@ public class HashSetValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest<K
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testSetValuedMapEqualsHashCodeContract() {
- SetValuedMap map1 = makeObject();
- SetValuedMap map2 = makeObject();
+ final SetValuedMap map1 = makeObject();
+ final SetValuedMap map2 = makeObject();
map1.put("a", "a1");
map1.put("a", "a2");
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/712ddb1e/src/test/java/org/apache/commons/collections4/multimap/TransformedMultiValuedMapTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/multimap/TransformedMultiValuedMapTest.java b/src/test/java/org/apache/commons/collections4/multimap/TransformedMultiValuedMapTest.java
index 0133ee0..559d725 100644
--- a/src/test/java/org/apache/commons/collections4/multimap/TransformedMultiValuedMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/multimap/TransformedMultiValuedMapTest.java
@@ -53,7 +53,7 @@ public class TransformedMultiValuedMapTest<K, V> extends AbstractMultiValuedMapT
public void testKeyTransformedMap() {
final Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" };
- MultiValuedMap<K, V> map = TransformedMultiValuedMap.transformingMap(
+ final MultiValuedMap<K, V> map = TransformedMultiValuedMap.transformingMap(
new ArrayListValuedHashMap<K, V>(),
(Transformer<? super K, ? extends K>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER,
null);
@@ -67,7 +67,7 @@ public class TransformedMultiValuedMapTest<K, V> extends AbstractMultiValuedMapT
assertEquals(true, map.get((K) Integer.valueOf((String) els[i])).contains(els[i]));
}
- Collection<V> coll = map.remove(els[0]);
+ final Collection<V> coll = map.remove(els[0]);
assertNotNull(coll);
assertEquals(0, coll.size());
assertEquals(true, map.remove(Integer.valueOf((String) els[0])).contains(els[0]));
@@ -77,7 +77,7 @@ public class TransformedMultiValuedMapTest<K, V> extends AbstractMultiValuedMapT
public void testValueTransformedMap() {
final Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" };
- MultiValuedMap<K, V> map = TransformedMultiValuedMap.transformingMap(
+ final MultiValuedMap<K, V> map = TransformedMultiValuedMap.transformingMap(
new ArrayListValuedHashMap<K, V>(), null,
(Transformer<? super V, ? extends V>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
assertEquals(0, map.size());
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/712ddb1e/src/test/java/org/apache/commons/collections4/multimap/UnmodifiableMultiValuedMapTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/multimap/UnmodifiableMultiValuedMapTest.java b/src/test/java/org/apache/commons/collections4/multimap/UnmodifiableMultiValuedMapTest.java
index ad2d776..22e76ce 100644
--- a/src/test/java/org/apache/commons/collections4/multimap/UnmodifiableMultiValuedMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/multimap/UnmodifiableMultiValuedMapTest.java
@@ -85,179 +85,179 @@ public class UnmodifiableMultiValuedMapTest<K, V> extends AbstractMultiValuedMap
try {
UnmodifiableMultiValuedMap.unmodifiableMultiValuedMap(null);
fail("map must not be null");
- } catch (NullPointerException e) {
+ } catch (final NullPointerException e) {
// expected
}
}
@SuppressWarnings("unchecked")
public void testAddException() {
- MultiValuedMap<K, V> map = makeObject();
+ final MultiValuedMap<K, V> map = makeObject();
try {
map.put((K) "one", (V) "uno");
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
}
@SuppressWarnings("unchecked")
public void testUnmodifiableEntries() {
resetFull();
- Collection<Entry<K, V>> entries = getMap().entries();
+ final Collection<Entry<K, V>> entries = getMap().entries();
try {
entries.clear();
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
- Iterator<Entry<K, V>> it = entries.iterator();
- Entry<K, V> entry = it.next();
+ final Iterator<Entry<K, V>> it = entries.iterator();
+ final Entry<K, V> entry = it.next();
try {
it.remove();
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
try {
entry.setValue((V) "three");
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
}
@SuppressWarnings("unchecked")
public void testUnmodifiableMapIterator() {
resetFull();
- MapIterator<K, V> mapIt = getMap().mapIterator();
+ final MapIterator<K, V> mapIt = getMap().mapIterator();
try {
mapIt.remove();
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
try {
mapIt.setValue((V) "three");
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
}
@SuppressWarnings("unchecked")
public void testUnmodifiableKeySet() {
resetFull();
- Set<K> keySet = getMap().keySet();
+ final Set<K> keySet = getMap().keySet();
try {
keySet.add((K) "four");
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
try {
keySet.remove("four");
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
try {
keySet.clear();
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
- Iterator<K> it = keySet.iterator();
+ final Iterator<K> it = keySet.iterator();
try {
it.remove();
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
}
@SuppressWarnings("unchecked")
public void testUnmodifiableValues() {
resetFull();
- Collection<V> values = getMap().values();
+ final Collection<V> values = getMap().values();
try {
values.add((V) "four");
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
try {
values.remove("four");
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
try {
values.clear();
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
- Iterator<V> it = values.iterator();
+ final Iterator<V> it = values.iterator();
try {
it.remove();
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
}
@SuppressWarnings("unchecked")
public void testUnmodifiableAsMap() {
resetFull();
- Map<K, Collection<V>> mapCol = getMap().asMap();
+ final Map<K, Collection<V>> mapCol = getMap().asMap();
try {
mapCol.put((K) "four", (Collection<V>) Arrays.asList("four"));
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
try {
mapCol.remove("four");
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
try {
mapCol.clear();
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
try {
mapCol.clear();
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
}
@SuppressWarnings("unchecked")
public void testUnmodifiableKeys() {
resetFull();
- MultiSet<K> keys = getMap().keys();
+ final MultiSet<K> keys = getMap().keys();
try {
keys.add((K) "four");
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
try {
keys.remove("four");
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
try {
keys.clear();
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
- Iterator<K> it = keys.iterator();
+ final Iterator<K> it = keys.iterator();
try {
it.remove();
fail();
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
}
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/712ddb1e/src/test/java/org/apache/commons/collections4/queue/AbstractQueueTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/queue/AbstractQueueTest.java b/src/test/java/org/apache/commons/collections4/queue/AbstractQueueTest.java
index 3d49d61..da33837 100644
--- a/src/test/java/org/apache/commons/collections4/queue/AbstractQueueTest.java
+++ b/src/test/java/org/apache/commons/collections4/queue/AbstractQueueTest.java
@@ -72,7 +72,7 @@ public abstract class AbstractQueueTest<E> extends AbstractCollectionTest<E> {
public void verify() {
super.verify();
final Iterator<E> iterator1 = getCollection().iterator();
- for (E e : getConfirmed()) {
+ for (final E e : getConfirmed()) {
assertTrue(iterator1.hasNext());
final Object o1 = iterator1.next();
final Object o2 = e;
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/712ddb1e/src/test/java/org/apache/commons/collections4/queue/CircularFifoQueueTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/collections4/queue/CircularFifoQueueTest.java b/src/test/java/org/apache/commons/collections4/queue/CircularFifoQueueTest.java
index ac51874..e38ade4 100644
--- a/src/test/java/org/apache/commons/collections4/queue/CircularFifoQueueTest.java
+++ b/src/test/java/org/apache/commons/collections4/queue/CircularFifoQueueTest.java
@@ -48,7 +48,7 @@ public class CircularFifoQueueTest<E> extends AbstractQueueTest<E> {
public void verify() {
super.verify();
final Iterator<E> iterator1 = getCollection().iterator();
- for (E e : getConfirmed()) {
+ for (final E e : getConfirmed()) {
assertTrue(iterator1.hasNext());
final Object o1 = iterator1.next();
final Object o2 = e;