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 2013/01/07 18:15:24 UTC
svn commit: r1429905 [25/26] - in /commons/proper/collections/trunk/src:
main/java/org/apache/commons/collections/
main/java/org/apache/commons/collections/bag/
main/java/org/apache/commons/collections/bidimap/
main/java/org/apache/commons/collections/...
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/MultiKeyMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/MultiKeyMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/MultiKeyMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/MultiKeyMapTest.java Mon Jan 7 17:15:14 2013
@@ -41,7 +41,7 @@ public class MultiKeyMapTest<K, V> exten
static final Integer I7 = new Integer(7);
static final Integer I8 = new Integer(8);
- public MultiKeyMapTest(String testName) {
+ public MultiKeyMapTest(final String testName) {
super(testName);
}
@@ -129,24 +129,24 @@ public class MultiKeyMapTest<K, V> exten
try {
map.put(null, null);
fail();
- } catch (NullPointerException ex) {}
+ } catch (final NullPointerException ex) {}
assertEquals(null, map.put(new MultiKey<K>(null, null), null));
try {
map.put(null, (V) new Object());
fail();
- } catch (NullPointerException ex) {}
+ } catch (final NullPointerException ex) {}
}
//-----------------------------------------------------------------------
public void testMultiKeyGet() {
resetFull();
- MultiKeyMap<K, V> multimap = getMap();
- MultiKey<K>[] keys = getMultiKeyKeys();
- V[] values = getSampleValues();
+ final MultiKeyMap<K, V> multimap = getMap();
+ final MultiKey<K>[] keys = getMultiKeyKeys();
+ final V[] values = getSampleValues();
for (int i = 0; i < keys.length; i++) {
- MultiKey<K> key = keys[i];
- V value = values[i];
+ final MultiKey<K> key = keys[i];
+ final V value = values[i];
switch (key.size()) {
case 2:
@@ -193,10 +193,10 @@ public class MultiKeyMapTest<K, V> exten
public void testMultiKeyContainsKey() {
resetFull();
- MultiKeyMap<K, V> multimap = getMap();
- MultiKey<K>[] keys = getMultiKeyKeys();
+ final MultiKeyMap<K, V> multimap = getMap();
+ final MultiKey<K>[] keys = getMultiKeyKeys();
- for (MultiKey<K> key : keys) {
+ for (final MultiKey<K> key : keys) {
switch (key.size()) {
case 2:
assertEquals(true, multimap.containsKey(key.getKey(0), key.getKey(1)));
@@ -241,14 +241,14 @@ public class MultiKeyMapTest<K, V> exten
}
public void testMultiKeyPut() {
- MultiKey<K>[] keys = getMultiKeyKeys();
- V[] values = getSampleValues();
+ final MultiKey<K>[] keys = getMultiKeyKeys();
+ final V[] values = getSampleValues();
for (int i = 0; i < keys.length; i++) {
- MultiKeyMap<K, V> multimap = new MultiKeyMap<K, V>();
+ final MultiKeyMap<K, V> multimap = new MultiKeyMap<K, V>();
- MultiKey<K> key = keys[i];
- V value = values[i];
+ final MultiKey<K> key = keys[i];
+ final V value = values[i];
switch (key.size()) {
case 2:
@@ -302,16 +302,16 @@ public class MultiKeyMapTest<K, V> exten
}
public void testMultiKeyRemove() {
- MultiKey<K>[] keys = getMultiKeyKeys();
- V[] values = getSampleValues();
+ final MultiKey<K>[] keys = getMultiKeyKeys();
+ final V[] values = getSampleValues();
for (int i = 0; i < keys.length; i++) {
resetFull();
- MultiKeyMap<K, V> multimap = getMap();
- int size = multimap.size();
+ final MultiKeyMap<K, V> multimap = getMap();
+ final int size = multimap.size();
- MultiKey<K> key = keys[i];
- V value = values[i];
+ final MultiKey<K> key = keys[i];
+ final V value = values[i];
switch (key.size()) {
case 2:
@@ -354,52 +354,52 @@ public class MultiKeyMapTest<K, V> exten
public void testMultiKeyRemoveAll1() {
resetFull();
- MultiKeyMap<K, V> multimap = getMap();
+ final MultiKeyMap<K, V> multimap = getMap();
assertEquals(12, multimap.size());
multimap.removeAll(I1);
assertEquals(8, multimap.size());
- for (MapIterator<MultiKey<? extends K>, V> it = multimap.mapIterator(); it.hasNext();) {
- MultiKey<? extends K> key = it.next();
+ for (final MapIterator<MultiKey<? extends K>, V> it = multimap.mapIterator(); it.hasNext();) {
+ final MultiKey<? extends K> key = it.next();
assertEquals(false, I1.equals(key.getKey(0)));
}
}
public void testMultiKeyRemoveAll2() {
resetFull();
- MultiKeyMap<K, V> multimap = getMap();
+ final MultiKeyMap<K, V> multimap = getMap();
assertEquals(12, multimap.size());
multimap.removeAll(I2, I3);
assertEquals(9, multimap.size());
- for (MapIterator<MultiKey<? extends K>, V> it = multimap.mapIterator(); it.hasNext();) {
- MultiKey<? extends K> key = it.next();
+ for (final MapIterator<MultiKey<? extends K>, V> it = multimap.mapIterator(); it.hasNext();) {
+ final MultiKey<? extends K> key = it.next();
assertEquals(false, I2.equals(key.getKey(0)) && I3.equals(key.getKey(1)));
}
}
public void testMultiKeyRemoveAll3() {
resetFull();
- MultiKeyMap<K, V> multimap = getMap();
+ final MultiKeyMap<K, V> multimap = getMap();
assertEquals(12, multimap.size());
multimap.removeAll(I1, I1, I2);
assertEquals(9, multimap.size());
- for (MapIterator<MultiKey<? extends K>, V> it = multimap.mapIterator(); it.hasNext();) {
- MultiKey<? extends K> key = it.next();
+ for (final MapIterator<MultiKey<? extends K>, V> it = multimap.mapIterator(); it.hasNext();) {
+ final MultiKey<? extends K> key = it.next();
assertEquals(false, I1.equals(key.getKey(0)) && I1.equals(key.getKey(1)) && I2.equals(key.getKey(2)));
}
}
public void testMultiKeyRemoveAll4() {
resetFull();
- MultiKeyMap<K, V> multimap = getMap();
+ final MultiKeyMap<K, V> multimap = getMap();
assertEquals(12, multimap.size());
multimap.removeAll(I1, I1, I2, I3);
assertEquals(10, multimap.size());
- for (MapIterator<MultiKey<? extends K>, V> it = multimap.mapIterator(); it.hasNext();) {
- MultiKey<? extends K> key = it.next();
+ for (final MapIterator<MultiKey<? extends K>, V> it = multimap.mapIterator(); it.hasNext();) {
+ final MultiKey<? extends K> key = it.next();
assertEquals(false, I1.equals(key.getKey(0)) && I1.equals(key.getKey(1)) && I2.equals(key.getKey(2)) && key.size() >= 4 && I3.equals(key.getKey(3)));
}
}
@@ -407,9 +407,9 @@ public class MultiKeyMapTest<K, V> exten
//-----------------------------------------------------------------------
@SuppressWarnings("unchecked")
public void testClone() {
- MultiKeyMap<K, V> map = new MultiKeyMap<K, V>();
+ final MultiKeyMap<K, V> map = new MultiKeyMap<K, V>();
map.put(new MultiKey<K>((K) I1, (K) I2), (V) "1-2");
- Map<MultiKey<? extends K>, V> cloned = map.clone();
+ final Map<MultiKey<? extends K>, V> cloned = map.clone();
assertEquals(map.size(), cloned.size());
assertSame(map.get(new MultiKey<K>((K) I1, (K) I2)), cloned.get(new MultiKey<K>((K) I1, (K) I2)));
}
@@ -417,7 +417,7 @@ public class MultiKeyMapTest<K, V> exten
//-----------------------------------------------------------------------
@SuppressWarnings("unchecked")
public void testLRUMultiKeyMap() {
- MultiKeyMap<K, V> map = MultiKeyMap.multiKeyMap(new LRUMap<MultiKey<? extends K>, V>(2));
+ final MultiKeyMap<K, V> map = MultiKeyMap.multiKeyMap(new LRUMap<MultiKey<? extends K>, V>(2));
map.put((K) I1, (K) I2, (V) "1-2");
map.put((K) I1, (K) I3, (V) "1-1");
assertEquals(2, map.size());
@@ -427,7 +427,7 @@ public class MultiKeyMapTest<K, V> exten
assertEquals(true, map.containsKey(I1, I4));
assertEquals(false, map.containsKey(I1, I2));
- MultiKeyMap<K, V> cloned = map.clone();
+ final MultiKeyMap<K, V> cloned = map.clone();
assertEquals(2, map.size());
assertEquals(true, cloned.containsKey(I1, I3));
assertEquals(true, cloned.containsKey(I1, I4));
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/MultiValueMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/MultiValueMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/MultiValueMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/MultiValueMapTest.java Mon Jan 7 17:15:14 2013
@@ -39,7 +39,7 @@ import org.apache.commons.collections.Ab
*/
public class MultiValueMapTest<K, V> extends AbstractObjectTest {
- public MultiValueMapTest(String testName) {
+ public MultiValueMapTest(final String testName) {
super(testName);
}
@@ -108,7 +108,7 @@ public class MultiValueMapTest<K, V> ext
}
@SuppressWarnings("unchecked")
- private <C extends Collection<V>> MultiValueMap<K, V> createTestMap(Class<C> collectionClass) {
+ private <C extends Collection<V>> MultiValueMap<K, V> createTestMap(final Class<C> collectionClass) {
final MultiValueMap<K, V> map = MultiValueMap.multiValueMap(new HashMap<K, C>(), collectionClass);
map.put((K) "one", (V) "uno");
map.put((K) "one", (V) "un");
@@ -128,7 +128,7 @@ public class MultiValueMapTest<K, V> ext
public void testRemoveAllViaIterator() {
final MultiValueMap<K, V> map = createTestMap();
- for (Iterator<?> i = map.values().iterator(); i.hasNext();) {
+ for (final Iterator<?> i = map.values().iterator(); i.hasNext();) {
i.next();
i.remove();
}
@@ -138,7 +138,7 @@ public class MultiValueMapTest<K, V> ext
public void testRemoveAllViaKeyedIterator() {
final MultiValueMap<K, V> map = createTestMap();
- for (Iterator<?> i = map.iterator("one"); i.hasNext();) {
+ for (final Iterator<?> i = map.iterator("one"); i.hasNext();) {
i.next();
i.remove();
}
@@ -153,26 +153,26 @@ public class MultiValueMapTest<K, V> ext
//-----------------------------------------------------------------------
@SuppressWarnings("unchecked")
public void testMapEquals() {
- MultiValueMap<K, V> one = new MultiValueMap<K, V>();
- Integer value = new Integer(1);
+ final MultiValueMap<K, V> one = new MultiValueMap<K, V>();
+ final Integer value = new Integer(1);
one.put((K) "One", value);
one.remove("One", value);
- MultiValueMap<K, V> two = new MultiValueMap<K, V>();
+ final MultiValueMap<K, V> two = new MultiValueMap<K, V>();
assertEquals(two, one);
}
//-----------------------------------------------------------------------
@SuppressWarnings("unchecked")
public void testGetCollection() {
- MultiValueMap<K, V> map = new MultiValueMap<K, V>();
+ final MultiValueMap<K, V> map = new MultiValueMap<K, V>();
map.put((K) "A", "AA");
assertSame(map.get("A"), map.getCollection("A"));
}
@SuppressWarnings("unchecked")
public void testTotalSize() {
- MultiValueMap<K, V> map = new MultiValueMap<K, V>();
+ final MultiValueMap<K, V> map = new MultiValueMap<K, V>();
assertEquals(0, map.totalSize());
map.put((K) "A", "AA");
assertEquals(1, map.totalSize());
@@ -190,7 +190,7 @@ public class MultiValueMapTest<K, V> ext
@SuppressWarnings("unchecked")
public void testSize() {
- MultiValueMap<K, V> map = new MultiValueMap<K, V>();
+ final MultiValueMap<K, V> map = new MultiValueMap<K, V>();
assertEquals(0, map.size());
map.put((K) "A", "AA");
assertEquals(1, map.size());
@@ -208,7 +208,7 @@ public class MultiValueMapTest<K, V> ext
@SuppressWarnings("unchecked")
public void testSize_Key() {
- MultiValueMap<K, V> map = new MultiValueMap<K, V>();
+ final MultiValueMap<K, V> map = new MultiValueMap<K, V>();
assertEquals(0, map.size("A"));
assertEquals(0, map.size("B"));
map.put((K) "A", "AA");
@@ -233,10 +233,10 @@ public class MultiValueMapTest<K, V> ext
@SuppressWarnings("unchecked")
public void testIterator_Key() {
- MultiValueMap<K, V> map = new MultiValueMap<K, V>();
+ final MultiValueMap<K, V> map = new MultiValueMap<K, V>();
assertEquals(false, map.iterator("A").hasNext());
map.put((K) "A", "AA");
- Iterator<?> it = map.iterator("A");
+ final Iterator<?> it = map.iterator("A");
assertEquals(true, it.hasNext());
it.next();
assertEquals(false, it.hasNext());
@@ -244,7 +244,7 @@ public class MultiValueMapTest<K, V> ext
@SuppressWarnings("unchecked")
public void testContainsValue_Key() {
- MultiValueMap<K, V> map = new MultiValueMap<K, V>();
+ final MultiValueMap<K, V> map = new MultiValueMap<K, V>();
assertEquals(false, map.containsValue("A", "AA"));
assertEquals(false, map.containsValue("B", "BB"));
map.put((K) "A", "AA");
@@ -254,7 +254,7 @@ public class MultiValueMapTest<K, V> ext
@SuppressWarnings("unchecked")
public void testPutWithList() {
- MultiValueMap<K, V> test = MultiValueMap.multiValueMap(new HashMap<K, Collection>(), ArrayList.class);
+ final MultiValueMap<K, V> test = MultiValueMap.multiValueMap(new HashMap<K, Collection>(), ArrayList.class);
assertEquals("a", test.put((K) "A", "a"));
assertEquals("b", test.put((K) "A", "b"));
assertEquals(1, test.size());
@@ -264,7 +264,7 @@ public class MultiValueMapTest<K, V> ext
@SuppressWarnings("unchecked")
public void testPutWithSet() {
- MultiValueMap<K, V> test = MultiValueMap.multiValueMap(new HashMap<K, HashSet>(), HashSet.class);
+ final MultiValueMap<K, V> test = MultiValueMap.multiValueMap(new HashMap<K, HashSet>(), HashSet.class);
assertEquals("a", test.put((K) "A", "a"));
assertEquals("b", test.put((K) "A", "b"));
assertEquals(null, test.put((K) "A", "a"));
@@ -275,11 +275,11 @@ public class MultiValueMapTest<K, V> ext
@SuppressWarnings("unchecked")
public void testPutAll_Map1() {
- MultiMap<K, V> original = new MultiValueMap<K, V>();
+ final MultiMap<K, V> original = new MultiValueMap<K, V>();
original.put((K) "key", "object1");
original.put((K) "key", "object2");
- MultiValueMap<K, V> test = new MultiValueMap<K, V>();
+ final MultiValueMap<K, V> test = new MultiValueMap<K, V>();
test.put((K) "keyA", "objectA");
test.put((K) "key", "object0");
test.putAll(original);
@@ -296,11 +296,11 @@ public class MultiValueMapTest<K, V> ext
@SuppressWarnings("unchecked")
public void testPutAll_Map2() {
- Map<K, V> original = new HashMap<K, V>();
+ final Map<K, V> original = new HashMap<K, V>();
original.put((K) "keyX", (V) "object1");
original.put((K) "keyY", (V) "object2");
- MultiValueMap<K, V> test = new MultiValueMap<K, V>();
+ final MultiValueMap<K, V> test = new MultiValueMap<K, V>();
test.put((K) "keyA", "objectA");
test.put((K) "keyX", "object0");
test.putAll(original);
@@ -318,7 +318,7 @@ public class MultiValueMapTest<K, V> ext
@SuppressWarnings("unchecked")
public void testPutAll_KeyCollection() {
- MultiValueMap<K, V> map = new MultiValueMap<K, V>();
+ final MultiValueMap<K, V> map = new MultiValueMap<K, V>();
Collection<V> coll = (Collection<V>) Arrays.asList(new Object[] { "X", "Y", "Z" });
assertEquals(true, map.putAll((K) "A", coll));
@@ -350,7 +350,7 @@ public class MultiValueMapTest<K, V> ext
@SuppressWarnings("unchecked")
public void testRemove_KeyItem() {
- MultiValueMap<K, V> map = new MultiValueMap<K, V>();
+ final MultiValueMap<K, V> map = new MultiValueMap<K, V>();
map.put((K) "A", "AA");
map.put((K) "A", "AB");
map.put((K) "A", "AC");
@@ -374,7 +374,7 @@ public class MultiValueMapTest<K, V> ext
@Override
public Object makeObject() {
- Map m = makeEmptyMap();
+ final Map m = makeEmptyMap();
m.put("a", "1");
m.put("a", "1b");
m.put("b", "2");
@@ -399,15 +399,15 @@ public class MultiValueMapTest<K, V> ext
// }
public void testEmptyMapCompatibility() throws Exception {
- Map<?,?> map = makeEmptyMap();
- Map<?,?> map2 = (Map<?,?>) readExternalFormFromDisk(getCanonicalEmptyCollectionName(map));
+ final Map<?,?> map = makeEmptyMap();
+ final Map<?,?> map2 = (Map<?,?>) readExternalFormFromDisk(getCanonicalEmptyCollectionName(map));
assertEquals("Map is empty", 0, map2.size());
}
public void testFullMapCompatibility() throws Exception {
- Map<?,?> map = (Map<?,?>) makeObject();
- Map<?,?> map2 = (Map<?,?>) readExternalFormFromDisk(getCanonicalFullCollectionName(map));
+ final Map<?,?> map = (Map<?,?>) makeObject();
+ final Map<?,?> map2 = (Map<?,?>) readExternalFormFromDisk(getCanonicalFullCollectionName(map));
assertEquals("Map is the right size", map.size(), map2.size());
- for (Object key : map.keySet()) {
+ for (final Object key : map.keySet()) {
assertEquals( "Map had inequal elements", map.get(key), map2.get(key) );
map2.remove(key);
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/PassiveExpiringMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/PassiveExpiringMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/PassiveExpiringMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/PassiveExpiringMapTest.java Mon Jan 7 17:15:14 2013
@@ -17,7 +17,7 @@ public class PassiveExpiringMapTest<K, V
private static final long serialVersionUID = 1L;
- public long expirationTime(Integer key, String value) {
+ public long expirationTime(final Integer key, final String value) {
// odd keys expire immediately, even keys never expire
if (key == null) {
return 0;
@@ -35,7 +35,7 @@ public class PassiveExpiringMapTest<K, V
return BulkTest.makeSuite(PassiveExpiringMapTest.class);
}
- public PassiveExpiringMapTest(String testName) {
+ public PassiveExpiringMapTest(final String testName) {
super(testName);
}
@@ -53,7 +53,7 @@ public class PassiveExpiringMapTest<K, V
}
private Map<Integer, String> makeDecoratedTestMap() {
- Map<Integer, String> m = new HashMap<Integer, String>();
+ final Map<Integer, String> m = new HashMap<Integer, String>();
m.put(Integer.valueOf(1), "one");
m.put(Integer.valueOf(2), "two");
m.put(Integer.valueOf(3), "three");
@@ -71,7 +71,7 @@ public class PassiveExpiringMapTest<K, V
}
private Map<Integer, String> makeTestMap() {
- Map<Integer, String> m = new PassiveExpiringMap<Integer, String>(
+ final Map<Integer, String> m = new PassiveExpiringMap<Integer, String>(
new TestExpirationPolicy());
m.put(Integer.valueOf(1), "one");
m.put(Integer.valueOf(2), "two");
@@ -84,32 +84,32 @@ public class PassiveExpiringMapTest<K, V
public void testConstructors() {
try {
- Map<String, String> map = null;
+ final Map<String, String> map = null;
new PassiveExpiringMap<String, String>(map);
fail("constructor - exception should have been thrown.");
- } catch (IllegalArgumentException ex) {
+ } catch (final IllegalArgumentException ex) {
// success
}
try {
- ExpirationPolicy<String, String> policy = null;
+ final ExpirationPolicy<String, String> policy = null;
new PassiveExpiringMap<String, String>(policy);
fail("constructor - exception should have been thrown.");
- } catch (IllegalArgumentException ex) {
+ } catch (final IllegalArgumentException ex) {
// success
}
try {
- TimeUnit unit = null;
+ final TimeUnit unit = null;
new PassiveExpiringMap<String, String>(10L, unit);
fail("constructor - exception should have been thrown.");
- } catch (IllegalArgumentException ex) {
+ } catch (final IllegalArgumentException ex) {
// success
}
}
public void testContainsKey() {
- Map<Integer, String> m = makeTestMap();
+ final Map<Integer, String> m = makeTestMap();
assertFalse(m.containsKey(Integer.valueOf(1)));
assertFalse(m.containsKey(Integer.valueOf(3)));
assertFalse(m.containsKey(Integer.valueOf(5)));
@@ -119,7 +119,7 @@ public class PassiveExpiringMapTest<K, V
}
public void testContainsValue() {
- Map<Integer, String> m = makeTestMap();
+ final Map<Integer, String> m = makeTestMap();
assertFalse(m.containsValue("one"));
assertFalse(m.containsValue("three"));
assertFalse(m.containsValue("five"));
@@ -130,7 +130,7 @@ public class PassiveExpiringMapTest<K, V
public void testDecoratedMap() {
// entries shouldn't expire
- Map<Integer, String> m = makeDecoratedTestMap();
+ final Map<Integer, String> m = makeDecoratedTestMap();
assertEquals(6, m.size());
assertEquals("one", m.get(Integer.valueOf(1)));
@@ -158,12 +158,12 @@ public class PassiveExpiringMapTest<K, V
}
public void testEntrySet() {
- Map<Integer, String> m = makeTestMap();
+ final Map<Integer, String> m = makeTestMap();
assertEquals(3, m.entrySet().size());
}
public void testGet() {
- Map<Integer, String> m = makeTestMap();
+ final Map<Integer, String> m = makeTestMap();
assertNull(m.get(Integer.valueOf(1)));
assertEquals("two", m.get(Integer.valueOf(2)));
assertNull(m.get(Integer.valueOf(3)));
@@ -185,23 +185,23 @@ public class PassiveExpiringMapTest<K, V
}
public void testKeySet() {
- Map<Integer, String> m = makeTestMap();
+ final Map<Integer, String> m = makeTestMap();
assertEquals(3, m.keySet().size());
}
public void testSize() {
- Map<Integer, String> m = makeTestMap();
+ final Map<Integer, String> m = makeTestMap();
assertEquals(3, m.size());
}
public void testValues() {
- Map<Integer, String> m = makeTestMap();
+ final Map<Integer, String> m = makeTestMap();
assertEquals(3, m.values().size());
}
public void testZeroTimeToLive() {
// item should not be available
- PassiveExpiringMap<String, String> m = new PassiveExpiringMap<String, String>(
+ final PassiveExpiringMap<String, String> m = new PassiveExpiringMap<String, String>(
0L);
m.put("a", "b");
assertNull(m.get("a"));
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/PredicatedMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/PredicatedMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/PredicatedMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/PredicatedMapTest.java Mon Jan 7 17:15:14 2013
@@ -38,18 +38,18 @@ public class PredicatedMapTest<K, V> ext
protected static final Predicate<Object> truePredicate = TruePredicate.<Object>truePredicate();
protected static final Predicate<Object> testPredicate = new Predicate<Object>() {
- public boolean evaluate(Object o) {
+ public boolean evaluate(final Object o) {
return o instanceof String;
}
};
- public PredicatedMapTest(String testName) {
+ public PredicatedMapTest(final String testName) {
super(testName);
}
//-----------------------------------------------------------------------
- protected IterableMap<K, V> decorateMap(Map<K, V> map, Predicate<? super K> keyPredicate,
- Predicate<? super V> valuePredicate) {
+ protected IterableMap<K, V> decorateMap(final Map<K, V> map, final Predicate<? super K> keyPredicate,
+ final Predicate<? super V> valuePredicate) {
return PredicatedMap.predicatedMap(map, keyPredicate, valuePredicate);
}
@@ -77,25 +77,25 @@ public class PredicatedMapTest<K, V> ext
@SuppressWarnings("unchecked")
public void testPut() {
- Map<K, V> map = makeTestMap();
+ final Map<K, V> map = makeTestMap();
try {
map.put((K) "Hi", (V) new Integer(3));
fail("Illegal value should raise IllegalArgument");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
try {
map.put((K) new Integer(3), (V) "Hi");
fail("Illegal key should raise IllegalArgument");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
assertTrue(!map.containsKey(new Integer(3)));
assertTrue(!map.containsValue(new Integer(3)));
- Map<K, V> map2 = new HashMap<K, V>();
+ final Map<K, V> map2 = new HashMap<K, V>();
map2.put((K) "A", (V) "a");
map2.put((K) "B", (V) "b");
map2.put((K) "C", (V) "c");
@@ -104,23 +104,23 @@ public class PredicatedMapTest<K, V> ext
try {
map.putAll(map2);
fail("Illegal value should raise IllegalArgument");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
map.put((K) "E", (V) "e");
Iterator<Map.Entry<K, V>> iterator = map.entrySet().iterator();
try {
- Map.Entry<K, V> entry = iterator.next();
+ final Map.Entry<K, V> entry = iterator.next();
entry.setValue((V) new Integer(3));
fail("Illegal value should raise IllegalArgument");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
map.put((K) "F", (V) "f");
iterator = map.entrySet().iterator();
- Map.Entry<K, V> entry = iterator.next();
+ final Map.Entry<K, V> entry = iterator.next();
entry.setValue((V) "x");
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/PredicatedSortedMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/PredicatedSortedMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/PredicatedSortedMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/PredicatedSortedMapTest.java Mon Jan 7 17:15:14 2013
@@ -40,18 +40,18 @@ public class PredicatedSortedMapTest<K,
protected static final Predicate<Object> truePredicate = TruePredicate.truePredicate();
protected static final Predicate<Object> testPredicate = new Predicate<Object>() {
- public boolean evaluate(Object o) {
+ public boolean evaluate(final Object o) {
return o instanceof String;
}
};
- public PredicatedSortedMapTest(String testName) {
+ public PredicatedSortedMapTest(final String testName) {
super(testName);
}
//-----------------------------------------------------------------------
- protected SortedMap<K, V> decorateMap(SortedMap<K, V> map, Predicate<? super K> keyPredicate,
- Predicate<? super V> valuePredicate) {
+ protected SortedMap<K, V> decorateMap(final SortedMap<K, V> map, final Predicate<? super K> keyPredicate,
+ final Predicate<? super V> valuePredicate) {
return PredicatedSortedMap.predicatedSortedMap(map, keyPredicate, valuePredicate);
}
@@ -91,25 +91,25 @@ public class PredicatedSortedMapTest<K,
@SuppressWarnings("unchecked")
public void testPut() {
- Map<K, V> map = makeTestMap();
+ final Map<K, V> map = makeTestMap();
try {
map.put((K) "Hi", (V) new Integer(3));
fail("Illegal value should raise IllegalArgument");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
try {
map.put((K) new Integer(3), (V) "Hi");
fail("Illegal key should raise IllegalArgument");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
assertTrue(!map.containsKey(new Integer(3)));
assertTrue(!map.containsValue(new Integer(3)));
- Map<K, V> map2 = new HashMap<K, V>();
+ final Map<K, V> map2 = new HashMap<K, V>();
map2.put((K) "A", (V) "a");
map2.put((K) "B", (V) "b");
map2.put((K) "C", (V) "c");
@@ -118,23 +118,23 @@ public class PredicatedSortedMapTest<K,
try {
map.putAll(map2);
fail("Illegal value should raise IllegalArgument");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
map.put((K) "E", (V) "e");
Iterator<Map.Entry<K, V>> iterator = map.entrySet().iterator();
try {
- Map.Entry<K, V> entry = iterator.next();
+ final Map.Entry<K, V> entry = iterator.next();
entry.setValue((V) new Integer(3));
fail("Illegal value should raise IllegalArgument");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
map.put((K) "F", (V) "f");
iterator = map.entrySet().iterator();
- Map.Entry<K, V> entry = iterator.next();
+ final Map.Entry<K, V> entry = iterator.next();
entry.setValue((V) "x");
}
@@ -142,20 +142,20 @@ public class PredicatedSortedMapTest<K,
//-----------------------------------------------------------------------
@SuppressWarnings("unchecked")
public void testSortOrder() {
- SortedMap<K, V> map = makeTestMap();
+ final SortedMap<K, V> map = makeTestMap();
map.put((K) "A", (V) "a");
map.put((K) "B", (V) "b");
try {
map.put(null, (V) "c");
fail("Null key should raise IllegalArgument");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
map.put((K) "C", (V) "c");
try {
map.put((K) "D", null);
fail("Null value should raise IllegalArgument");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
assertEquals("First key should be A", "A", map.firstKey());
@@ -167,7 +167,7 @@ public class PredicatedSortedMapTest<K,
assertEquals("Last key in submap should be B",
"B", map.subMap((K) "A",(K) "C").lastKey());
- Comparator<? super K> c = map.comparator();
+ final Comparator<? super K> c = map.comparator();
assertTrue("natural order, so comparator should be null",
c == null);
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/ReferenceIdentityMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/ReferenceIdentityMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/ReferenceIdentityMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/ReferenceIdentityMapTest.java Mon Jan 7 17:15:14 2013
@@ -42,7 +42,7 @@ public class ReferenceIdentityMapTest<K,
private static final Integer I2A = new Integer(2);
private static final Integer I2B = new Integer(2);
- public ReferenceIdentityMapTest(String testName) {
+ public ReferenceIdentityMapTest(final String testName) {
super(testName);
}
@@ -81,7 +81,7 @@ public class ReferenceIdentityMapTest<K,
//-----------------------------------------------------------------------
@SuppressWarnings("unchecked")
public void testBasics() {
- IterableMap<K, V> map = new ReferenceIdentityMap<K, V>(ReferenceStrength.HARD, ReferenceStrength.HARD);
+ final IterableMap<K, V> map = new ReferenceIdentityMap<K, V>(ReferenceStrength.HARD, ReferenceStrength.HARD);
assertEquals(0, map.size());
map.put((K) I1A, (V) I2A);
@@ -115,15 +115,15 @@ public class ReferenceIdentityMapTest<K,
//-----------------------------------------------------------------------
@SuppressWarnings("unchecked")
public void testHashEntry() {
- IterableMap<K, V> map = new ReferenceIdentityMap<K, V>(ReferenceStrength.HARD, ReferenceStrength.HARD);
+ final IterableMap<K, V> map = new ReferenceIdentityMap<K, V>(ReferenceStrength.HARD, ReferenceStrength.HARD);
map.put((K) I1A, (V) I2A);
map.put((K) I1B, (V) I2A);
- Map.Entry<K, V> entry1 = map.entrySet().iterator().next();
- Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
- Map.Entry<K, V> entry2 = it.next();
- Map.Entry<K, V> entry3 = it.next();
+ final Map.Entry<K, V> entry1 = map.entrySet().iterator().next();
+ final Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
+ final Map.Entry<K, V> entry2 = it.next();
+ final Map.Entry<K, V> entry3 = it.next();
assertEquals(true, entry1.equals(entry2));
assertEquals(true, entry2.equals(entry1));
@@ -144,15 +144,15 @@ public class ReferenceIdentityMapTest<K,
try {
getMap().put(null, null);
fail();
- } catch (NullPointerException ex) {}
+ } catch (final NullPointerException ex) {}
try {
getMap().put((K) new Object(), null);
fail();
- } catch (NullPointerException ex) {}
+ } catch (final NullPointerException ex) {}
try {
getMap().put(null, (V) new Object());
fail();
- } catch (NullPointerException ex) {}
+ } catch (final NullPointerException ex) {}
}
//-----------------------------------------------------------------------
@@ -271,13 +271,13 @@ public class ReferenceIdentityMapTest<K,
@SuppressWarnings("unchecked")
private Map<K, V> buildRefMap() {
- K key = (K) new Object();
- V value = (V) new Object();
+ final K key = (K) new Object();
+ final V value = (V) new Object();
keyReference = new WeakReference<K>(key);
valueReference = new WeakReference<V>(value);
- Map<K, V> testMap = new ReferenceIdentityMap<K, V>(ReferenceStrength.WEAK, ReferenceStrength.HARD, true);
+ final Map<K, V> testMap = new ReferenceIdentityMap<K, V>(ReferenceStrength.WEAK, ReferenceStrength.HARD, true);
testMap.put(key, value);
assertEquals("In map", value, testMap.get(key));
@@ -289,7 +289,7 @@ public class ReferenceIdentityMapTest<K,
/** Tests whether purge values setting works */
public void testPurgeValues() throws Exception {
// many thanks to Juozas Baliuka for suggesting this method
- Map<K, V> testMap = buildRefMap();
+ final Map<K, V> testMap = buildRefMap();
int iterations = 0;
int bytz = 2;
@@ -307,6 +307,7 @@ public class ReferenceIdentityMapTest<K,
} else {
// create garbage:
@SuppressWarnings("unused")
+ final
byte[] b = new byte[bytz];
bytz = bytz * 2;
}
@@ -317,9 +318,9 @@ public class ReferenceIdentityMapTest<K,
private static void gc() {
try {
// trigger GC
- byte[][] tooLarge = new byte[1000000000][1000000000];
+ final byte[][] tooLarge = new byte[1000000000][1000000000];
fail("you have too much RAM");
- } catch (OutOfMemoryError ex) {
+ } catch (final OutOfMemoryError ex) {
System.gc(); // ignore
}
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/ReferenceMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/ReferenceMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/ReferenceMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/ReferenceMapTest.java Mon Jan 7 17:15:14 2013
@@ -34,7 +34,7 @@ import org.apache.commons.collections.ma
*/
public class ReferenceMapTest<K, V> extends AbstractIterableMapTest<K, V> {
- public ReferenceMapTest(String testName) {
+ public ReferenceMapTest(final String testName) {
super(testName);
}
@@ -76,15 +76,15 @@ public class ReferenceMapTest<K, V> exte
try {
map.put(null, null);
fail();
- } catch (NullPointerException ex) {}
+ } catch (final NullPointerException ex) {}
try {
map.put((K) new Object(), null);
fail();
- } catch (NullPointerException ex) {}
+ } catch (final NullPointerException ex) {}
try {
map.put(null, (V) new Object());
fail();
- } catch (NullPointerException ex) {}
+ } catch (final NullPointerException ex) {}
}
//-----------------------------------------------------------------------
@@ -203,13 +203,13 @@ public class ReferenceMapTest<K, V> exte
@SuppressWarnings("unchecked")
public Map<K, V> buildRefMap() {
- K key = (K) new Object();
- V value = (V) new Object();
+ final K key = (K) new Object();
+ final V value = (V) new Object();
keyReference = new WeakReference<K>(key);
valueReference = new WeakReference<V>(value);
- Map<K, V> testMap = new ReferenceMap<K, V>(ReferenceStrength.WEAK, ReferenceStrength.HARD, true);
+ final Map<K, V> testMap = new ReferenceMap<K, V>(ReferenceStrength.WEAK, ReferenceStrength.HARD, true);
testMap.put(key, value);
assertEquals("In map", value, testMap.get(key));
@@ -221,7 +221,7 @@ public class ReferenceMapTest<K, V> exte
/** Tests whether purge values setting works */
public void testPurgeValues() throws Exception {
// many thanks to Juozas Baliuka for suggesting this method
- Map<K, V> testMap = buildRefMap();
+ final Map<K, V> testMap = buildRefMap();
int iterations = 0;
int bytz = 2;
@@ -237,6 +237,7 @@ public class ReferenceMapTest<K, V> exte
} else {
// create garbage:
@SuppressWarnings("unused")
+ final
byte[] b = new byte[bytz];
bytz = bytz * 2;
}
@@ -247,9 +248,9 @@ public class ReferenceMapTest<K, V> exte
private static void gc() {
try {
// trigger GC
- byte[][] tooLarge = new byte[1000000000][1000000000];
+ final byte[][] tooLarge = new byte[1000000000][1000000000];
fail("you have too much RAM");
- } catch (OutOfMemoryError ex) {
+ } catch (final OutOfMemoryError ex) {
System.gc(); // ignore
}
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/SingletonMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/SingletonMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/SingletonMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/SingletonMapTest.java Mon Jan 7 17:15:14 2013
@@ -37,7 +37,7 @@ public class SingletonMapTest<K, V> exte
private static final Integer TWO = new Integer(2);
private static final String TEN = "10";
- public SingletonMapTest(String testName) {
+ public SingletonMapTest(final String testName) {
super(testName);
}
@@ -99,16 +99,16 @@ public class SingletonMapTest<K, V> exte
//-----------------------------------------------------------------------
public void testClone() {
- SingletonMap<K, V> map = makeFullMap();
+ final SingletonMap<K, V> map = makeFullMap();
assertEquals(1, map.size());
- SingletonMap<K, V> cloned = map.clone();
+ final SingletonMap<K, V> cloned = map.clone();
assertEquals(1, cloned.size());
assertEquals(true, cloned.containsKey(ONE));
assertEquals(true, cloned.containsValue(TWO));
}
public void testKeyValue() {
- SingletonMap<K, V> map = makeFullMap();
+ final SingletonMap<K, V> map = makeFullMap();
assertEquals(1, map.size());
assertEquals(ONE, map.getKey());
assertEquals(TWO, map.getValue());
@@ -116,7 +116,7 @@ public class SingletonMapTest<K, V> exte
}
public void testBoundedMap() {
- SingletonMap<K, V> map = makeFullMap();
+ final SingletonMap<K, V> map = makeFullMap();
assertEquals(1, map.size());
assertEquals(true, map.isFull());
assertEquals(1, map.maxSize());
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/StaticBucketMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/StaticBucketMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/StaticBucketMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/StaticBucketMapTest.java Mon Jan 7 17:15:14 2013
@@ -30,7 +30,7 @@ import org.apache.commons.collections.Bu
*/
public class StaticBucketMapTest<K, V> extends AbstractIterableMapTest<K, V> {
- public StaticBucketMapTest(String name) {
+ public StaticBucketMapTest(final String name) {
super(name);
}
@@ -53,8 +53,8 @@ public class StaticBucketMapTest<K, V> e
@Override
public String[] ignoredTests() {
- String pre = "StaticBucketMapTest.bulkTestMap";
- String post = ".testCollectionIteratorFailFast";
+ final String pre = "StaticBucketMapTest.bulkTestMap";
+ final String post = ".testCollectionIteratorFailFast";
return new String[] {
pre + "EntrySet" + post,
pre + "KeySet" + post,
@@ -65,36 +65,36 @@ public class StaticBucketMapTest<K, V> e
// Bugzilla 37567
@SuppressWarnings("unchecked")
public void test_get_nullMatchesIncorrectly() {
- StaticBucketMap<K, V> map = new StaticBucketMap<K, V>(17);
+ final StaticBucketMap<K, V> map = new StaticBucketMap<K, V>(17);
map.put(null, (V) "A");
assertEquals("A", map.get(null));
// loop so we find a string that is in the same bucket as the null
for (int i = 'A'; i <= 'Z'; i++) {
- String str = String.valueOf((char) i);
+ final String str = String.valueOf((char) i);
assertEquals("String: " + str, null, map.get(str));
}
}
@SuppressWarnings("unchecked")
public void test_containsKey_nullMatchesIncorrectly() {
- StaticBucketMap<K, V> map = new StaticBucketMap<K, V>(17);
+ final StaticBucketMap<K, V> map = new StaticBucketMap<K, V>(17);
map.put(null, (V) "A");
assertEquals(true, map.containsKey(null));
// loop so we find a string that is in the same bucket as the null
for (int i = 'A'; i <= 'Z'; i++) {
- String str = String.valueOf((char) i);
+ final String str = String.valueOf((char) i);
assertEquals("String: " + str, false, map.containsKey(str));
}
}
@SuppressWarnings("unchecked")
public void test_containsValue_nullMatchesIncorrectly() {
- StaticBucketMap<K, V> map = new StaticBucketMap<K, V>(17);
+ final StaticBucketMap<K, V> map = new StaticBucketMap<K, V>(17);
map.put((K) "A", null);
assertEquals(true, map.containsValue(null));
// loop so we find a string that is in the same bucket as the null
for (int i = 'A'; i <= 'Z'; i++) {
- String str = String.valueOf((char) i);
+ final String str = String.valueOf((char) i);
assertEquals("String: " + str, false, map.containsValue(str));
}
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/TransformedMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/TransformedMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/TransformedMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/TransformedMapTest.java Mon Jan 7 17:15:14 2013
@@ -36,7 +36,7 @@ import org.apache.commons.collections.co
*/
public class TransformedMapTest<K, V> extends AbstractIterableMapTest<K, V> {
- public TransformedMapTest(String testName) {
+ public TransformedMapTest(final String testName) {
super(testName);
}
@@ -50,7 +50,7 @@ public class TransformedMapTest<K, V> ex
//-----------------------------------------------------------------------
@SuppressWarnings("unchecked")
public void testTransformedMap() {
- Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" };
+ final Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" };
Map<K, V> map = TransformedMap
.transformingMap(
@@ -83,13 +83,13 @@ public class TransformedMapTest<K, V> ex
assertEquals(new Integer((String) els[0]), map.remove(els[0]));
- Set<Map.Entry<K, V>> entrySet = map.entrySet();
- Map.Entry<K, V>[] array = entrySet.toArray(new Map.Entry[0]);
+ final Set<Map.Entry<K, V>> entrySet = map.entrySet();
+ final Map.Entry<K, V>[] array = entrySet.toArray(new Map.Entry[0]);
array[0].setValue((V) "66");
assertEquals(new Integer(66), array[0].getValue());
assertEquals(new Integer(66), map.get(array[0].getKey()));
- Map.Entry entry = entrySet.iterator().next();
+ final Map.Entry entry = entrySet.iterator().next();
entry.setValue("88");
assertEquals(new Integer(88), entry.getValue());
assertEquals(new Integer(88), map.get(entry.getKey()));
@@ -98,12 +98,12 @@ public class TransformedMapTest<K, V> ex
//-----------------------------------------------------------------------
@SuppressWarnings("unchecked")
public void testFactory_Decorate() {
- Map<K, V> base = new HashMap<K, V>();
+ final Map<K, V> base = new HashMap<K, V>();
base.put((K) "A", (V) "1");
base.put((K) "B", (V) "2");
base.put((K) "C", (V) "3");
- Map<K, V> trans = TransformedMap
+ final Map<K, V> trans = TransformedMap
.transformingMap(
base,
null,
@@ -118,12 +118,12 @@ public class TransformedMapTest<K, V> ex
@SuppressWarnings("unchecked")
public void testFactory_decorateTransform() {
- Map<K, V> base = new HashMap<K, V>();
+ final Map<K, V> base = new HashMap<K, V>();
base.put((K) "A", (V) "1");
base.put((K) "B", (V) "2");
base.put((K) "C", (V) "3");
- Map<K, V> trans = TransformedMap
+ final Map<K, V> trans = TransformedMap
.transformedMap(
base,
null,
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/TransformedSortedMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/TransformedSortedMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/TransformedSortedMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/TransformedSortedMapTest.java Mon Jan 7 17:15:14 2013
@@ -39,7 +39,7 @@ import org.apache.commons.collections.co
*/
public class TransformedSortedMapTest<K, V> extends AbstractSortedMapTest<K, V> {
- public TransformedSortedMapTest(String testName) {
+ public TransformedSortedMapTest(final String testName) {
super(testName);
}
@@ -65,7 +65,7 @@ public class TransformedSortedMapTest<K,
//-----------------------------------------------------------------------
@SuppressWarnings("unchecked")
public void testTransformedMap() {
- Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" };
+ final Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" };
SortedMap<K, V> map = TransformedSortedMap
.transformingSortedMap(
@@ -80,7 +80,7 @@ public class TransformedSortedMapTest<K,
try {
map.containsKey(els[i]);
fail();
- } catch (ClassCastException ex) {}
+ } catch (final ClassCastException ex) {}
assertEquals(true, map.containsValue(els[i]));
assertEquals(els[i], map.get(new Integer((String) els[i])));
}
@@ -88,7 +88,7 @@ public class TransformedSortedMapTest<K,
try {
map.remove(els[0]);
fail();
- } catch (ClassCastException ex) {}
+ } catch (final ClassCastException ex) {}
assertEquals(els[0], map.remove(new Integer((String) els[0])));
map = TransformedSortedMap
@@ -108,13 +108,13 @@ public class TransformedSortedMapTest<K,
assertEquals(new Integer((String) els[0]), map.remove(els[0]));
- Set<Map.Entry<K, V>> entrySet = map.entrySet();
- Map.Entry<K, V>[] array = entrySet.toArray(new Map.Entry[0]);
+ final Set<Map.Entry<K, V>> entrySet = map.entrySet();
+ final Map.Entry<K, V>[] array = entrySet.toArray(new Map.Entry[0]);
array[0].setValue((V) "66");
assertEquals(new Integer(66), array[0].getValue());
assertEquals(new Integer(66), map.get(array[0].getKey()));
- Map.Entry<K, V> entry = entrySet.iterator().next();
+ final Map.Entry<K, V> entry = entrySet.iterator().next();
entry.setValue((V) "88");
assertEquals(new Integer(88), entry.getValue());
assertEquals(new Integer(88), map.get(entry.getKey()));
@@ -123,12 +123,12 @@ public class TransformedSortedMapTest<K,
//-----------------------------------------------------------------------
@SuppressWarnings("unchecked")
public void testFactory_Decorate() {
- SortedMap<K, V> base = new TreeMap<K, V>();
+ final SortedMap<K, V> base = new TreeMap<K, V>();
base.put((K) "A", (V) "1");
base.put((K) "B", (V) "2");
base.put((K) "C", (V) "3");
- SortedMap<K, V> trans = TransformedSortedMap
+ final SortedMap<K, V> trans = TransformedSortedMap
.transformingSortedMap(
base,
null,
@@ -143,12 +143,12 @@ public class TransformedSortedMapTest<K,
@SuppressWarnings("unchecked")
public void testFactory_decorateTransform() {
- SortedMap<K, V> base = new TreeMap<K, V>();
+ final SortedMap<K, V> base = new TreeMap<K, V>();
base.put((K) "A", (V) "1");
base.put((K) "B", (V) "2");
base.put((K) "C", (V) "3");
- SortedMap<K, V> trans = TransformedSortedMap
+ final SortedMap<K, V> trans = TransformedSortedMap
.transformedSortedMap(
base,
null,
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/UnmodifiableMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/UnmodifiableMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/UnmodifiableMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/UnmodifiableMapTest.java Mon Jan 7 17:15:14 2013
@@ -33,7 +33,7 @@ import org.apache.commons.collections.Un
*/
public class UnmodifiableMapTest<K, V> extends AbstractIterableMapTest<K, V> {
- public UnmodifiableMapTest(String testName) {
+ public UnmodifiableMapTest(final String testName) {
super(testName);
}
@@ -61,7 +61,7 @@ public class UnmodifiableMapTest<K, V> e
@Override
public IterableMap<K, V> makeFullMap() {
- Map<K, V> m = new HashMap<K, V>();
+ final Map<K, V> m = new HashMap<K, V>();
addSampleMappings(m);
return (IterableMap<K, V>) UnmodifiableMap.unmodifiableMap(m);
}
@@ -73,13 +73,13 @@ public class UnmodifiableMapTest<K, V> e
}
public void testDecorateFactory() {
- Map<K, V> map = makeFullMap();
+ final Map<K, V> map = makeFullMap();
assertSame(map, UnmodifiableMap.unmodifiableMap(map));
try {
UnmodifiableMap.unmodifiableMap(null);
fail();
- } catch (IllegalArgumentException ex) {}
+ } catch (final IllegalArgumentException ex) {}
}
@Override
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/UnmodifiableOrderedMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/UnmodifiableOrderedMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/UnmodifiableOrderedMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/UnmodifiableOrderedMapTest.java Mon Jan 7 17:15:14 2013
@@ -32,7 +32,7 @@ import org.apache.commons.collections.Un
*/
public class UnmodifiableOrderedMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
- public UnmodifiableOrderedMapTest(String testName) {
+ public UnmodifiableOrderedMapTest(final String testName) {
super(testName);
}
@@ -60,7 +60,7 @@ public class UnmodifiableOrderedMapTest<
@Override
public OrderedMap<K, V> makeFullMap() {
- OrderedMap<K, V> m = ListOrderedMap.listOrderedMap(new HashMap<K, V>());
+ final OrderedMap<K, V> m = ListOrderedMap.listOrderedMap(new HashMap<K, V>());
addSampleMappings(m);
return UnmodifiableOrderedMap.unmodifiableOrderedMap(m);
}
@@ -72,13 +72,13 @@ public class UnmodifiableOrderedMapTest<
}
public void testDecorateFactory() {
- OrderedMap<K, V> map = makeFullMap();
+ final OrderedMap<K, V> map = makeFullMap();
assertSame(map, UnmodifiableOrderedMap.unmodifiableOrderedMap(map));
try {
UnmodifiableOrderedMap.unmodifiableOrderedMap(null);
fail();
- } catch (IllegalArgumentException ex) {}
+ } catch (final IllegalArgumentException ex) {}
}
@Override
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/UnmodifiableSortedMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/UnmodifiableSortedMapTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/UnmodifiableSortedMapTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/UnmodifiableSortedMapTest.java Mon Jan 7 17:15:14 2013
@@ -32,7 +32,7 @@ import org.apache.commons.collections.Un
*/
public class UnmodifiableSortedMapTest<K, V> extends AbstractSortedMapTest<K, V> {
- public UnmodifiableSortedMapTest(String testName) {
+ public UnmodifiableSortedMapTest(final String testName) {
super(testName);
}
@@ -60,7 +60,7 @@ public class UnmodifiableSortedMapTest<K
@Override
public SortedMap<K, V> makeFullMap() {
- SortedMap<K, V> m = new TreeMap<K, V>();
+ final SortedMap<K, V> m = new TreeMap<K, V>();
addSampleMappings(m);
return UnmodifiableSortedMap.unmodifiableSortedMap(m);
}
@@ -72,13 +72,13 @@ public class UnmodifiableSortedMapTest<K
}
public void testDecorateFactory() {
- SortedMap<K, V> map = makeFullMap();
+ final SortedMap<K, V> map = makeFullMap();
assertSame(map, UnmodifiableSortedMap.unmodifiableSortedMap(map));
try {
UnmodifiableSortedMap.unmodifiableSortedMap(null);
fail();
- } catch (IllegalArgumentException ex) {}
+ } catch (final IllegalArgumentException ex) {}
}
@Override
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/AbstractSetTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/AbstractSetTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/AbstractSetTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/AbstractSetTest.java Mon Jan 7 17:15:14 2013
@@ -48,7 +48,7 @@ public abstract class AbstractSetTest<E>
*
* @param name name for test
*/
- public AbstractSetTest(String name) {
+ public AbstractSetTest(final String name) {
super(name);
}
@@ -63,8 +63,8 @@ public abstract class AbstractSetTest<E>
assertEquals("Sets should be equal", getConfirmed(), getCollection());
assertEquals("Sets should have equal hashCodes",
getConfirmed().hashCode(), getCollection().hashCode());
- Collection<E> set = makeConfirmedCollection();
- Iterator<E> iterator = getCollection().iterator();
+ final Collection<E> set = makeConfirmedCollection();
+ final Iterator<E> iterator = getCollection().iterator();
while (iterator.hasNext()) {
assertTrue("Set.iterator should only return unique elements", set.add(iterator.next()));
}
@@ -96,7 +96,7 @@ public abstract class AbstractSetTest<E>
*/
@Override
public Collection<E> makeConfirmedFullCollection() {
- Collection<E> set = makeConfirmedCollection();
+ final Collection<E> set = makeConfirmedCollection();
set.addAll(Arrays.asList(getFullElements()));
return set;
}
@@ -119,7 +119,7 @@ public abstract class AbstractSetTest<E>
*/
@Override
public Set<E> makeFullCollection() {
- Set<E> set = makeObject();
+ final Set<E> set = makeObject();
set.addAll(Arrays.asList(getFullElements()));
return set;
}
@@ -151,7 +151,7 @@ public abstract class AbstractSetTest<E>
assertEquals("Empty sets should be equal", getCollection(), getConfirmed());
verify();
- Collection<E> set2 = makeConfirmedCollection();
+ final Collection<E> set2 = makeConfirmedCollection();
set2.add((E) "foo");
assertTrue("Empty set shouldn't equal nonempty set", !getCollection().equals(set2));
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/AbstractSortedSetTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/AbstractSortedSetTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/AbstractSortedSetTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/AbstractSortedSetTest.java Mon Jan 7 17:15:14 2013
@@ -40,7 +40,7 @@ public abstract class AbstractSortedSetT
*
* @param name name for test
*/
- public AbstractSortedSetTest(String name) {
+ public AbstractSortedSetTest(final String name) {
super(name);
}
@@ -55,8 +55,8 @@ public abstract class AbstractSortedSetT
// Check that iterator returns elements in order and first() and last()
// are consistent
- Iterator<E> colliter = getCollection().iterator();
- Iterator<E> confiter = getConfirmed().iterator();
+ final Iterator<E> colliter = getCollection().iterator();
+ final Iterator<E> confiter = getConfirmed().iterator();
E first = null;
E last = null;
while (colliter.hasNext()) {
@@ -120,7 +120,7 @@ public abstract class AbstractSortedSetT
@Override
@SuppressWarnings("unchecked")
public E[] getFullNonNullElements() {
- Object[] elements = new Object[30];
+ final Object[] elements = new Object[30];
for (int i = 0; i < 30; i++) {
elements[i] = new Integer(i + i + 1);
@@ -134,7 +134,7 @@ public abstract class AbstractSortedSetT
@Override
@SuppressWarnings("unchecked")
public E[] getOtherNonNullElements() {
- Object[] elements = new Object[30];
+ final Object[] elements = new Object[30];
for (int i = 0; i < 30; i++) {
elements[i] = new Integer(i + i + 2);
}
@@ -151,10 +151,10 @@ public abstract class AbstractSortedSetT
* @return a {@link AbstractSetTest} instance for testing a subset.
*/
public BulkTest bulkTestSortedSetSubSet() {
- int length = getFullElements().length;
+ final int length = getFullElements().length;
- int lobound = length / 3;
- int hibound = lobound * 2;
+ final int lobound = length / 3;
+ final int hibound = lobound * 2;
return new TestSortedSetSubSet(lobound, hibound);
}
@@ -168,10 +168,10 @@ public abstract class AbstractSortedSetT
* @return a {@link AbstractSetTest} instance for testing a headset.
*/
public BulkTest bulkTestSortedSetHeadSet() {
- int length = getFullElements().length;
+ final int length = getFullElements().length;
- int lobound = length / 3;
- int hibound = lobound * 2;
+ final int lobound = length / 3;
+ final int hibound = lobound * 2;
return new TestSortedSetSubSet(hibound, true);
}
@@ -185,8 +185,8 @@ public abstract class AbstractSortedSetT
* @return a {@link AbstractSetTest} instance for testing a tailset.
*/
public BulkTest bulkTestSortedSetTailSet() {
- int length = getFullElements().length;
- int lobound = length / 3;
+ final int length = getFullElements().length;
+ final int lobound = length / 3;
return new TestSortedSetSubSet(lobound, false);
}
@@ -199,7 +199,7 @@ public abstract class AbstractSortedSetT
private E[] m_OtherElements;
@SuppressWarnings("unchecked")
- public TestSortedSetSubSet(int bound, boolean head) {
+ public TestSortedSetSubSet(final int bound, final boolean head) {
super("TestSortedSetSubSet");
if (head) {
//System.out.println("HEADSET");
@@ -216,7 +216,7 @@ public abstract class AbstractSortedSetT
//System.out.println("TAILSET");
m_Type = TYPE_TAILSET;
m_LowBound = bound;
- Object[] allelements = AbstractSortedSetTest.this.getFullElements();
+ final Object[] allelements = AbstractSortedSetTest.this.getFullElements();
//System.out.println("bound = "+bound +"::length="+allelements.length);
m_FullElements = (E[]) new Object[allelements.length - bound];
System.arraycopy(allelements, bound, m_FullElements, 0, allelements.length - bound);
@@ -234,13 +234,13 @@ public abstract class AbstractSortedSetT
} //type
@SuppressWarnings("unchecked")
- public TestSortedSetSubSet(int lobound, int hibound) {
+ public TestSortedSetSubSet(final int lobound, final int hibound) {
super("TestSortedSetSubSet");
//System.out.println("SUBSET");
m_Type = TYPE_SUBSET;
m_LowBound = lobound;
m_HighBound = hibound;
- int length = hibound - lobound;
+ final int length = hibound - lobound;
//System.out.println("Low=" + lobound + "::High=" + hibound + "::Length=" + length);
m_FullElements = (E[]) new Object[length];
System.arraycopy(AbstractSortedSetTest.this.getFullElements(), lobound, m_FullElements, 0, length);
@@ -279,8 +279,8 @@ public abstract class AbstractSortedSetT
return m_OtherElements;
}
- private SortedSet<E> getSubSet(SortedSet<E> set) {
- E[] elements = AbstractSortedSetTest.this.getFullElements();
+ private SortedSet<E> getSubSet(final SortedSet<E> set) {
+ final E[] elements = AbstractSortedSetTest.this.getFullElements();
switch (m_Type) {
case TYPE_SUBSET :
return set.subSet(elements[m_LowBound], elements[m_HighBound]);
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/CompositeSetTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/CompositeSetTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/CompositeSetTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/CompositeSetTest.java Mon Jan 7 17:15:14 2013
@@ -31,21 +31,21 @@ import org.apache.commons.collections.co
* @version $Id$
*/
public class CompositeSetTest<E> extends AbstractSetTest<E> {
- public CompositeSetTest(String name) {
+ public CompositeSetTest(final String name) {
super(name);
}
@Override
public CompositeSet<E> makeObject() {
final HashSet<E> contained = new HashSet<E>();
- CompositeSet<E> set = new CompositeSet<E>(contained);
+ final CompositeSet<E> set = new CompositeSet<E>(contained);
set.setMutator( new EmptySetMutator<E>(contained) );
return set;
}
@SuppressWarnings("unchecked")
public Set<E> buildOne() {
- HashSet<E> set = new HashSet<E>();
+ final HashSet<E> set = new HashSet<E>();
set.add((E) "1");
set.add((E) "2");
return set;
@@ -53,7 +53,7 @@ public class CompositeSetTest<E> extends
@SuppressWarnings("unchecked")
public Set<E> buildTwo() {
- HashSet<E> set = new HashSet<E>();
+ final HashSet<E> set = new HashSet<E>();
set.add((E) "3");
set.add((E) "4");
return set;
@@ -61,15 +61,15 @@ public class CompositeSetTest<E> extends
@SuppressWarnings("unchecked")
public void testContains() {
- CompositeSet<E> set = new CompositeSet<E>(new Set[]{ buildOne(), buildTwo() });
+ final CompositeSet<E> set = new CompositeSet<E>(new Set[]{ buildOne(), buildTwo() });
assertTrue(set.contains("1"));
}
@SuppressWarnings("unchecked")
public void testRemoveUnderlying() {
- Set<E> one = buildOne();
- Set<E> two = buildTwo();
- CompositeSet<E> set = new CompositeSet<E>(new Set[] { one, two });
+ final Set<E> one = buildOne();
+ final Set<E> two = buildTwo();
+ final CompositeSet<E> set = new CompositeSet<E>(new Set[] { one, two });
one.remove("1");
assertFalse(set.contains("1"));
@@ -79,9 +79,9 @@ public class CompositeSetTest<E> extends
@SuppressWarnings("unchecked")
public void testRemoveComposited() {
- Set<E> one = buildOne();
- Set<E> two = buildTwo();
- CompositeSet<E> set = new CompositeSet<E>(new Set[] { one, two });
+ final Set<E> one = buildOne();
+ final Set<E> two = buildTwo();
+ final CompositeSet<E> set = new CompositeSet<E>(new Set[] { one, two });
set.remove("1");
assertFalse(one.contains("1"));
@@ -91,66 +91,66 @@ public class CompositeSetTest<E> extends
@SuppressWarnings("unchecked")
public void testFailedCollisionResolution() {
- Set<E> one = buildOne();
- Set<E> two = buildTwo();
- CompositeSet<E> set = new CompositeSet<E>(new Set[] { one, two });
+ final Set<E> one = buildOne();
+ final Set<E> two = buildTwo();
+ final CompositeSet<E> set = new CompositeSet<E>(new Set[] { one, two });
set.setMutator(new CompositeSet.SetMutator<E>() {
private static final long serialVersionUID = 1L;
- public void resolveCollision(CompositeSet<E> comp, Set<E> existing,
- Set<E> added, Collection<E> intersects) {
+ public void resolveCollision(final CompositeSet<E> comp, final Set<E> existing,
+ final Set<E> added, final Collection<E> intersects) {
//noop
}
- public boolean add(CompositeCollection<E> composite,
- List<Collection<E>> collections, E obj) {
+ public boolean add(final CompositeCollection<E> composite,
+ final List<Collection<E>> collections, final E obj) {
throw new UnsupportedOperationException();
}
- public boolean addAll(CompositeCollection<E> composite,
- List<Collection<E>> collections, Collection<? extends E> coll) {
+ public boolean addAll(final CompositeCollection<E> composite,
+ final List<Collection<E>> collections, final Collection<? extends E> coll) {
throw new UnsupportedOperationException();
}
- public boolean remove(CompositeCollection<E> composite,
- List<Collection<E>> collections, Object obj) {
+ public boolean remove(final CompositeCollection<E> composite,
+ final List<Collection<E>> collections, final Object obj) {
throw new UnsupportedOperationException();
}
});
- HashSet<E> three = new HashSet<E>();
+ final HashSet<E> three = new HashSet<E>();
three.add((E) "1");
try {
set.addComposited(three);
fail("IllegalArgumentException should have been thrown");
}
- catch (IllegalArgumentException e) {
+ catch (final IllegalArgumentException e) {
// expected
}
}
@SuppressWarnings("unchecked")
public void testAddComposited() {
- Set<E> one = buildOne();
- Set<E> two = buildTwo();
- CompositeSet<E> set = new CompositeSet<E>();
+ final Set<E> one = buildOne();
+ final Set<E> two = buildTwo();
+ final CompositeSet<E> set = new CompositeSet<E>();
set.addComposited(one, two);
- CompositeSet<E> set2 = new CompositeSet<E>(buildOne());
+ final CompositeSet<E> set2 = new CompositeSet<E>(buildOne());
set2.addComposited(buildTwo());
assertTrue(set.equals(set2));
- HashSet<E> set3 = new HashSet<E>();
+ final HashSet<E> set3 = new HashSet<E>();
set3.add((E) "1");
set3.add((E) "2");
set3.add((E) "3");
- HashSet<E> set4 = new HashSet<E>();
+ final HashSet<E> set4 = new HashSet<E>();
set4.add((E) "4");
- CompositeSet<E> set5 = new CompositeSet<E>(set3);
+ final CompositeSet<E> set5 = new CompositeSet<E>(set3);
set5.addComposited(set4);
assertTrue(set.equals(set5));
try {
set.addComposited(set3);
fail("Expecting UnsupportedOperationException.");
- } catch (UnsupportedOperationException ex) {
+ } catch (final UnsupportedOperationException ex) {
// expected
}
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/EmptySetMutator.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/EmptySetMutator.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/EmptySetMutator.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/EmptySetMutator.java Mon Jan 7 17:15:14 2013
@@ -32,25 +32,25 @@ class EmptySetMutator<E> implements Comp
/** Serialization version */
private static final long serialVersionUID = 5321193666420238910L;
- private Set<E> contained;
+ private final Set<E> contained;
- public EmptySetMutator(Set<E> set) {
+ public EmptySetMutator(final Set<E> set) {
this.contained = set;
}
- public void resolveCollision(CompositeSet<E> comp, Set<E> existing, Set<E> added, Collection<E> intersects) {
+ public void resolveCollision(final CompositeSet<E> comp, final Set<E> existing, final Set<E> added, final Collection<E> intersects) {
throw new IllegalArgumentException();
}
- public boolean add(CompositeCollection<E> composite, List<Collection<E>> collections, E obj) {
+ public boolean add(final CompositeCollection<E> composite, final List<Collection<E>> collections, final E obj) {
return contained.add(obj);
}
- public boolean addAll(CompositeCollection<E> composite, List<Collection<E>> collections, Collection<? extends E> coll) {
+ public boolean addAll(final CompositeCollection<E> composite, final List<Collection<E>> collections, final Collection<? extends E> coll) {
return contained.addAll(coll);
}
- public boolean remove(CompositeCollection<E> composite, List<Collection<E>> collections, Object obj) {
+ public boolean remove(final CompositeCollection<E> composite, final List<Collection<E>> collections, final Object obj) {
return contained.remove(obj);
}
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/ListOrderedSet2Test.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/ListOrderedSet2Test.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/ListOrderedSet2Test.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/ListOrderedSet2Test.java Mon Jan 7 17:15:14 2013
@@ -34,7 +34,7 @@ public class ListOrderedSet2Test<E> exte
private static final Integer TWO = new Integer(2);
private static final Integer THREE = new Integer(3);
- public ListOrderedSet2Test(String testName) {
+ public ListOrderedSet2Test(final String testName) {
super(testName);
}
@@ -45,7 +45,7 @@ public class ListOrderedSet2Test<E> exte
@SuppressWarnings("unchecked")
protected ListOrderedSet<E> setupSet() {
- ListOrderedSet<E> set = makeObject();
+ final ListOrderedSet<E> set = makeObject();
for (int i = 0; i < 10; i++) {
set.add((E) Integer.toString(i));
@@ -55,7 +55,7 @@ public class ListOrderedSet2Test<E> exte
@SuppressWarnings("unchecked")
public void testOrdering() {
- ListOrderedSet<E> set = setupSet();
+ final ListOrderedSet<E> set = setupSet();
Iterator<E> it = set.iterator();
for (int i = 0; i < 10; i++) {
@@ -88,8 +88,8 @@ public class ListOrderedSet2Test<E> exte
@SuppressWarnings("unchecked")
public void testListAddRemove() {
- ListOrderedSet<E> set = makeObject();
- List<E> view = set.asList();
+ final ListOrderedSet<E> set = makeObject();
+ final List<E> view = set.asList();
set.add((E) ZERO);
set.add((E) ONE);
set.add((E) TWO);
@@ -118,7 +118,7 @@ public class ListOrderedSet2Test<E> exte
@SuppressWarnings("unchecked")
public void testListAddIndexed() {
- ListOrderedSet<E> set = makeObject();
+ final ListOrderedSet<E> set = makeObject();
set.add((E) ZERO);
set.add((E) TWO);
@@ -134,7 +134,7 @@ public class ListOrderedSet2Test<E> exte
assertSame(ONE, set.get(1));
assertSame(TWO, set.get(2));
- List<E> list = new ArrayList<E>();
+ final List<E> list = new ArrayList<E>();
list.add((E) ZERO);
list.add((E) TWO);
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/ListOrderedSetTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/ListOrderedSetTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/ListOrderedSetTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/ListOrderedSetTest.java Mon Jan 7 17:15:14 2013
@@ -41,7 +41,7 @@ public class ListOrderedSetTest<E>
private static final Integer THREE = new Integer(3);
- public ListOrderedSetTest(String testName) {
+ public ListOrderedSetTest(final String testName) {
super(testName);
}
@@ -52,7 +52,7 @@ public class ListOrderedSetTest<E>
@SuppressWarnings("unchecked")
protected ListOrderedSet<E> setupSet() {
- ListOrderedSet<E> set = makeObject();
+ final ListOrderedSet<E> set = makeObject();
for (int i = 0; i < 10; i++) {
set.add((E) Integer.toString(i));
@@ -62,7 +62,7 @@ public class ListOrderedSetTest<E>
@SuppressWarnings("unchecked")
public void testOrdering() {
- ListOrderedSet<E> set = setupSet();
+ final ListOrderedSet<E> set = setupSet();
Iterator<E> it = set.iterator();
for (int i = 0; i < 10; i++) {
@@ -97,8 +97,8 @@ public class ListOrderedSetTest<E>
@SuppressWarnings("unchecked")
public void testListAddRemove() {
- ListOrderedSet<E> set = makeObject();
- List<E> view = set.asList();
+ final ListOrderedSet<E> set = makeObject();
+ final List<E> view = set.asList();
set.add((E) ZERO);
set.add((E) ONE);
set.add((E) TWO);
@@ -127,7 +127,7 @@ public class ListOrderedSetTest<E>
@SuppressWarnings("unchecked")
public void testListAddIndexed() {
- ListOrderedSet<E> set = makeObject();
+ final ListOrderedSet<E> set = makeObject();
set.add((E) ZERO);
set.add((E) TWO);
@@ -143,7 +143,7 @@ public class ListOrderedSetTest<E>
assertSame(ONE, set.get(1));
assertSame(TWO, set.get(2));
- List<E> list = new ArrayList<E>();
+ final List<E> list = new ArrayList<E>();
list.add((E) ZERO);
list.add((E) TWO);
@@ -165,9 +165,9 @@ public class ListOrderedSetTest<E>
@SuppressWarnings("unchecked")
public void testListAddReplacing() {
- ListOrderedSet<E> set = makeObject();
- A a = new A();
- B b = new B();
+ final ListOrderedSet<E> set = makeObject();
+ final A a = new A();
+ final B b = new B();
set.add((E) a);
assertEquals(1, set.size());
set.add((E) b); // will match but not replace A as equal
@@ -180,14 +180,14 @@ public class ListOrderedSetTest<E>
@SuppressWarnings("unchecked")
public void testRetainAll() {
- List<E> list = new ArrayList<E>(10);
- Set<E> set = new HashSet<E>(10);
- ListOrderedSet<E> orderedSet = ListOrderedSet.listOrderedSet(set, list);
+ final List<E> list = new ArrayList<E>(10);
+ final Set<E> set = new HashSet<E>(10);
+ final ListOrderedSet<E> orderedSet = ListOrderedSet.listOrderedSet(set, list);
for (int i = 0; i < 10; ++i) {
orderedSet.add((E) Integer.valueOf(10 - i - 1));
}
- Collection<E> retained = new ArrayList<E>(5);
+ final Collection<E> retained = new ArrayList<E>(5);
for (int i = 0; i < 5; ++i) {
retained.add((E) Integer.valueOf(i * 2));
}
@@ -206,19 +206,19 @@ public class ListOrderedSetTest<E>
* test case for https://issues.apache.org/jira/browse/COLLECTIONS-426
*/
public void testRetainAllCollections426() {
- int size = 100000;
- ListOrderedSet<Integer> set = new ListOrderedSet<Integer>();
+ final int size = 100000;
+ final ListOrderedSet<Integer> set = new ListOrderedSet<Integer>();
for (int i = 0; i < size; i++) {
set.add(i);
}
- ArrayList<Integer> list = new ArrayList<Integer>();
+ final ArrayList<Integer> list = new ArrayList<Integer>();
for (int i = size; i < 2 * size; i++) {
list.add(i);
}
- long start = System.currentTimeMillis();
+ final long start = System.currentTimeMillis();
set.retainAll(list);
- long stop = System.currentTimeMillis();
+ final long stop = System.currentTimeMillis();
// make sure retainAll completes under 5 seconds
// TODO if test is migrated to JUnit 4, add a Timeout rule.
@@ -229,7 +229,7 @@ public class ListOrderedSetTest<E>
static class A {
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
return obj instanceof A || obj instanceof B;
}
@@ -242,7 +242,7 @@ public class ListOrderedSetTest<E>
static class B {
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
return obj instanceof A || obj instanceof B;
}
@@ -256,27 +256,27 @@ public class ListOrderedSetTest<E>
try {
ListOrderedSet.listOrderedSet((List<E>) null);
fail();
- } catch (IllegalArgumentException ex) {
+ } catch (final IllegalArgumentException ex) {
}
try {
ListOrderedSet.listOrderedSet((Set<E>) null);
fail();
- } catch (IllegalArgumentException ex) {
+ } catch (final IllegalArgumentException ex) {
}
try {
ListOrderedSet.listOrderedSet(null, null);
fail();
- } catch (IllegalArgumentException ex) {
+ } catch (final IllegalArgumentException ex) {
}
try {
ListOrderedSet.listOrderedSet(new HashSet<E>(), null);
fail();
- } catch (IllegalArgumentException ex) {
+ } catch (final IllegalArgumentException ex) {
}
try {
ListOrderedSet.listOrderedSet(null, new ArrayList<E>());
fail();
- } catch (IllegalArgumentException ex) {
+ } catch (final IllegalArgumentException ex) {
}
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/MapBackedSet2Test.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/MapBackedSet2Test.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/MapBackedSet2Test.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/MapBackedSet2Test.java Mon Jan 7 17:15:14 2013
@@ -29,7 +29,7 @@ import org.apache.commons.collections.ma
*/
public class MapBackedSet2Test<E> extends AbstractSetTest<E> {
- public MapBackedSet2Test(String testName) {
+ public MapBackedSet2Test(final String testName) {
super(testName);
}
@@ -40,7 +40,7 @@ public class MapBackedSet2Test<E> extend
@SuppressWarnings("unchecked")
protected Set<E> setupSet() {
- Set<E> set = makeObject();
+ final Set<E> set = makeObject();
for (int i = 0; i < 10; i++) {
set.add((E) Integer.toString(i));
@@ -50,7 +50,7 @@ public class MapBackedSet2Test<E> extend
@SuppressWarnings("unchecked")
public void testOrdering() {
- Set<E> set = setupSet();
+ final Set<E> set = setupSet();
Iterator<E> it = set.iterator();
for (int i = 0; i < 10; i++) {
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/MapBackedSetTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/MapBackedSetTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/MapBackedSetTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/set/MapBackedSetTest.java Mon Jan 7 17:15:14 2013
@@ -28,7 +28,7 @@ import org.apache.commons.collections.ma
*/
public class MapBackedSetTest<E> extends AbstractSetTest<E> {
- public MapBackedSetTest(String testName) {
+ public MapBackedSetTest(final String testName) {
super(testName);
}