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 [19/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/collection/AbstractCollectionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/AbstractCollectionTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/AbstractCollectionTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/AbstractCollectionTest.java Mon Jan 7 17:15:14 2013
@@ -154,7 +154,7 @@ public abstract class AbstractCollection
*
* @param testName the test class name
*/
- public AbstractCollectionTest(String testName) {
+ public AbstractCollectionTest(final String testName) {
super(testName);
}
@@ -241,7 +241,7 @@ public abstract class AbstractCollection
* identical state.
*/
public void verify() {
- int confirmedSize = getConfirmed().size();
+ final int confirmedSize = getConfirmed().size();
assertEquals("Collection size should match confirmed collection's", confirmedSize,
getCollection().size());
assertEquals("Collection isEmpty() result should match confirmed collection's",
@@ -257,7 +257,7 @@ public abstract class AbstractCollection
// verification is a success.
// copy each collection value into an array
- Object[] confirmedValues = new Object[confirmedSize];
+ final Object[] confirmedValues = new Object[confirmedSize];
Iterator<E> iter;
@@ -269,13 +269,13 @@ public abstract class AbstractCollection
// allocate an array of boolean flags for tracking values that have
// been matched once and only once.
- boolean[] matched = new boolean[confirmedSize];
+ final boolean[] matched = new boolean[confirmedSize];
// now iterate through the values of the collection and try to match
// the value with one in the confirmed array.
iter = getCollection().iterator();
while (iter.hasNext()) {
- Object o = iter.next();
+ final Object o = iter.next();
boolean match = false;
for (int i = 0; i < confirmedSize; i++) {
if (matched[i]) {
@@ -363,7 +363,7 @@ public abstract class AbstractCollection
* if your collection doesn't support addAll.
*/
public Collection<E> makeFullCollection() {
- Collection<E> c = makeObject();
+ final Collection<E> c = makeObject();
c.addAll(Arrays.asList(getFullElements()));
return c;
}
@@ -371,8 +371,8 @@ public abstract class AbstractCollection
/**
* Creates a new Map Entry that is independent of the first and the map.
*/
- public Map.Entry<E, E> cloneMapEntry(Map.Entry<E, E> entry) {
- HashMap<E, E> map = new HashMap<E, E>();
+ public Map.Entry<E, E> cloneMapEntry(final Map.Entry<E, E> entry) {
+ final HashMap<E, E> map = new HashMap<E, E>();
map.put(entry.getKey(), entry.getValue());
return map.entrySet().iterator().next();
}
@@ -391,7 +391,7 @@ public abstract class AbstractCollection
@SuppressWarnings("unchecked")
public E[] getFullElements() {
if (isNullSupported()) {
- ArrayList<E> list = new ArrayList<E>();
+ final ArrayList<E> list = new ArrayList<E>();
list.addAll(Arrays.asList(getFullNonNullElements()));
list.add(4, null);
return (E[]) list.toArray();
@@ -501,10 +501,10 @@ public abstract class AbstractCollection
return;
}
- E[] elements = getFullElements();
- for (E element : elements) {
+ final E[] elements = getFullElements();
+ for (final E element : elements) {
resetEmpty();
- boolean r = getCollection().add(element);
+ final boolean r = getCollection().add(element);
getConfirmed().add(element);
verify();
assertTrue("Empty collection changed after add", r);
@@ -513,8 +513,8 @@ public abstract class AbstractCollection
resetEmpty();
int size = 0;
- for (E element : elements) {
- boolean r = getCollection().add(element);
+ for (final E element : elements) {
+ final boolean r = getCollection().add(element);
getConfirmed().add(element);
verify();
if (r) {
@@ -539,7 +539,7 @@ public abstract class AbstractCollection
getConfirmed().addAll(Arrays.asList(elements));
verify();
assertTrue("Empty collection should change after addAll", r);
- for (E element : elements) {
+ for (final E element : elements) {
assertTrue("Collection should contain added element", getCollection().contains(element));
}
@@ -550,7 +550,7 @@ public abstract class AbstractCollection
getConfirmed().addAll(Arrays.asList(elements));
verify();
assertTrue("Full collection should change after addAll", r);
- for (E element : elements) {
+ for (final E element : elements) {
assertTrue("Full collection should contain added element",
getCollection().contains(element));
}
@@ -581,7 +581,7 @@ public abstract class AbstractCollection
try {
getCollection().add(getFullNonNullElements()[0]);
fail("Empty collection should not support add.");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
// expected
}
// make sure things didn't change even if the expected exception was
@@ -591,7 +591,7 @@ public abstract class AbstractCollection
try {
getCollection().addAll(Arrays.asList(getFullElements()));
fail("Empty collection should not support addAll.");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
// expected
}
// make sure things didn't change even if the expected exception was
@@ -602,7 +602,7 @@ public abstract class AbstractCollection
try {
getCollection().add(getFullNonNullElements()[0]);
fail("Full collection should not support add.");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
// expected
}
// make sure things didn't change even if the expected exception was
@@ -612,7 +612,7 @@ public abstract class AbstractCollection
try {
getCollection().addAll(Arrays.asList(getOtherElements()));
fail("Full collection should not support addAll.");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
// expected
}
// make sure things didn't change even if the expected exception was
@@ -703,8 +703,8 @@ public abstract class AbstractCollection
// make sure calls to "containsAll" don't change anything
verify();
- int min = getFullElements().length < 2 ? 0 : 2;
- int max = getFullElements().length == 1 ? 1 :
+ final int min = getFullElements().length < 2 ? 0 : 2;
+ final int max = getFullElements().length == 1 ? 1 :
getFullElements().length <= 5 ? getFullElements().length - 1 : 5;
col = Arrays.asList(getFullElements()).subList(min, max);
assertTrue("Full collection should containAll partial full elements",
@@ -749,7 +749,7 @@ public abstract class AbstractCollection
it1.next();
fail("Iterator at end of Collection should throw "
+ "NoSuchElementException when next is called.");
- } catch (NoSuchElementException e) {
+ } catch (final NoSuchElementException e) {
// expected
}
// make sure nothing has changed after non-modification
@@ -763,10 +763,10 @@ public abstract class AbstractCollection
}
assertTrue("Iterator should be finished", !it1.hasNext());
- ArrayList<E> list = new ArrayList<E>();
+ final ArrayList<E> list = new ArrayList<E>();
it1 = getCollection().iterator();
for (int i = 0; i < getCollection().size(); i++) {
- E next = it1.next();
+ final E next = it1.next();
assertTrue("Collection should contain element returned by its iterator",
getCollection().contains(next));
list.add(next);
@@ -774,7 +774,7 @@ public abstract class AbstractCollection
try {
it1.next();
fail("iterator.next() should raise NoSuchElementException after it finishes");
- } catch (NoSuchElementException e) {
+ } catch (final NoSuchElementException e) {
// expected
}
// make sure nothing has changed after non-modification
@@ -794,17 +794,17 @@ public abstract class AbstractCollection
try {
getCollection().iterator().remove();
fail("New iterator.remove should raise IllegalState");
- } catch (IllegalStateException e) {
+ } catch (final IllegalStateException e) {
// expected
}
verify();
try {
- Iterator<E> iter = getCollection().iterator();
+ final Iterator<E> iter = getCollection().iterator();
iter.hasNext();
iter.remove();
fail("New iterator.remove should raise IllegalState even after hasNext");
- } catch (IllegalStateException e) {
+ } catch (final IllegalStateException e) {
// expected
}
verify();
@@ -847,7 +847,7 @@ public abstract class AbstractCollection
try {
iter.remove();
fail("Second iter.remove should raise IllegalState");
- } catch (IllegalStateException e) {
+ } catch (final IllegalStateException e) {
// expected
}
}
@@ -861,13 +861,13 @@ public abstract class AbstractCollection
}
resetEmpty();
- E[] elements = getFullElements();
+ final E[] elements = getFullElements();
for (int i = 0; i < elements.length; i++) {
assertTrue("Shouldn't remove nonexistent element", !getCollection().remove(elements[i]));
verify();
}
- E[] other = getOtherElements();
+ final E[] other = getOtherElements();
resetFull();
for (int i = 0; i < other.length; i++) {
@@ -875,8 +875,8 @@ public abstract class AbstractCollection
verify();
}
- int size = getCollection().size();
- for (E element : elements) {
+ final int size = getCollection().size();
+ for (final E element : elements) {
resetFull();
assertTrue("Collection should remove extant element: " + element,
getCollection().remove(element));
@@ -930,17 +930,17 @@ public abstract class AbstractCollection
verify();
resetFull();
- int size = getCollection().size();
- int min = getFullElements().length < 2 ? 0 : 2;
- int max = getFullElements().length == 1 ? 1 :
+ final int size = getCollection().size();
+ final int min = getFullElements().length < 2 ? 0 : 2;
+ final int max = getFullElements().length == 1 ? 1 :
getFullElements().length <= 5 ? getFullElements().length - 1 : 5;
- Collection<E> all = Arrays.asList(getFullElements()).subList(min, max);
+ final Collection<E> all = Arrays.asList(getFullElements()).subList(min, max);
assertTrue("Full collection removeAll should work", getCollection().removeAll(all));
getConfirmed().removeAll(all);
verify();
assertTrue("Collection should shrink after removeAll", getCollection().size() < size);
- Iterator<E> iter = all.iterator();
+ final Iterator<E> iter = all.iterator();
while (iter.hasNext()) {
assertTrue("Collection shouldn't contain removed element",
!getCollection().contains(iter.next()));
@@ -956,8 +956,8 @@ public abstract class AbstractCollection
}
resetEmpty();
- List<E> elements = Arrays.asList(getFullElements());
- List<E> other = Arrays.asList(getOtherElements());
+ final List<E> elements = Arrays.asList(getFullElements());
+ final List<E> other = Arrays.asList(getOtherElements());
assertTrue("Empty retainAll() should return false",
!getCollection().retainAll(Collections.EMPTY_SET));
@@ -987,14 +987,14 @@ public abstract class AbstractCollection
if (getFullElements().length > 1) {
resetFull();
size = getCollection().size();
- int min = getFullElements().length < 2 ? 0 : 2;
- int max = getFullElements().length <= 5 ? getFullElements().length - 1 : 5;
+ final int min = getFullElements().length < 2 ? 0 : 2;
+ final int max = getFullElements().length <= 5 ? getFullElements().length - 1 : 5;
assertTrue("Collection should changed by partial retainAll",
getCollection().retainAll(elements.subList(min, max)));
getConfirmed().retainAll(elements.subList(min, max));
verify();
- Iterator<E> iter = getCollection().iterator();
+ final Iterator<E> iter = getCollection().iterator();
while (iter.hasNext()) {
assertTrue("Collection only contains retained element",
elements.subList(min, max).contains(iter.next()));
@@ -1002,7 +1002,7 @@ public abstract class AbstractCollection
}
resetFull();
- HashSet<E> set = new HashSet<E>(elements);
+ final HashSet<E> set = new HashSet<E>(elements);
size = getCollection().size();
assertTrue("Collection shouldn't change from retainAll without " +
"duplicate elements", !getCollection().retainAll(set));
@@ -1031,13 +1031,13 @@ public abstract class AbstractCollection
0, getCollection().toArray().length);
resetFull();
- Object[] array = getCollection().toArray();
+ final Object[] array = getCollection().toArray();
assertEquals("Full collection toArray should be same size as collection",
array.length, getCollection().size());
- Object[] confirmedArray = getConfirmed().toArray();
+ final Object[] confirmedArray = getConfirmed().toArray();
assertEquals("length of array from confirmed collection should "
+ "match the length of the collection's array", confirmedArray.length, array.length);
- boolean[] matched = new boolean[array.length];
+ final boolean[] matched = new boolean[array.length];
for (int i = 0; i < array.length; i++) {
assertTrue("Collection should contain element in toArray",
@@ -1062,7 +1062,7 @@ public abstract class AbstractCollection
+ "in the confirmed collection's array");
}
}
- for (boolean element : matched) {
+ for (final boolean element : matched) {
assertEquals("Collection should return all its elements in " + "toArray", true,
element);
}
@@ -1083,7 +1083,7 @@ public abstract class AbstractCollection
try {
array = getCollection().toArray(new Void[0]);
fail("toArray(new Void[0]) should raise ArrayStore");
- } catch (ArrayStoreException e) {
+ } catch (final ArrayStoreException e) {
// expected
}
verify();
@@ -1091,7 +1091,7 @@ public abstract class AbstractCollection
try {
array = getCollection().toArray(null);
fail("toArray(null) should raise NPE");
- } catch (NullPointerException e) {
+ } catch (final NullPointerException e) {
// expected
}
verify();
@@ -1103,8 +1103,8 @@ public abstract class AbstractCollection
// Figure out if they're all the same class
// TODO: It'd be nicer to detect a common superclass
- HashSet<Class<?>> classes = new HashSet<Class<?>>();
- for (Object element : array) {
+ final HashSet<Class<?>> classes = new HashSet<Class<?>>();
+ for (final Object element : array) {
classes.add(element == null ? null : element.getClass());
}
if (classes.size() > 1) {
@@ -1149,7 +1149,7 @@ public abstract class AbstractCollection
try {
getCollection().clear();
fail("clear should raise UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
// expected
}
verify();
@@ -1157,7 +1157,7 @@ public abstract class AbstractCollection
try {
getCollection().remove(null);
fail("remove should raise UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
// expected
}
verify();
@@ -1165,7 +1165,7 @@ public abstract class AbstractCollection
try {
getCollection().removeAll(null);
fail("removeAll should raise UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
// expected
}
verify();
@@ -1173,18 +1173,18 @@ public abstract class AbstractCollection
try {
getCollection().retainAll(null);
fail("retainAll should raise UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
// expected
}
verify();
resetFull();
try {
- Iterator<E> iterator = getCollection().iterator();
+ final Iterator<E> iterator = getCollection().iterator();
iterator.next();
iterator.remove();
fail("iterator.remove should raise UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
// expected
}
verify();
@@ -1202,25 +1202,25 @@ public abstract class AbstractCollection
if (isAddSupported()) {
resetFull();
try {
- Iterator<E> iter = getCollection().iterator();
- E o = getOtherElements()[0];
+ final Iterator<E> iter = getCollection().iterator();
+ final E o = getOtherElements()[0];
getCollection().add(o);
getConfirmed().add(o);
iter.next();
fail("next after add should raise ConcurrentModification");
- } catch (ConcurrentModificationException e) {
+ } catch (final ConcurrentModificationException e) {
// expected
}
verify();
resetFull();
try {
- Iterator<E> iter = getCollection().iterator();
+ final Iterator<E> iter = getCollection().iterator();
getCollection().addAll(Arrays.asList(getOtherElements()));
getConfirmed().addAll(Arrays.asList(getOtherElements()));
iter.next();
fail("next after addAll should raise ConcurrentModification");
- } catch (ConcurrentModificationException e) {
+ } catch (final ConcurrentModificationException e) {
// expected
}
verify();
@@ -1232,45 +1232,45 @@ public abstract class AbstractCollection
resetFull();
try {
- Iterator<E> iter = getCollection().iterator();
+ final Iterator<E> iter = getCollection().iterator();
getCollection().clear();
iter.next();
fail("next after clear should raise ConcurrentModification");
- } catch (ConcurrentModificationException e) {
+ } catch (final ConcurrentModificationException e) {
// expected
- } catch (NoSuchElementException e) {
+ } catch (final NoSuchElementException e) {
// (also legal given spec)
}
resetFull();
try {
- Iterator<E> iter = getCollection().iterator();
+ final Iterator<E> iter = getCollection().iterator();
getCollection().remove(getFullElements()[0]);
iter.next();
fail("next after remove should raise ConcurrentModification");
- } catch (ConcurrentModificationException e) {
+ } catch (final ConcurrentModificationException e) {
// expected
}
resetFull();
try {
- Iterator<E> iter = getCollection().iterator();
- List<E> sublist = Arrays.asList(getFullElements()).subList(2,5);
+ final Iterator<E> iter = getCollection().iterator();
+ final List<E> sublist = Arrays.asList(getFullElements()).subList(2,5);
getCollection().removeAll(sublist);
iter.next();
fail("next after removeAll should raise ConcurrentModification");
- } catch (ConcurrentModificationException e) {
+ } catch (final ConcurrentModificationException e) {
// expected
}
resetFull();
try {
- Iterator<E> iter = getCollection().iterator();
- List<E> sublist = Arrays.asList(getFullElements()).subList(2,5);
+ final Iterator<E> iter = getCollection().iterator();
+ final List<E> sublist = Arrays.asList(getFullElements()).subList(2,5);
getCollection().retainAll(sublist);
iter.next();
fail("next after retainAll should raise ConcurrentModification");
- } catch (ConcurrentModificationException e) {
+ } catch (final ConcurrentModificationException e) {
// expected
}
}
@@ -1279,13 +1279,13 @@ public abstract class AbstractCollection
public void testSerializeDeserializeThenCompare() throws Exception {
Object obj = makeObject();
if (obj instanceof Serializable && isTestSerialization()) {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(buffer);
+ final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ final ObjectOutputStream out = new ObjectOutputStream(buffer);
out.writeObject(obj);
out.close();
- ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
- Object dest = in.readObject();
+ final ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
+ final Object dest = in.readObject();
in.close();
if (isEqualsCheckable()) {
assertEquals("obj != deserialize(serialize(obj)) - EMPTY Collection", obj, dest);
@@ -1293,13 +1293,13 @@ public abstract class AbstractCollection
}
obj = makeFullCollection();
if (obj instanceof Serializable && isTestSerialization()) {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(buffer);
+ final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ final ObjectOutputStream out = new ObjectOutputStream(buffer);
out.writeObject(obj);
out.close();
- ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
- Object dest = in.readObject();
+ final ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
+ final Object dest = in.readObject();
in.close();
if (isEqualsCheckable()) {
assertEquals("obj != deserialize(serialize(obj)) - FULL Collection", obj, dest);
@@ -1315,7 +1315,7 @@ public abstract class AbstractCollection
* Set the collection.
* @param collection the Collection<E> to set
*/
- public void setCollection(Collection<E> collection) {
+ public void setCollection(final Collection<E> collection) {
this.collection = collection;
}
@@ -1327,7 +1327,7 @@ public abstract class AbstractCollection
* Set the confirmed.
* @param confirmed the Collection<E> to set
*/
- public void setConfirmed(Collection<E> confirmed) {
+ public void setConfirmed(final Collection<E> confirmed) {
this.confirmed = confirmed;
}
@@ -1336,12 +1336,12 @@ public abstract class AbstractCollection
* @param coll
* @param element
*/
- protected static void assertNotCollectionContains(Collection<?> coll, Object element) {
+ protected static void assertNotCollectionContains(final Collection<?> coll, final Object element) {
try {
assertFalse(coll.contains(element));
- } catch (ClassCastException e) {
+ } catch (final ClassCastException e) {
//apparently not
- } catch (NullPointerException e) {
+ } catch (final NullPointerException e) {
//apparently not
}
}
@@ -1351,12 +1351,12 @@ public abstract class AbstractCollection
* @param coll
* @param sub
*/
- protected static void assertNotCollectionContainsAll(Collection<?> coll, Collection<?> sub) {
+ protected static void assertNotCollectionContainsAll(final Collection<?> coll, final Collection<?> sub) {
try {
assertFalse(coll.containsAll(sub));
- } catch (ClassCastException cce) {
+ } catch (final ClassCastException cce) {
//apparently not
- } catch (NullPointerException e) {
+ } catch (final NullPointerException e) {
//apparently not
}
}
@@ -1366,12 +1366,12 @@ public abstract class AbstractCollection
* @param coll
* @param element
*/
- protected static void assertNotRemoveFromCollection(Collection<?> coll, Object element) {
+ protected static void assertNotRemoveFromCollection(final Collection<?> coll, final Object element) {
try {
assertFalse(coll.remove(element));
- } catch (ClassCastException cce) {
+ } catch (final ClassCastException cce) {
//apparently not
- } catch (NullPointerException e) {
+ } catch (final NullPointerException e) {
//apparently not
}
}
@@ -1381,12 +1381,12 @@ public abstract class AbstractCollection
* @param coll
* @param sub
*/
- protected static void assertNotRemoveAllFromCollection(Collection<?> coll, Collection<?> sub) {
+ protected static void assertNotRemoveAllFromCollection(final Collection<?> coll, final Collection<?> sub) {
try {
assertFalse(coll.removeAll(sub));
- } catch (ClassCastException cce) {
+ } catch (final ClassCastException cce) {
//apparently not
- } catch (NullPointerException e) {
+ } catch (final NullPointerException e) {
//apparently not
}
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/CompositeCollectionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/CompositeCollectionTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/CompositeCollectionTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/CompositeCollectionTest.java Mon Jan 7 17:15:14 2013
@@ -32,7 +32,7 @@ import java.util.List;
*/
public class CompositeCollectionTest<E> extends AbstractCollectionTest<E> {
- public CompositeCollectionTest(String name) {
+ public CompositeCollectionTest(final String name) {
super(name);
}
@@ -74,10 +74,10 @@ public class CompositeCollectionTest<E>
*/
@Override
public Collection<E> makeFullCollection() {
- CompositeCollection<E> compositeCollection = new CompositeCollection<E>();
- E[] elements = getFullElements();
- for (E element : elements) {
- Collection<E> summand = new HashSet<E>();
+ final CompositeCollection<E> compositeCollection = new CompositeCollection<E>();
+ final E[] elements = getFullElements();
+ for (final E element : elements) {
+ final Collection<E> summand = new HashSet<E>();
summand.add(element);
compositeCollection.addComposited(summand);
}
@@ -89,7 +89,7 @@ public class CompositeCollectionTest<E>
*/
@Override
public Collection<E> makeConfirmedFullCollection() {
- Collection<E> collection = new HashSet<E>();
+ final Collection<E> collection = new HashSet<E>();
collection.addAll(Arrays.asList(getFullElements()));
return collection;
}
@@ -104,7 +104,7 @@ public class CompositeCollectionTest<E>
try {
getCollection().remove(null);
fail("remove should raise UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
// expected
}
verify();
@@ -126,25 +126,25 @@ public class CompositeCollectionTest<E>
protected void setUpMutatorTest() {
setUpTest();
c.setMutator(new CompositeCollection.CollectionMutator<E>() {
- public boolean add(CompositeCollection<E> composite,
- List<Collection<E>> collections, E obj) {
- for (Collection<E> collection : collections) {
+ public boolean add(final CompositeCollection<E> composite,
+ final List<Collection<E>> collections, final E obj) {
+ for (final Collection<E> collection : collections) {
collection.add(obj);
}
return true;
}
- public boolean addAll(CompositeCollection<E> composite,
- List<Collection<E>> collections, Collection<? extends E> coll) {
- for (Collection<E> collection : collections) {
+ public boolean addAll(final CompositeCollection<E> composite,
+ final List<Collection<E>> collections, final Collection<? extends E> coll) {
+ for (final Collection<E> collection : collections) {
collection.addAll(coll);
}
return true;
}
- public boolean remove(CompositeCollection<E> composite,
- List<Collection<E>> collections, Object obj) {
- for (Collection<E> collection : collections) {
+ public boolean remove(final CompositeCollection<E> composite,
+ final List<Collection<E>> collections, final Object obj) {
+ for (final Collection<E> collection : collections) {
collection.remove(obj);
}
return true;
@@ -155,7 +155,7 @@ public class CompositeCollectionTest<E>
@SuppressWarnings("unchecked")
public void testSize() {
setUpTest();
- HashSet<E> set = new HashSet<E>();
+ final HashSet<E> set = new HashSet<E>();
set.add((E) "a");
set.add((E) "b");
c.addComposited(set);
@@ -165,11 +165,11 @@ public class CompositeCollectionTest<E>
@SuppressWarnings("unchecked")
public void testMultipleCollectionsSize() {
setUpTest();
- HashSet<E> set = new HashSet<E>();
+ final HashSet<E> set = new HashSet<E>();
set.add((E) "a");
set.add((E) "b");
c.addComposited(set);
- HashSet<E> other = new HashSet<E>();
+ final HashSet<E> other = new HashSet<E>();
other.add((E) "c");
c.addComposited(other);
assertEquals(set.size() + other.size(), c.size());
@@ -179,7 +179,7 @@ public class CompositeCollectionTest<E>
public void testIsEmpty() {
setUpTest();
assertTrue(c.isEmpty());
- HashSet<E> empty = new HashSet<E>();
+ final HashSet<E> empty = new HashSet<E>();
c.addComposited(empty);
assertTrue(c.isEmpty());
empty.add((E) "a");
@@ -194,7 +194,7 @@ public class CompositeCollectionTest<E>
two.add((E) "2");
c.addComposited(one);
c.addComposited(two);
- Iterator<E> i = c.iterator();
+ final Iterator<E> i = c.iterator();
E next = i.next();
assertTrue(c.contains(next));
assertTrue(one.contains(next));
@@ -243,24 +243,24 @@ public class CompositeCollectionTest<E>
public void testAddAllMutator() {
setUpTest();
c.setMutator(new CompositeCollection.CollectionMutator<E>() {
- public boolean add(CompositeCollection<E> composite,
- List<Collection<E>> collections, E obj) {
- for (Collection<E> collection : collections) {
+ public boolean add(final CompositeCollection<E> composite,
+ final List<Collection<E>> collections, final E obj) {
+ for (final Collection<E> collection : collections) {
collection.add(obj);
}
return true;
}
- public boolean addAll(CompositeCollection<E> composite,
- List<Collection<E>> collections, Collection<? extends E> coll) {
- for (Collection<E> collection : collections) {
+ public boolean addAll(final CompositeCollection<E> composite,
+ final List<Collection<E>> collections, final Collection<? extends E> coll) {
+ for (final Collection<E> collection : collections) {
collection.addAll(coll);
}
return true;
}
- 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 false;
}
});
@@ -276,24 +276,24 @@ public class CompositeCollectionTest<E>
public void testAddMutator() {
setUpTest();
c.setMutator(new CompositeCollection.CollectionMutator<E>() {
- public boolean add(CompositeCollection<E> composite,
- List<Collection<E>> collections, E obj) {
- for (Collection<E> collection : collections) {
+ public boolean add(final CompositeCollection<E> composite,
+ final List<Collection<E>> collections, final E obj) {
+ for (final Collection<E> collection : collections) {
collection.add(obj);
}
return true;
}
- public boolean addAll(CompositeCollection<E> composite,
- List<Collection<E>> collections, Collection<? extends E> coll) {
- for (Collection<E> collection : collections) {
+ public boolean addAll(final CompositeCollection<E> composite,
+ final List<Collection<E>> collections, final Collection<? extends E> coll) {
+ for (final Collection<E> collection : collections) {
collection.addAll(coll);
}
return true;
}
- 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 false;
}
});
@@ -310,7 +310,7 @@ public class CompositeCollectionTest<E>
one.add((E) "1");
two.add((E) "2");
c.addComposited(one, two);
- Collection<E> foo = c.toCollection();
+ final Collection<E> foo = c.toCollection();
assertTrue(foo.containsAll(c));
assertEquals(c.size(), foo.size());
one.add((E) "3");
@@ -323,7 +323,7 @@ public class CompositeCollectionTest<E>
one.add((E) "1");
two.add((E) "2");
c.addComposited(one, two);
- Collection<E> toCollection = new HashSet<E>();
+ final Collection<E> toCollection = new HashSet<E>();
toCollection.addAll(c);
assertTrue(toCollection.containsAll(c));
assertEquals(c.size(), toCollection.size());
@@ -349,7 +349,7 @@ public class CompositeCollectionTest<E>
two.add((E) "2");
two.add((E) "1");
// need separate list to remove, as otherwise one clears itself
- Collection<E> removing = new ArrayList<E>(one);
+ final Collection<E> removing = new ArrayList<E>(one);
c.addComposited(one, two);
c.removeAll(removing);
assertTrue(!c.contains("1"));
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/IndexedCollectionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/IndexedCollectionTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/IndexedCollectionTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/IndexedCollectionTest.java Mon Jan 7 17:15:14 2013
@@ -38,20 +38,20 @@ import org.junit.Test;
@SuppressWarnings("boxing")
public class IndexedCollectionTest extends AbstractCollectionTest<String> {
- public IndexedCollectionTest(String name) {
+ public IndexedCollectionTest(final String name) {
super(name);
}
//------------------------------------------------------------------------
- protected Collection<String> decorateCollection(Collection<String> collection) {
+ protected Collection<String> decorateCollection(final Collection<String> collection) {
return IndexedCollection.uniqueIndexedCollection(collection, new IntegerTransformer());
}
private static final class IntegerTransformer implements Transformer<String, Integer>, Serializable {
private static final long serialVersionUID = 809439581555072949L;
- public Integer transform(String input) {
+ public Integer transform(final String input) {
return Integer.valueOf(input);
}
}
@@ -78,14 +78,14 @@ public class IndexedCollectionTest exten
@Override
public Collection<String> makeFullCollection() {
- List<String> list = new ArrayList<String>();
+ final List<String> list = new ArrayList<String>();
list.addAll(Arrays.asList(getFullElements()));
return decorateCollection(list);
}
@Override
public Collection<String> makeConfirmedFullCollection() {
- List<String> list = new ArrayList<String>();
+ final List<String> list = new ArrayList<String>();
list.addAll(Arrays.asList(getFullElements()));
return list;
}
@@ -105,13 +105,14 @@ public class IndexedCollectionTest exten
@Test
public void addedObjectsCanBeRetrievedByKey() throws Exception {
- Collection<String> coll = getCollection();
+ final Collection<String> coll = getCollection();
coll.add("12");
coll.add("16");
coll.add("1");
coll.addAll(asList("2","3","4"));
@SuppressWarnings("unchecked")
+ final
IndexedCollection<Integer, String> indexed = (IndexedCollection<Integer, String>) coll;
assertEquals("12", indexed.get(12));
assertEquals("16", indexed.get(16));
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/PredicatedCollectionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/PredicatedCollectionTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/PredicatedCollectionTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/PredicatedCollectionTest.java Mon Jan 7 17:15:14 2013
@@ -33,7 +33,7 @@ import org.apache.commons.collections.fu
*/
public class PredicatedCollectionTest<E> extends AbstractCollectionTest<E> {
- public PredicatedCollectionTest(String name) {
+ public PredicatedCollectionTest(final String name) {
super(name);
}
@@ -41,7 +41,7 @@ public class PredicatedCollectionTest<E>
protected Predicate<E> truePredicate = TruePredicate.<E>truePredicate();
protected Collection<E> decorateCollection(
- Collection<E> collection, Predicate<E> predicate) {
+ final Collection<E> collection, final Predicate<E> predicate) {
return PredicatedCollection.predicatedCollection(collection, predicate);
}
@@ -63,14 +63,14 @@ public class PredicatedCollectionTest<E>
@Override
public Collection<E> makeFullCollection() {
- List<E> list = new ArrayList<E>();
+ final List<E> list = new ArrayList<E>();
list.addAll(Arrays.asList(getFullElements()));
return decorateCollection(list, truePredicate);
}
@Override
public Collection<E> makeConfirmedFullCollection() {
- List<E> list = new ArrayList<E>();
+ final List<E> list = new ArrayList<E>();
list.addAll(Arrays.asList(getFullElements()));
return list;
}
@@ -78,7 +78,7 @@ public class PredicatedCollectionTest<E>
//-----------------------------------------------------------------------
protected Predicate<E> testPredicate =
new Predicate<E>() {
- public boolean evaluate(E o) {
+ public boolean evaluate(final E o) {
return o instanceof String;
}
};
@@ -89,12 +89,12 @@ public class PredicatedCollectionTest<E>
@SuppressWarnings("unchecked")
public void testIllegalAdd() {
- Collection<E> c = makeTestCollection();
- Integer i = new Integer(3);
+ final Collection<E> c = makeTestCollection();
+ final Integer i = new Integer(3);
try {
c.add((E) i);
fail("Integer should fail string predicate.");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
assertTrue("Collection shouldn't contain illegal element",
@@ -103,8 +103,8 @@ public class PredicatedCollectionTest<E>
@SuppressWarnings("unchecked")
public void testIllegalAddAll() {
- Collection<E> c = makeTestCollection();
- List<E> elements = new ArrayList<E>();
+ final Collection<E> c = makeTestCollection();
+ final List<E> elements = new ArrayList<E>();
elements.add((E) "one");
elements.add((E) "two");
elements.add((E) new Integer(3));
@@ -112,7 +112,7 @@ public class PredicatedCollectionTest<E>
try {
c.addAll(elements);
fail("Integer should fail string predicate.");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// expected
}
assertTrue("Collection shouldn't contain illegal element", !c.contains("one"));
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/SynchronizedCollectionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/SynchronizedCollectionTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/SynchronizedCollectionTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/SynchronizedCollectionTest.java Mon Jan 7 17:15:14 2013
@@ -29,7 +29,7 @@ import java.util.Collection;
*/
public class SynchronizedCollectionTest<E> extends AbstractCollectionTest<E> {
- public SynchronizedCollectionTest(String testName) {
+ public SynchronizedCollectionTest(final String testName) {
super(testName);
}
@@ -46,7 +46,7 @@ public class SynchronizedCollectionTest<
@Override
public Collection<E> makeConfirmedFullCollection() {
- ArrayList<E> list = new ArrayList<E>();
+ final ArrayList<E> list = new ArrayList<E>();
list.addAll(Arrays.asList(getFullElements()));
return list;
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/TransformedCollectionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/TransformedCollectionTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/TransformedCollectionTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/TransformedCollectionTest.java Mon Jan 7 17:15:14 2013
@@ -34,7 +34,7 @@ import org.apache.commons.collections.Tr
public class TransformedCollectionTest extends AbstractCollectionTest<Object> {
private static class StringToInteger implements Transformer<Object, Object> {
- public Object transform(Object input) {
+ public Object transform(final Object input) {
return new Integer((String) input);
}
}
@@ -42,7 +42,7 @@ public class TransformedCollectionTest e
public static final Transformer<Object, Object> NOOP_TRANSFORMER = TransformerUtils.nopTransformer();
public static final Transformer<Object, Object> STRING_TO_INTEGER_TRANSFORMER = new StringToInteger();
- public TransformedCollectionTest(String testName) {
+ public TransformedCollectionTest(final String testName) {
super(testName);
}
@@ -54,7 +54,7 @@ public class TransformedCollectionTest e
@Override
public Collection<Object> makeConfirmedFullCollection() {
- List<Object> list = new ArrayList<Object>();
+ final List<Object> list = new ArrayList<Object>();
list.addAll(Arrays.asList(getFullElements()));
return list;
}
@@ -66,7 +66,7 @@ public class TransformedCollectionTest e
@Override
public Collection<Object> makeFullCollection() {
- List<Object> list = new ArrayList<Object>();
+ final List<Object> list = new ArrayList<Object>();
list.addAll(Arrays.asList(getFullElements()));
return TransformedCollection.transformingCollection(list, NOOP_TRANSFORMER);
}
@@ -84,9 +84,9 @@ public class TransformedCollectionTest e
//-----------------------------------------------------------------------
public void testTransformedCollection() {
- Collection<Object> coll = TransformedCollection.transformingCollection(new ArrayList<Object>(), STRING_TO_INTEGER_TRANSFORMER);
+ final Collection<Object> coll = TransformedCollection.transformingCollection(new ArrayList<Object>(), STRING_TO_INTEGER_TRANSFORMER);
assertEquals(0, coll.size());
- Object[] els = getFullElements();
+ final Object[] els = getFullElements();
for (int i = 0; i < els.length; i++) {
coll.add(els[i]);
assertEquals(i + 1, coll.size());
@@ -98,14 +98,14 @@ public class TransformedCollectionTest e
}
public void testTransformedCollection_decorateTransform() {
- Collection originalCollection = new ArrayList();
- Object[] els = getFullElements();
- for (Object el : els) {
+ final Collection originalCollection = new ArrayList();
+ final Object[] els = getFullElements();
+ for (final Object el : els) {
originalCollection.add(el);
}
- Collection<Object> collection = TransformedCollection.transformedCollection(originalCollection, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
+ final Collection<Object> collection = TransformedCollection.transformedCollection(originalCollection, TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
assertEquals(els.length, collection.size());
- for (Object el : els) {
+ for (final Object el : els) {
assertEquals(true, collection.contains(new Integer((String) el)));
assertEquals(false, collection.contains(el));
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/UnmodifiableBoundedCollectionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/UnmodifiableBoundedCollectionTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/UnmodifiableBoundedCollectionTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/UnmodifiableBoundedCollectionTest.java Mon Jan 7 17:15:14 2013
@@ -33,21 +33,21 @@ import org.apache.commons.collections.bu
*/
public class UnmodifiableBoundedCollectionTest<E> extends AbstractCollectionTest<E> {
- public UnmodifiableBoundedCollectionTest(String testName) {
+ public UnmodifiableBoundedCollectionTest(final String testName) {
super(testName);
}
//-----------------------------------------------------------------------
@Override
public Collection<E> makeObject() {
- BoundedBuffer<E> buffer = BoundedBuffer.<E>boundedBuffer(new ArrayStack<E>(), 10);
+ final BoundedBuffer<E> buffer = BoundedBuffer.<E>boundedBuffer(new ArrayStack<E>(), 10);
return UnmodifiableBoundedCollection.unmodifiableBoundedCollection(buffer);
}
@Override
public Collection<E> makeFullCollection() {
- E[] allElements = getFullElements();
- Buffer<E> buffer = BufferUtils.boundedBuffer(new ArrayStack<E>(), allElements.length);
+ final E[] allElements = getFullElements();
+ final Buffer<E> buffer = BufferUtils.boundedBuffer(new ArrayStack<E>(), allElements.length);
buffer.addAll(Arrays.asList(allElements));
return UnmodifiableBoundedCollection.unmodifiableBoundedCollection(buffer);
}
@@ -59,7 +59,7 @@ public class UnmodifiableBoundedCollecti
@Override
public Collection<E> makeConfirmedFullCollection() {
- ArrayList<E> list = new ArrayList<E>();
+ final ArrayList<E> list = new ArrayList<E>();
list.addAll(Arrays.asList(getFullElements()));
return list;
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/UnmodifiableCollectionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/UnmodifiableCollectionTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/UnmodifiableCollectionTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/UnmodifiableCollectionTest.java Mon Jan 7 17:15:14 2013
@@ -30,7 +30,7 @@ import java.util.List;
*/
public class UnmodifiableCollectionTest<E> extends AbstractCollectionTest<E> {
- public UnmodifiableCollectionTest(String testName) {
+ public UnmodifiableCollectionTest(final String testName) {
super(testName);
}
@@ -42,7 +42,7 @@ public class UnmodifiableCollectionTest<
@Override
public Collection<E> makeFullCollection() {
- List<E> list = new ArrayList<E>();
+ final List<E> list = new ArrayList<E>();
list.addAll(Arrays.asList(getFullElements()));
return UnmodifiableCollection.unmodifiableCollection(list);
}
@@ -54,7 +54,7 @@ public class UnmodifiableCollectionTest<
@Override
public Collection<E> makeConfirmedFullCollection() {
- ArrayList<E> list = new ArrayList<E>();
+ final ArrayList<E> list = new ArrayList<E>();
list.addAll(Arrays.asList(getFullElements()));
return list;
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/AbstractComparatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/AbstractComparatorTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/AbstractComparatorTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/AbstractComparatorTest.java Mon Jan 7 17:15:14 2013
@@ -40,7 +40,7 @@ public abstract class AbstractComparator
*
* @param testName the test class name
*/
- public AbstractComparatorTest(String testName) {
+ public AbstractComparatorTest(final String testName) {
super(testName);
}
@@ -91,21 +91,21 @@ public abstract class AbstractComparator
/**
* Reverse the list.
*/
- protected void reverseObjects(List<?> list) {
+ protected void reverseObjects(final List<?> list) {
Collections.reverse(list);
}
/**
* Randomize the list.
*/
- protected void randomizeObjects(List<?> list) {
+ protected void randomizeObjects(final List<?> list) {
Collections.shuffle(list);
}
/**
* Sort the list.
*/
- protected void sortObjects(List<T> list, Comparator<? super T> comparator) {
+ protected void sortObjects(final List<T> list, final Comparator<? super T> comparator) {
Collections.sort(list, comparator);
}
@@ -115,10 +115,10 @@ public abstract class AbstractComparator
*/
@Test
public void testEmptyListSort() {
- List<T> list = new LinkedList<T>();
+ final List<T> list = new LinkedList<T>();
sortObjects(list, makeObject());
- List<T> list2 = new LinkedList<T>();
+ final List<T> list2 = new LinkedList<T>();
assertTrue("Comparator cannot sort empty lists", list2.equals(list));
}
@@ -128,13 +128,13 @@ public abstract class AbstractComparator
*/
@Test
public void testReverseListSort() {
- Comparator<T> comparator = makeObject();
+ final Comparator<T> comparator = makeObject();
- List<T> randomList = getComparableObjectsOrdered();
+ final List<T> randomList = getComparableObjectsOrdered();
reverseObjects(randomList);
sortObjects(randomList, comparator);
- List<T> orderedList = getComparableObjectsOrdered();
+ final List<T> orderedList = getComparableObjectsOrdered();
assertTrue("Comparator did not reorder the List correctly",
orderedList.equals(randomList));
@@ -145,13 +145,13 @@ public abstract class AbstractComparator
*/
@Test
public void testRandomListSort() {
- Comparator<T> comparator = makeObject();
+ final Comparator<T> comparator = makeObject();
- List<T> randomList = getComparableObjectsOrdered();
+ final List<T> randomList = getComparableObjectsOrdered();
randomizeObjects(randomList);
sortObjects(randomList,comparator);
- List<T> orderedList = getComparableObjectsOrdered();
+ final List<T> orderedList = getComparableObjectsOrdered();
/* debug
Iterator i = randomList.iterator();
@@ -170,13 +170,13 @@ public abstract class AbstractComparator
*/
@Test
public void testComparatorIsSerializable() {
- Comparator<T> comparator = makeObject();
+ final Comparator<T> comparator = makeObject();
assertTrue("This comparator should be Serializable.",
comparator instanceof Serializable);
}
- public String getCanonicalComparatorName(Object object) {
- StringBuilder retval = new StringBuilder();
+ public String getCanonicalComparatorName(final Object object) {
+ final StringBuilder retval = new StringBuilder();
retval.append(TEST_DATA_PATH);
String colName = object.getClass().getName();
colName = colName.substring(colName.lastIndexOf(".")+1,colName.length());
@@ -200,13 +200,13 @@ public abstract class AbstractComparator
// test to make sure the canonical form has been preserved
try {
comparator = (Comparator<T>) readExternalFormFromDisk(getCanonicalComparatorName(makeObject()));
- } catch (FileNotFoundException exception) {
+ } catch (final FileNotFoundException exception) {
- boolean autoCreateSerialized = false;
+ final boolean autoCreateSerialized = false;
if (autoCreateSerialized) {
comparator = makeObject();
- String fileName = getCanonicalComparatorName(comparator);
+ final String fileName = getCanonicalComparatorName(comparator);
writeExternalFormToDisk((Serializable) comparator, fileName);
fail("Serialized form could not be found. A serialized version "
+ "has now been written (and should be added to CVS): " + fileName);
@@ -219,11 +219,11 @@ public abstract class AbstractComparator
// make sure the canonical form produces the ordering we currently
// expect
- List<T> randomList = getComparableObjectsOrdered();
+ final List<T> randomList = getComparableObjectsOrdered();
reverseObjects(randomList);
sortObjects(randomList, comparator);
- List<T> orderedList = getComparableObjectsOrdered();
+ final List<T> orderedList = getComparableObjectsOrdered();
assertTrue("Comparator did not reorder the List correctly",
orderedList.equals(randomList));
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/AbstractNullComparatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/AbstractNullComparatorTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/AbstractNullComparatorTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/AbstractNullComparatorTest.java Mon Jan 7 17:15:14 2013
@@ -30,12 +30,12 @@ import junit.framework.TestSuite;
*/
public abstract class AbstractNullComparatorTest extends AbstractComparatorTest<Integer> {
- public AbstractNullComparatorTest(String testName) {
+ public AbstractNullComparatorTest(final String testName) {
super(testName);
}
public static Test suite() {
- TestSuite suite = new TestSuite(AbstractNullComparatorTest.class.getName());
+ final TestSuite suite = new TestSuite(AbstractNullComparatorTest.class.getName());
suite.addTest(new TestSuite(TestNullComparator1.class));
suite.addTest(new TestSuite(TestNullComparator2.class));
return suite;
@@ -46,7 +46,7 @@ public abstract class AbstractNullCompar
**/
public static class TestNullComparator1 extends AbstractNullComparatorTest {
- public TestNullComparator1(String testName) {
+ public TestNullComparator1(final String testName) {
super(testName);
}
@@ -57,7 +57,7 @@ public abstract class AbstractNullCompar
@Override
public List<Integer> getComparableObjectsOrdered() {
- List<Integer> list = new LinkedList<Integer>();
+ final List<Integer> list = new LinkedList<Integer>();
list.add(new Integer(1));
list.add(new Integer(2));
list.add(new Integer(3));
@@ -68,7 +68,7 @@ public abstract class AbstractNullCompar
}
@Override
- public String getCanonicalComparatorName(Object object) {
+ public String getCanonicalComparatorName(final Object object) {
return super.getCanonicalComparatorName(object) + "1";
}
}
@@ -78,7 +78,7 @@ public abstract class AbstractNullCompar
**/
public static class TestNullComparator2 extends AbstractNullComparatorTest {
- public TestNullComparator2(String testName) {
+ public TestNullComparator2(final String testName) {
super(testName);
}
@@ -89,7 +89,7 @@ public abstract class AbstractNullCompar
@Override
public List<Integer> getComparableObjectsOrdered() {
- List<Integer> list = new LinkedList<Integer>();
+ final List<Integer> list = new LinkedList<Integer>();
list.add(null);
list.add(new Integer(1));
list.add(new Integer(2));
@@ -100,7 +100,7 @@ public abstract class AbstractNullCompar
}
@Override
- public String getCanonicalComparatorName(Object object) {
+ public String getCanonicalComparatorName(final Object object) {
return super.getCanonicalComparatorName(object) + "2";
}
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/BooleanComparatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/BooleanComparatorTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/BooleanComparatorTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/BooleanComparatorTest.java Mon Jan 7 17:15:14 2013
@@ -33,7 +33,7 @@ public class BooleanComparatorTest exten
// conventional
// ------------------------------------------------------------------------
- public BooleanComparatorTest(String testName) {
+ public BooleanComparatorTest(final String testName) {
super(testName);
}
@@ -47,7 +47,7 @@ public class BooleanComparatorTest exten
@Override
public List<Boolean> getComparableObjectsOrdered() {
- List<Boolean> list = new ArrayList<Boolean>();
+ final List<Boolean> list = new ArrayList<Boolean>();
list.add(new Boolean(false));
list.add(Boolean.FALSE);
list.add(new Boolean(false));
@@ -99,7 +99,7 @@ public class BooleanComparatorTest exten
// utilities
// ------------------------------------------------------------------------
- protected void allTests(boolean trueFirst, BooleanComparator comp) {
+ protected void allTests(final boolean trueFirst, final BooleanComparator comp) {
orderIndependentTests(comp);
if(trueFirst) {
trueFirstTests(comp);
@@ -108,7 +108,7 @@ public class BooleanComparatorTest exten
}
}
- protected void trueFirstTests(BooleanComparator comp) {
+ protected void trueFirstTests(final BooleanComparator comp) {
assertNotNull(comp);
assertEquals(0,comp.compare(true, true));
assertEquals(0,comp.compare(false, false));
@@ -116,7 +116,7 @@ public class BooleanComparatorTest exten
assertTrue(comp.compare(true, false) < 0);
}
- protected void falseFirstTests(BooleanComparator comp) {
+ protected void falseFirstTests(final BooleanComparator comp) {
assertNotNull(comp);
assertEquals(0,comp.compare(true, true));
assertEquals(0,comp.compare(false, false));
@@ -124,40 +124,40 @@ public class BooleanComparatorTest exten
assertTrue(comp.compare(true, false) > 0);
}
- protected void orderIndependentTests(BooleanComparator comp) {
+ protected void orderIndependentTests(final BooleanComparator comp) {
nullArgumentTests(comp);
}
- protected void nullArgumentTests(BooleanComparator comp) {
+ protected void nullArgumentTests(final BooleanComparator comp) {
assertNotNull(comp);
try {
comp.compare(null,null);
fail("Expected NullPointerException");
- } catch(NullPointerException e) {
+ } catch(final NullPointerException e) {
// expected
}
try {
comp.compare(Boolean.TRUE,null);
fail("Expected NullPointerException");
- } catch(NullPointerException e) {
+ } catch(final NullPointerException e) {
// expected
}
try {
comp.compare(Boolean.FALSE,null);
fail("Expected NullPointerException");
- } catch(NullPointerException e) {
+ } catch(final NullPointerException e) {
// expected
}
try {
comp.compare(null,Boolean.TRUE);
fail("Expected NullPointerException");
- } catch(NullPointerException e) {
+ } catch(final NullPointerException e) {
// expected
}
try {
comp.compare(null,Boolean.FALSE);
fail("Expected NullPointerException");
- } catch(NullPointerException e) {
+ } catch(final NullPointerException e) {
// expected
}
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/ComparableComparatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/ComparableComparatorTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/ComparableComparatorTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/ComparableComparatorTest.java Mon Jan 7 17:15:14 2013
@@ -29,7 +29,7 @@ import java.util.List;
@SuppressWarnings("boxing")
public class ComparableComparatorTest extends AbstractComparatorTest<Integer> {
- public ComparableComparatorTest(String testName) {
+ public ComparableComparatorTest(final String testName) {
super(testName);
}
@@ -40,7 +40,7 @@ public class ComparableComparatorTest ex
@Override
public List<Integer> getComparableObjectsOrdered() {
- List<Integer> list = new LinkedList<Integer>();
+ final List<Integer> list = new LinkedList<Integer>();
list.add(1);
list.add(2);
list.add(3);
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/ComparatorChainTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/ComparatorChainTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/ComparatorChainTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/ComparatorChainTest.java Mon Jan 7 17:15:14 2013
@@ -30,13 +30,13 @@ import org.junit.Test;
*/
public class ComparatorChainTest extends AbstractComparatorTest<ComparatorChainTest.PseudoRow> {
- public ComparatorChainTest(String testName) {
+ public ComparatorChainTest(final String testName) {
super(testName);
}
@Override
public Comparator<PseudoRow> makeObject() {
- ComparatorChain<PseudoRow> chain = new ComparatorChain<PseudoRow>(new ColumnComparator(0));
+ final ComparatorChain<PseudoRow> chain = new ComparatorChain<PseudoRow>(new ColumnComparator(0));
chain.addComparator(new ColumnComparator(1), true); // reverse the second column
chain.addComparator(new ColumnComparator(2), false);
return chain;
@@ -44,49 +44,49 @@ public class ComparatorChainTest extends
@Test
public void testNoopComparatorChain() {
- ComparatorChain<Integer> chain = new ComparatorChain<Integer>();
- Integer i1 = new Integer(4);
- Integer i2 = new Integer(6);
+ final ComparatorChain<Integer> chain = new ComparatorChain<Integer>();
+ final Integer i1 = new Integer(4);
+ final Integer i2 = new Integer(6);
chain.addComparator(new ComparableComparator<Integer>());
- int correctValue = i1.compareTo(i2);
+ final int correctValue = i1.compareTo(i2);
assertTrue("Comparison returns the right order", chain.compare(i1, i2) == correctValue);
}
@Test
public void testBadNoopComparatorChain() {
- ComparatorChain<Integer> chain = new ComparatorChain<Integer>();
- Integer i1 = new Integer(4);
- Integer i2 = new Integer(6);
+ final ComparatorChain<Integer> chain = new ComparatorChain<Integer>();
+ final Integer i1 = new Integer(4);
+ final Integer i2 = new Integer(6);
try {
chain.compare(i1,i2);
fail("An exception should be thrown when a chain contains zero comparators.");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
}
@Test
public void testListComparatorChain() {
- List<Comparator<Integer>> list = new LinkedList<Comparator<Integer>>();
+ final List<Comparator<Integer>> list = new LinkedList<Comparator<Integer>>();
list.add(new ComparableComparator<Integer>());
- ComparatorChain<Integer> chain = new ComparatorChain<Integer>(list);
- Integer i1 = new Integer(4);
- Integer i2 = new Integer(6);
+ final ComparatorChain<Integer> chain = new ComparatorChain<Integer>(list);
+ final Integer i1 = new Integer(4);
+ final Integer i2 = new Integer(6);
- int correctValue = i1.compareTo(i2);
+ final int correctValue = i1.compareTo(i2);
assertTrue("Comparison returns the right order", chain.compare(i1, i2) == correctValue);
}
@Test
public void testBadListComparatorChain() {
- List<Comparator<Integer>> list = new LinkedList<Comparator<Integer>>();
- ComparatorChain<Integer> chain = new ComparatorChain<Integer>(list);
- Integer i1 = new Integer(4);
- Integer i2 = new Integer(6);
+ final List<Comparator<Integer>> list = new LinkedList<Comparator<Integer>>();
+ final ComparatorChain<Integer> chain = new ComparatorChain<Integer>(list);
+ final Integer i1 = new Integer(4);
+ final Integer i2 = new Integer(6);
try {
chain.compare(i1, i2);
fail("An exception should be thrown when a chain contains zero comparators.");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
}
}
@@ -94,10 +94,10 @@ public class ComparatorChainTest extends
public void testComparatorChainOnMinvaluedCompatator() {
// -1 * Integer.MIN_VALUE is less than 0,
// test that ComparatorChain handles this edge case correctly
- ComparatorChain<Integer> chain = new ComparatorChain<Integer>();
+ final ComparatorChain<Integer> chain = new ComparatorChain<Integer>();
chain.addComparator(new Comparator<Integer>() {
- public int compare(Integer a, Integer b) {
- int result = a.compareTo(b);
+ public int compare(final Integer a, final Integer b) {
+ final int result = a.compareTo(b);
if (result < 0) {
return Integer.MIN_VALUE;
}
@@ -115,7 +115,7 @@ public class ComparatorChainTest extends
@Override
public List<PseudoRow> getComparableObjectsOrdered() {
- List<PseudoRow> list = new LinkedList<PseudoRow>();
+ final List<PseudoRow> list = new LinkedList<PseudoRow>();
// this is the correct order assuming a
// "0th forward, 1st reverse, 2nd forward" sort
list.add(new PseudoRow(1, 2, 3));
@@ -133,19 +133,19 @@ public class ComparatorChainTest extends
public int cols[] = new int[3];
- public PseudoRow(int col1, int col2, int col3) {
+ public PseudoRow(final int col1, final int col2, final int col3) {
cols[0] = col1;
cols[1] = col2;
cols[2] = col3;
}
- public int getColumn(int colIndex) {
+ public int getColumn(final int colIndex) {
return cols[colIndex];
}
@Override
public String toString() {
- StringBuilder buf = new StringBuilder();
+ final StringBuilder buf = new StringBuilder();
buf.append("[");
buf.append(cols[0]);
buf.append(",");
@@ -157,12 +157,12 @@ public class ComparatorChainTest extends
}
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (!(o instanceof PseudoRow)) {
return false;
}
- PseudoRow row = (PseudoRow) o;
+ final PseudoRow row = (PseudoRow) o;
if (getColumn(0) != row.getColumn(0)) {
return false;
}
@@ -185,14 +185,14 @@ public class ComparatorChainTest extends
protected int colIndex = 0;
- public ColumnComparator(int colIndex) {
+ public ColumnComparator(final int colIndex) {
this.colIndex = colIndex;
}
- public int compare(PseudoRow o1, PseudoRow o2) {
+ public int compare(final PseudoRow o1, final PseudoRow o2) {
- int col1 = o1.getColumn(colIndex);
- int col2 = o2.getColumn(colIndex);
+ final int col1 = o1.getColumn(colIndex);
+ final int col2 = o2.getColumn(colIndex);
if (col1 > col2) {
return 1;
@@ -209,7 +209,7 @@ public class ComparatorChainTest extends
}
@Override
- public boolean equals(Object that) {
+ public boolean equals(final Object that) {
return that instanceof ColumnComparator && colIndex == ((ColumnComparator) that).colIndex;
}
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/FixedOrderComparatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/FixedOrderComparatorTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/FixedOrderComparatorTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/FixedOrderComparatorTest.java Mon Jan 7 17:15:14 2013
@@ -51,7 +51,7 @@ public class FixedOrderComparatorTest ex
// Initialization and busywork
//
- public FixedOrderComparatorTest(String name) {
+ public FixedOrderComparatorTest(final String name) {
super(name);
}
@@ -61,7 +61,7 @@ public class FixedOrderComparatorTest ex
@Override
public Comparator<String> makeObject() {
- FixedOrderComparator<String> comparator = new FixedOrderComparator<String>(topCities);
+ final FixedOrderComparator<String> comparator = new FixedOrderComparator<String>(topCities);
return comparator;
}
@@ -84,11 +84,11 @@ public class FixedOrderComparatorTest ex
*/
@Test
public void testConstructorPlusAdd() {
- FixedOrderComparator<String> comparator = new FixedOrderComparator<String>();
- for (String topCitie : topCities) {
+ final FixedOrderComparator<String> comparator = new FixedOrderComparator<String>();
+ for (final String topCitie : topCities) {
comparator.add(topCitie);
}
- String[] keys = topCities.clone();
+ final String[] keys = topCities.clone();
assertComparatorYieldsOrder(keys, comparator);
}
@@ -97,9 +97,9 @@ public class FixedOrderComparatorTest ex
*/
@Test
public void testArrayConstructor() {
- String[] keys = topCities.clone();
- String[] topCitiesForTest = topCities.clone();
- FixedOrderComparator<String> comparator = new FixedOrderComparator<String>(topCitiesForTest);
+ final String[] keys = topCities.clone();
+ final String[] topCitiesForTest = topCities.clone();
+ final FixedOrderComparator<String> comparator = new FixedOrderComparator<String>(topCitiesForTest);
assertComparatorYieldsOrder(keys, comparator);
// test that changing input after constructor has no effect
topCitiesForTest[0] = "Brighton";
@@ -111,9 +111,9 @@ public class FixedOrderComparatorTest ex
*/
@Test
public void testListConstructor() {
- String[] keys = topCities.clone();
- List<String> topCitiesForTest = new LinkedList<String>(Arrays.asList(topCities));
- FixedOrderComparator<String> comparator = new FixedOrderComparator<String>(topCitiesForTest);
+ final String[] keys = topCities.clone();
+ final List<String> topCitiesForTest = new LinkedList<String>(Arrays.asList(topCities));
+ final FixedOrderComparator<String> comparator = new FixedOrderComparator<String>(topCitiesForTest);
assertComparatorYieldsOrder(keys, comparator);
// test that changing input after constructor has no effect
topCitiesForTest.set(0, "Brighton");
@@ -125,7 +125,7 @@ public class FixedOrderComparatorTest ex
*/
@Test
public void testAddAsEqual() {
- FixedOrderComparator<String> comparator = new FixedOrderComparator<String>(topCities);
+ final FixedOrderComparator<String> comparator = new FixedOrderComparator<String>(topCities);
comparator.addAsEqual("New York", "Minneapolis");
assertEquals(0, comparator.compare("New York", "Minneapolis"));
assertEquals(-1, comparator.compare("Tokyo", "Minneapolis"));
@@ -137,21 +137,21 @@ public class FixedOrderComparatorTest ex
*/
@Test
public void testLock() {
- FixedOrderComparator<String> comparator = new FixedOrderComparator<String>(topCities);
+ final FixedOrderComparator<String> comparator = new FixedOrderComparator<String>(topCities);
assertEquals(false, comparator.isLocked());
comparator.compare("New York", "Tokyo");
assertEquals(true, comparator.isLocked());
try {
comparator.add("Minneapolis");
fail("Should have thrown an UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
// success -- ignore
}
try {
comparator.addAsEqual("New York", "Minneapolis");
fail("Should have thrown an UnsupportedOperationException");
- } catch (UnsupportedOperationException e) {
+ } catch (final UnsupportedOperationException e) {
// success -- ignore
}
}
@@ -162,13 +162,13 @@ public class FixedOrderComparatorTest ex
try {
comparator.compare("New York", "Minneapolis");
fail("Should have thrown a IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// success-- ignore
}
try {
comparator.compare("Minneapolis", "New York");
fail("Should have thrown a IllegalArgumentException");
- } catch (IllegalArgumentException e) {
+ } catch (final IllegalArgumentException e) {
// success-- ignore
}
assertEquals(FixedOrderComparator.UnknownObjectBehavior.EXCEPTION, comparator.getUnknownObjectBehavior());
@@ -203,20 +203,20 @@ public class FixedOrderComparatorTest ex
/** Shuffles the keys and asserts that the comparator sorts them back to
* their original order.
*/
- private void assertComparatorYieldsOrder(String[] orderedObjects,
- Comparator<String> comparator) {
- String[] keys = orderedObjects.clone();
+ private void assertComparatorYieldsOrder(final String[] orderedObjects,
+ final Comparator<String> comparator) {
+ final String[] keys = orderedObjects.clone();
// shuffle until the order changes. It's extremely rare that
// this requires more than one shuffle.
boolean isInNewOrder = false;
- Random rand = new Random();
+ final Random rand = new Random();
while (keys.length > 1 && isInNewOrder == false) {
// shuffle:
for (int i = keys.length-1; i > 0; i--) {
- String swap = keys[i];
- int j = rand.nextInt(i+1);
+ final String swap = keys[i];
+ final int j = rand.nextInt(i+1);
keys[i] = keys[j];
keys[j] = swap;
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/ReverseComparatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/ReverseComparatorTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/ReverseComparatorTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/ReverseComparatorTest.java Mon Jan 7 17:15:14 2013
@@ -34,7 +34,7 @@ import org.junit.Test;
*/
public class ReverseComparatorTest extends AbstractComparatorTest<Integer> {
- public ReverseComparatorTest(String testName) {
+ public ReverseComparatorTest(final String testName) {
super(testName);
}
@@ -55,7 +55,7 @@ public class ReverseComparatorTest exten
@Override
public List<Integer> getComparableObjectsOrdered() {
- List<Integer> list = new LinkedList<Integer>();
+ final List<Integer> list = new LinkedList<Integer>();
list.add(new Integer(1));
list.add(new Integer(2));
list.add(new Integer(3));
@@ -73,15 +73,15 @@ public class ReverseComparatorTest exten
@SuppressWarnings("unchecked")
@Test
public void testSerializeDeserializeThenCompare() throws Exception {
- Comparator comp = new ReverseComparator(new ComparableComparator());
+ final Comparator comp = new ReverseComparator(new ComparableComparator());
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(buffer);
+ final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ final ObjectOutputStream out = new ObjectOutputStream(buffer);
out.writeObject(comp);
out.close();
- ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
- Object dest = in.readObject();
+ final ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
+ final Object dest = in.readObject();
in.close();
assertEquals("obj != deserialize(serialize(obj))",comp,dest);
}
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/TransformingComparatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/TransformingComparatorTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/TransformingComparatorTest.java (original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/comparators/TransformingComparatorTest.java Mon Jan 7 17:15:14 2013
@@ -33,7 +33,7 @@ public class TransformingComparatorTest
// Initialization and busywork
//
- public TransformingComparatorTest(String name) {
+ public TransformingComparatorTest(final String name) {
super(name);
}
@@ -43,15 +43,15 @@ public class TransformingComparatorTest
@Override
public Comparator<Integer> makeObject() {
- Comparator<Integer> decorated = new ComparableComparator<Integer>();
- TransformingComparator<Integer> comparator =
+ final Comparator<Integer> decorated = new ComparableComparator<Integer>();
+ final TransformingComparator<Integer> comparator =
new TransformingComparator<Integer>(TransformerUtils.<Integer>nopTransformer(), decorated);
return comparator;
}
@Override
public List<Integer> getComparableObjectsOrdered() {
- List<Integer> list = new LinkedList<Integer>();
+ final List<Integer> list = new LinkedList<Integer>();
list.add(1);
list.add(2);
list.add(3);