diff --git a/src/java/org/apache/commons/collections/keyvalue/MultiKey.java b/src/java/org/apache/commons/collections/keyvalue/MultiKey.java index a64433045..ebe75127e 100644 --- a/src/java/org/apache/commons/collections/keyvalue/MultiKey.java +++ b/src/java/org/apache/commons/collections/keyvalue/MultiKey.java @@ -249,29 +249,29 @@ public class MultiKey implements Serializable { return "MultiKey" + Arrays.asList(keys).toString(); } - /** - * Calculate the hash code of the instance using the provided keys. - * @param keys - */ - private void calculateHashCode(Object[] keys) - { - int total = 0; + /** + * Calculate the hash code of the instance using the provided keys. + * @param keys + */ + private void calculateHashCode(Object[] keys) + { + int total = 0; for (int i = 0; i < keys.length; i++) { if (keys[i] != null) { total ^= keys[i].hashCode(); } } hashCode = total; - } - - /** - * Recalculate the hash code after deserialization. The hash code of some - * keys might have change (hash codes based on the system hash code are - * only stable for the same process). - * @return the instance with recalculated hash code - */ - private Object readResolve() { - calculateHashCode(keys); - return this; - } + } + + /** + * Recalculate the hash code after deserialization. The hash code of some + * keys might have change (hash codes based on the system hash code are + * only stable for the same process). + * @return the instance with recalculated hash code + */ + private Object readResolve() { + calculateHashCode(keys); + return this; + } } diff --git a/src/test/org/apache/commons/collections/TestIteratorUtils.java b/src/test/org/apache/commons/collections/TestIteratorUtils.java index b61ddedd3..723030f3b 100644 --- a/src/test/org/apache/commons/collections/TestIteratorUtils.java +++ b/src/test/org/apache/commons/collections/TestIteratorUtils.java @@ -563,9 +563,9 @@ public class TestIteratorUtils extends BulkTest { } //----------------------------------------------------------------------- - /** - * Test next() and hasNext() for an immutable Iterator. - */ + /** + * Test next() and hasNext() for an immutable Iterator. + */ public void testUnmodifiableIteratorIteration() { Iterator iterator = getImmutableIterator(); @@ -669,7 +669,7 @@ public class TestIteratorUtils extends BulkTest { * Test remove() for an immutable ListIterator. */ public void testUnmodifiableListIteratorImmutability() { - ListIterator listIterator = getImmutableListIterator(); + ListIterator listIterator = getImmutableListIterator(); try { listIterator.remove(); diff --git a/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java b/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java index 645628fd5..3ba3552c0 100644 --- a/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java +++ b/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java @@ -202,16 +202,16 @@ public abstract class AbstractTestComparator extends AbstractTestObject { // test to make sure the canonical form has been preserved try { comparator = (Comparator) readExternalFormFromDisk(getCanonicalComparatorName(makeComparator())); - } catch (FileNotFoundException exception) { + } catch (FileNotFoundException exception) { boolean autoCreateSerialized = false; - if(autoCreateSerialized) { - comparator = makeComparator(); - 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 SVN): " + fileName); + if(autoCreateSerialized) { + comparator = makeComparator(); + 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 SVN): " + fileName); } else { fail("The Serialized form could be located to test serialization " + "compatibility: " + exception.getMessage()); diff --git a/src/test/org/apache/commons/collections/comparators/TestNullComparator.java b/src/test/org/apache/commons/collections/comparators/TestNullComparator.java index 5375bf73f..575d70d53 100644 --- a/src/test/org/apache/commons/collections/comparators/TestNullComparator.java +++ b/src/test/org/apache/commons/collections/comparators/TestNullComparator.java @@ -48,28 +48,28 @@ public abstract class TestNullComparator extends AbstractTestComparator { **/ public static class TestNullComparator1 extends TestNullComparator { - public TestNullComparator1(String testName) { - super(testName); - } + public TestNullComparator1(String testName) { + super(testName); + } public Comparator makeComparator() { - return new NullComparator(); - } - + return new NullComparator(); + } + public List getComparableObjectsOrdered() { List list = new LinkedList(); - list.add(new Integer(1)); - list.add(new Integer(2)); - list.add(new Integer(3)); - list.add(new Integer(4)); - list.add(new Integer(5)); - list.add(null); - return list; - } + list.add(new Integer(1)); + list.add(new Integer(2)); + list.add(new Integer(3)); + list.add(new Integer(4)); + list.add(new Integer(5)); + list.add(null); + return list; + } - public String getCanonicalComparatorName(Object object) { - return super.getCanonicalComparatorName(object) + "1"; - } + public String getCanonicalComparatorName(Object object) { + return super.getCanonicalComparatorName(object) + "1"; + } } /** diff --git a/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java b/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java index ed7114c3e..87128be32 100644 --- a/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java +++ b/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java @@ -102,12 +102,12 @@ public class TestSingletonListIterator extends AbstractTestListIterator { assertEquals( "Iteration next index", 1, iter.nextIndex() ); assertEquals( "Iteration previous index", 0, iter.previousIndex() ); - try { - iter.next(); - } catch (Exception e) { - assertTrue("NoSuchElementException must be thrown", - e.getClass().equals((new NoSuchElementException()).getClass())); - } + try { + iter.next(); + } catch (Exception e) { + assertTrue("NoSuchElementException must be thrown", + e.getClass().equals((new NoSuchElementException()).getClass())); + } iter.previous(); try { iter.previous(); diff --git a/src/test/org/apache/commons/collections/keyvalue/TestMultiKey.java b/src/test/org/apache/commons/collections/keyvalue/TestMultiKey.java index cad4ec9ec..e247bbbee 100644 --- a/src/test/org/apache/commons/collections/keyvalue/TestMultiKey.java +++ b/src/test/org/apache/commons/collections/keyvalue/TestMultiKey.java @@ -215,37 +215,37 @@ public class TestMultiKey extends TestCase { } static class SystemHashCodeSimulatingKey implements Serializable { - - private static final long serialVersionUID = 1L; - private final String name; - private int hashCode = 1; - public SystemHashCodeSimulatingKey(String name) - { - this.name = name; - } + private static final long serialVersionUID = 1L; + private final String name; + private int hashCode = 1; - public boolean equals(Object obj) - { - return obj instanceof SystemHashCodeSimulatingKey - && name.equals(((SystemHashCodeSimulatingKey)obj).name); - } + public SystemHashCodeSimulatingKey(String name) + { + this.name = name; + } - public int hashCode() - { - return hashCode; - } + public boolean equals(Object obj) + { + return obj instanceof SystemHashCodeSimulatingKey + && name.equals(((SystemHashCodeSimulatingKey)obj).name); + } - private Object readResolve() { - hashCode=2; // simulate different hashCode after deserialization in another process - return this; - } + public int hashCode() + { + return hashCode; + } + + private Object readResolve() { + hashCode=2; // simulate different hashCode after deserialization in another process + return this; + } } public void testEqualsAfterSerialization() throws IOException, ClassNotFoundException - { + { SystemHashCodeSimulatingKey sysKey = new SystemHashCodeSimulatingKey("test"); - MultiKey mk = new MultiKey(ONE, sysKey); + MultiKey mk = new MultiKey(ONE, sysKey); Map map = new HashMap(); map.put(mk, TWO); @@ -266,6 +266,6 @@ public class TestMultiKey extends TestCase { assertEquals(2, sysKey.hashCode()); // different hashCode now MultiKey mk2 = new MultiKey(ONE, sysKey); - assertEquals(TWO, map2.get(mk2)); - } + assertEquals(TWO, map2.get(mk2)); + } } diff --git a/src/test/org/apache/commons/collections/list/TestTreeList.java b/src/test/org/apache/commons/collections/list/TestTreeList.java index d3ae8b929..12b70983f 100644 --- a/src/test/org/apache/commons/collections/list/TestTreeList.java +++ b/src/test/org/apache/commons/collections/list/TestTreeList.java @@ -33,9 +33,9 @@ import org.apache.commons.collections.BulkTest; */ public class TestTreeList extends AbstractTestList { - public TestTreeList(String name) { - super(name); - } + public TestTreeList(String name) { + super(name); + } public static void main(String[] args) { junit.textui.TestRunner.run(suite()); @@ -105,72 +105,72 @@ public class TestTreeList extends AbstractTestList { } //----------------------------------------------------------------------- - public List makeEmptyList() { - return new TreeList(); - } + public List makeEmptyList() { + return new TreeList(); + } //----------------------------------------------------------------------- - public void testAddMultiple() { - List l = makeEmptyList(); - l.add("hugo"); - l.add("erna"); - l.add("daniel"); - l.add("andres"); - l.add("harald"); - l.add(0, null); - assertEquals(null, l.get(0)); - assertEquals("hugo", l.get(1)); - assertEquals("erna", l.get(2)); - assertEquals("daniel", l.get(3)); - assertEquals("andres", l.get(4)); - assertEquals("harald", l.get(5)); - } + public void testAddMultiple() { + List l = makeEmptyList(); + l.add("hugo"); + l.add("erna"); + l.add("daniel"); + l.add("andres"); + l.add("harald"); + l.add(0, null); + assertEquals(null, l.get(0)); + assertEquals("hugo", l.get(1)); + assertEquals("erna", l.get(2)); + assertEquals("daniel", l.get(3)); + assertEquals("andres", l.get(4)); + assertEquals("harald", l.get(5)); + } - public void testRemove() { - List l = makeEmptyList(); - l.add("hugo"); - l.add("erna"); - l.add("daniel"); - l.add("andres"); - l.add("harald"); - l.add(0, null); - int i = 0; - assertEquals(null, l.get(i++)); - assertEquals("hugo", l.get(i++)); - assertEquals("erna", l.get(i++)); - assertEquals("daniel", l.get(i++)); - assertEquals("andres", l.get(i++)); - assertEquals("harald", l.get(i++)); + public void testRemove() { + List l = makeEmptyList(); + l.add("hugo"); + l.add("erna"); + l.add("daniel"); + l.add("andres"); + l.add("harald"); + l.add(0, null); + int i = 0; + assertEquals(null, l.get(i++)); + assertEquals("hugo", l.get(i++)); + assertEquals("erna", l.get(i++)); + assertEquals("daniel", l.get(i++)); + assertEquals("andres", l.get(i++)); + assertEquals("harald", l.get(i++)); - l.remove(0); - i = 0; - assertEquals("hugo", l.get(i++)); - assertEquals("erna", l.get(i++)); - assertEquals("daniel", l.get(i++)); - assertEquals("andres", l.get(i++)); - assertEquals("harald", l.get(i++)); + l.remove(0); + i = 0; + assertEquals("hugo", l.get(i++)); + assertEquals("erna", l.get(i++)); + assertEquals("daniel", l.get(i++)); + assertEquals("andres", l.get(i++)); + assertEquals("harald", l.get(i++)); - i = 0; - l.remove(1); - assertEquals("hugo", l.get(i++)); - assertEquals("daniel", l.get(i++)); - assertEquals("andres", l.get(i++)); - assertEquals("harald", l.get(i++)); + i = 0; + l.remove(1); + assertEquals("hugo", l.get(i++)); + assertEquals("daniel", l.get(i++)); + assertEquals("andres", l.get(i++)); + assertEquals("harald", l.get(i++)); - i = 0; - l.remove(2); - assertEquals("hugo", l.get(i++)); - assertEquals("daniel", l.get(i++)); - assertEquals("harald", l.get(i++)); - } + i = 0; + l.remove(2); + assertEquals("hugo", l.get(i++)); + assertEquals("daniel", l.get(i++)); + assertEquals("harald", l.get(i++)); + } - public void testInsertBefore() { - List l = makeEmptyList(); - l.add("erna"); - l.add(0, "hugo"); - assertEquals("hugo", l.get(0)); - assertEquals("erna", l.get(1)); - } + public void testInsertBefore() { + List l = makeEmptyList(); + l.add("erna"); + l.add(0, "hugo"); + assertEquals("hugo", l.get(0)); + assertEquals("erna", l.get(1)); + } public void testIndexOf() { List l = makeEmptyList();