Tab police git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/branches/collections_jdk5_branch@814044 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/commons-collections/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-collections/commit/8c2bb85d Tree: http://git-wip-us.apache.org/repos/asf/commons-collections/tree/8c2bb85d Diff: http://git-wip-us.apache.org/repos/asf/commons-collections/diff/8c2bb85d Branch: refs/heads/collections_jdk5_branch Commit: 8c2bb85d468aaa4fdf06cca4f9cf49a916c62e3a Parents: a944755 Author: Sebastian Bazley <s...@apache.org> Authored: Fri Sep 11 21:48:16 2009 +0000 Committer: Sebastian Bazley <s...@apache.org> Committed: Fri Sep 11 21:48:16 2009 +0000 ---------------------------------------------------------------------- .../commons/collections/CollectionUtils.java | 8 +- .../commons/collections/PredicateUtils.java | 2 +- .../collections/comparators/NullComparator.java | 2 +- .../collections/iterators/ArrayIterator.java | 4 +- .../iterators/ArrayListIterator.java | 2 +- .../iterators/ObjectArrayListIterator.java | 2 +- .../iterators/ObjectGraphIterator.java | 4 +- .../iterators/SingletonIterator.java | 2 +- .../commons/collections/map/CompositeMap.java | 52 ++++----- .../apache/commons/collections/map/LazyMap.java | 28 ++--- .../commons/collections/map/LazySortedMap.java | 32 +++--- .../commons/collections/MockTestCase.java | 56 ++++----- .../commons/collections/TestAllPackages.java | 2 +- .../collections/TestCollectionUtils.java | 10 +- .../commons/collections/TestIteratorUtils.java | 8 +- .../comparators/AbstractTestComparator.java | 12 +- .../comparators/TestNullComparator.java | 32 +++--- .../iterators/TestSingletonListIterator.java | 12 +- .../commons/collections/list/TestTreeList.java | 114 +++++++++---------- .../apache/commons/collections/map/TestAll.java | 2 +- .../commons/collections/map/TestLazyMap.java | 28 ++--- .../collections/map/TestLazySortedMap.java | 12 +- .../commons/collections/splitmap/TestAll.java | 2 +- 23 files changed, 214 insertions(+), 214 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/CollectionUtils.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/CollectionUtils.java b/src/java/org/apache/commons/collections/CollectionUtils.java index 89b06e4..3da722b 100644 --- a/src/java/org/apache/commons/collections/CollectionUtils.java +++ b/src/java/org/apache/commons/collections/CollectionUtils.java @@ -128,7 +128,7 @@ public class CollectionUtils { * undesirable. This implementation only implements Collection. */ @SuppressWarnings("unchecked") - public static final Collection EMPTY_COLLECTION = UnmodifiableCollection.decorate(new ArrayList<Object>()); + public static final Collection EMPTY_COLLECTION = UnmodifiableCollection.decorate(new ArrayList<Object>()); /** * <code>CollectionUtils</code> should not normally be instantiated. @@ -845,7 +845,7 @@ public class CollectionUtils { */ public static <T> T get(Iterator<T> iterator, int index) { int i = index; - checkIndexBounds(i); + checkIndexBounds(i); while (iterator.hasNext()) { i--; if (i == -1) { @@ -919,7 +919,7 @@ public class CollectionUtils { */ public static Object get(Object object, int index) { int i = index; - if (i < 0) { + if (i < 0) { throw new IndexOutOfBoundsException("Index cannot be negative: " + i); } if (object instanceof Map) { @@ -935,7 +935,7 @@ public class CollectionUtils { if (i == -1) { return it.next(); } - it.next(); + it.next(); } throw new IndexOutOfBoundsException("Entry does not exist: " + i); } else if (object instanceof Collection) { http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/PredicateUtils.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/PredicateUtils.java b/src/java/org/apache/commons/collections/PredicateUtils.java index c2b557b..d5185f9 100644 --- a/src/java/org/apache/commons/collections/PredicateUtils.java +++ b/src/java/org/apache/commons/collections/PredicateUtils.java @@ -538,7 +538,7 @@ public class PredicateUtils { * @param predicate the predicate to call with the result of the transform * @return the predicate * @throws IllegalArgumentException if the transformer or the predicate is null - * @since Commons Collections 3.1 + * @since Commons Collections 3.1 */ public static <T> Predicate<T> transformedPredicate( Transformer<? super T, ? extends T> transformer, Predicate<? super T> predicate) { http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/comparators/NullComparator.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/comparators/NullComparator.java b/src/java/org/apache/commons/collections/comparators/NullComparator.java index ea2c5a1..3262426 100644 --- a/src/java/org/apache/commons/collections/comparators/NullComparator.java +++ b/src/java/org/apache/commons/collections/comparators/NullComparator.java @@ -172,7 +172,7 @@ public class NullComparator<E> implements Comparator<E>, Serializable { if(!obj.getClass().equals(this.getClass())) { return false; } NullComparator<?> other = (NullComparator<?>) obj; - + return ((this.nullsAreHigh == other.nullsAreHigh) && (this.nonNullComparator.equals(other.nonNullComparator))); } http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/iterators/ArrayIterator.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/iterators/ArrayIterator.java b/src/java/org/apache/commons/collections/iterators/ArrayIterator.java index 809101c..42e9528 100644 --- a/src/java/org/apache/commons/collections/iterators/ArrayIterator.java +++ b/src/java/org/apache/commons/collections/iterators/ArrayIterator.java @@ -48,9 +48,9 @@ public class ArrayIterator<E> implements ResettableIterator<E> { /** The start index to loop from */ protected int startIndex = 0; /** The end index to loop to */ - protected int endIndex = 0; + protected int endIndex = 0; /** The current iterator index */ - protected int index = 0; + protected int index = 0; // Constructors // ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java b/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java index 159bcc2..55662d8 100644 --- a/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java +++ b/src/java/org/apache/commons/collections/iterators/ArrayListIterator.java @@ -45,7 +45,7 @@ import org.apache.commons.collections.ResettableListIterator; * @author Phil Steitz */ public class ArrayListIterator<E> extends ArrayIterator<E> - implements ListIterator<E>, ResettableListIterator<E> { + implements ListIterator<E>, ResettableListIterator<E> { /** * Holds the index of the last item returned by a call to <code>next()</code> http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java b/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java index 113fba6..fffb599 100644 --- a/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java +++ b/src/java/org/apache/commons/collections/iterators/ObjectArrayListIterator.java @@ -42,7 +42,7 @@ import org.apache.commons.collections.ResettableListIterator; * @author Phil Steitz */ public class ObjectArrayListIterator<E> extends ObjectArrayIterator<E> - implements ListIterator<E>, ResettableListIterator<E> { + implements ListIterator<E>, ResettableListIterator<E> { /** * Holds the index of the last item returned by a call to <code>next()</code> http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/iterators/ObjectGraphIterator.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/iterators/ObjectGraphIterator.java b/src/java/org/apache/commons/collections/iterators/ObjectGraphIterator.java index a43a876..3926f11 100644 --- a/src/java/org/apache/commons/collections/iterators/ObjectGraphIterator.java +++ b/src/java/org/apache/commons/collections/iterators/ObjectGraphIterator.java @@ -79,7 +79,7 @@ public class ObjectGraphIterator<E> implements Iterator<E> { /** The stack of iterators */ protected final ArrayStack<Iterator<? extends E>> stack = new ArrayStack<Iterator<? extends E>>(8); - /** The root object in the tree */ + /** The root object in the tree */ protected E root; /** The transformer to use */ protected Transformer<? super E, ? extends E> transformer; @@ -198,7 +198,7 @@ public class ObjectGraphIterator<E> implements Iterator<E> { // all iterators exhausted } else { // current iterator exhausted, go up a level - currentIterator = (Iterator<? extends E>) stack.pop(); + currentIterator = stack.pop(); findNextByIterator(currentIterator); } } http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/iterators/SingletonIterator.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/iterators/SingletonIterator.java b/src/java/org/apache/commons/collections/iterators/SingletonIterator.java index a1b8c31..e6145f2 100644 --- a/src/java/org/apache/commons/collections/iterators/SingletonIterator.java +++ b/src/java/org/apache/commons/collections/iterators/SingletonIterator.java @@ -33,7 +33,7 @@ import org.apache.commons.collections.ResettableIterator; * @author Rodney Waldhoff */ public class SingletonIterator<E> - implements Iterator<E>, ResettableIterator<E> { + implements Iterator<E>, ResettableIterator<E> { /** Whether remove is allowed */ private final boolean removeAllowed; http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/map/CompositeMap.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/map/CompositeMap.java b/src/java/org/apache/commons/collections/map/CompositeMap.java index 432e492..05c5469 100644 --- a/src/java/org/apache/commons/collections/map/CompositeMap.java +++ b/src/java/org/apache/commons/collections/map/CompositeMap.java @@ -188,7 +188,7 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> { * key. * * @throws ClassCastException if the key is of an inappropriate type for - * this map (optional). + * this map (optional). * @throws NullPointerException if the key is <tt>null</tt> and this map * does not not permit <tt>null</tt> keys (optional). */ @@ -213,7 +213,7 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> { * @return <tt>true</tt> if this map maps one or more keys to the * specified value. * @throws ClassCastException if the value is of an inappropriate type for - * this map (optional). + * this map (optional). * @throws NullPointerException if the value is <tt>null</tt> and this map * does not not permit <tt>null</tt> values (optional). */ @@ -246,7 +246,7 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> { public Set<Map.Entry<K, V>> entrySet() { CompositeSet<Map.Entry<K, V>> entries = new CompositeSet<Map.Entry<K,V>>(); for (int i = composite.length - 1; i >= 0; --i) { - entries.addComposited((Collection<Map.Entry<K, V>>) composite[i].entrySet()); + entries.addComposited(composite[i].entrySet()); } return entries; } @@ -266,12 +266,12 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> { * * @param key key whose associated value is to be returned. * @return the value to which this map maps the specified key, or - * <tt>null</tt> if the map contains no mapping for this key. + * <tt>null</tt> if the map contains no mapping for this key. * * @throws ClassCastException if the key is of an inappropriate type for - * this map (optional). + * this map (optional). * @throws NullPointerException key is <tt>null</tt> and this map does not - * not permit <tt>null</tt> keys (optional). + * not permit <tt>null</tt> keys (optional). * * @see #containsKey(Object) */ @@ -332,16 +332,16 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> { * @param key key with which the specified value is to be associated. * @param value value to be associated with the specified key. * @return previous value associated with specified key, or <tt>null</tt> - * if there was no mapping for key. A <tt>null</tt> return can - * also indicate that the map previously associated <tt>null</tt> - * with the specified key, if the implementation supports - * <tt>null</tt> values. + * if there was no mapping for key. A <tt>null</tt> return can + * also indicate that the map previously associated <tt>null</tt> + * with the specified key, if the implementation supports + * <tt>null</tt> values. * * @throws UnsupportedOperationException if no MapMutator has been specified * @throws ClassCastException if the class of the specified key or value - * prevents it from being stored in this map. + * prevents it from being stored in this map. * @throws IllegalArgumentException if some aspect of this key or value - * prevents it from being stored in this map. + * prevents it from being stored in this map. * @throws NullPointerException this map does not permit <tt>null</tt> * keys or values, and the specified key or value is * <tt>null</tt>. @@ -364,13 +364,13 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> { * @param map Mappings to be stored in this map. * * @throws UnsupportedOperationException if the <tt>putAll</tt> method is - * not supported by this map. + * not supported by this map. * * @throws ClassCastException if the class of a key or value in the - * specified map prevents it from being stored in this map. + * specified map prevents it from being stored in this map. * * @throws IllegalArgumentException some aspect of a key or value in the - * specified map prevents it from being stored in this map. + * specified map prevents it from being stored in this map. * @throws NullPointerException the specified map is <tt>null</tt>, or if * this map does not permit <tt>null</tt> keys or values, and the * specified map contains <tt>null</tt> keys or values. @@ -398,10 +398,10 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> { * * @param key key whose mapping is to be removed from the map. * @return previous value associated with specified key, or <tt>null</tt> - * if there was no mapping for key. + * if there was no mapping for key. * * @throws ClassCastException if the key is of an inappropriate type for - * the composited map (optional). + * the composited map (optional). * @throws NullPointerException if the key is <tt>null</tt> and the composited map * does not not permit <tt>null</tt> keys (optional). * @throws UnsupportedOperationException if the <tt>remove</tt> method is @@ -447,7 +447,7 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> { public Collection<V> values() { CompositeCollection<V> values = new CompositeCollection<V>(); for (int i = composite.length - 1; i >= 0; --i) { - values.addComposited((Collection<V>) composite[i].values()); + values.addComposited(composite[i].values()); } return values; } @@ -505,16 +505,16 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> { * @param key key with which the specified value is to be associated. * @param value value to be associated with the specified key. * @return previous value associated with specified key, or <tt>null</tt> - * if there was no mapping for key. A <tt>null</tt> return can - * also indicate that the map previously associated <tt>null</tt> - * with the specified key, if the implementation supports - * <tt>null</tt> values. + * if there was no mapping for key. A <tt>null</tt> return can + * also indicate that the map previously associated <tt>null</tt> + * with the specified key, if the implementation supports + * <tt>null</tt> values. * * @throws UnsupportedOperationException if not defined * @throws ClassCastException if the class of the specified key or value - * prevents it from being stored in this map. + * prevents it from being stored in this map. * @throws IllegalArgumentException if some aspect of this key or value - * prevents it from being stored in this map. + * prevents it from being stored in this map. * @throws NullPointerException this map does not permit <tt>null</tt> * keys or values, and the specified key or value is * <tt>null</tt>. @@ -530,9 +530,9 @@ public class CompositeMap<K, V> extends AbstractIterableMap<K, V> { * * @throws UnsupportedOperationException if not defined * @throws ClassCastException if the class of the specified key or value - * prevents it from being stored in this map. + * prevents it from being stored in this map. * @throws IllegalArgumentException if some aspect of this key or value - * prevents it from being stored in this map. + * prevents it from being stored in this map. * @throws NullPointerException this map does not permit <tt>null</tt> * keys or values, and the specified key or value is * <tt>null</tt>. http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/map/LazyMap.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/map/LazyMap.java b/src/java/org/apache/commons/collections/map/LazyMap.java index db0f565..d84ff71 100644 --- a/src/java/org/apache/commons/collections/map/LazyMap.java +++ b/src/java/org/apache/commons/collections/map/LazyMap.java @@ -91,8 +91,8 @@ public class LazyMap<K, V> extends AbstractMapDecorator<K, V> implements Map<K, * @throws IllegalArgumentException if map or factory is null */ public static <K, V> LazyMap<K, V> getLazyMap(Map<K, V> map, Factory< ? extends V> factory) { - return new LazyMap<K,V>(map, factory); - } + return new LazyMap<K,V>(map, factory); + } /** * Factory method to create a lazily instantiated map. @@ -102,21 +102,21 @@ public class LazyMap<K, V> extends AbstractMapDecorator<K, V> implements Map<K, * @throws IllegalArgumentException if map or factory is null * @deprecated use {@link #getLazyMap(Map, Transformer)} instead. */ - @Deprecated + @Deprecated public static <K,V> Map<K,V> decorate(Map<K,V> map, Transformer<? super K, ? extends V> factory) { return getLazyMap(map, factory); } - /** + /** * Factory method to create a lazily instantiated map. * * @param map the map to decorate, must not be null * @param factory the factory to use, must not be null * @throws IllegalArgumentException if map or factory is null */ - public static <V, K> LazyMap<K, V> getLazyMap(Map<K, V> map, Transformer<? super K, ? extends V> factory) { - return new LazyMap<K,V>(map, factory); - } + public static <V, K> LazyMap<K, V> getLazyMap(Map<K, V> map, Transformer<? super K, ? extends V> factory) { + return new LazyMap<K,V>(map, factory); + } //----------------------------------------------------------------------- /** @@ -171,17 +171,17 @@ public class LazyMap<K, V> extends AbstractMapDecorator<K, V> implements Map<K, * @since Commons Collections 3.1 */ @SuppressWarnings("unchecked") - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { + private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); map = (Map) in.readObject(); } //----------------------------------------------------------------------- @Override - public V get(Object key) { + public V get(Object key) { // create value for key if key is not currently in the map if (map.containsKey(key) == false) { - K castKey = cast(key); + K castKey = cast(key); V value = factory.transform(castKey); map.put(castKey, value); return value; @@ -195,10 +195,10 @@ public class LazyMap<K, V> extends AbstractMapDecorator<K, V> implements Map<K, * @param key . * @return the cast key. */ - @SuppressWarnings("unchecked") - private K cast(Object key) { - return (K) key; - } + @SuppressWarnings("unchecked") + private K cast(Object key) { + return (K) key; + } // no need to wrap keySet, entrySet or values as they are views of // existing map entries - you can't do a map-style get on them. http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/java/org/apache/commons/collections/map/LazySortedMap.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/commons/collections/map/LazySortedMap.java b/src/java/org/apache/commons/collections/map/LazySortedMap.java index ff56d0b..0cada69 100644 --- a/src/java/org/apache/commons/collections/map/LazySortedMap.java +++ b/src/java/org/apache/commons/collections/map/LazySortedMap.java @@ -85,19 +85,19 @@ public class LazySortedMap<K,V> * @param factory the factory to use, must not be null * @throws IllegalArgumentException if map or factory is null */ - public static <K, V> SortedMap<K, V> getLazySortedMap(SortedMap<K, V> map, Factory<? extends V> factory) { - return new LazySortedMap<K,V>(map, factory); - } - - /** - * Factory method to create a lazily instantiated sorted map. - * - * @param map the map to decorate, must not be null - * @param factory the factory to use, must not be null - * @throws IllegalArgumentException if map or factory is null - * @deprecated - */ - @Deprecated + public static <K, V> SortedMap<K, V> getLazySortedMap(SortedMap<K, V> map, Factory<? extends V> factory) { + return new LazySortedMap<K,V>(map, factory); + } + + /** + * Factory method to create a lazily instantiated sorted map. + * + * @param map the map to decorate, must not be null + * @param factory the factory to use, must not be null + * @throws IllegalArgumentException if map or factory is null + * @deprecated + */ + @Deprecated public static <K,V> SortedMap<K,V> decorate(SortedMap<K,V> map, Transformer<? super K, ? extends V> factory) { return getLazySortedMap(map, factory); } @@ -109,9 +109,9 @@ public class LazySortedMap<K,V> * @param factory the factory to use, must not be null * @throws IllegalArgumentException if map or factory is null */ - public static <K, V> SortedMap<K, V> getLazySortedMap(SortedMap<K, V> map, Transformer<? super K, ? extends V> factory) { - return new LazySortedMap<K,V>(map, factory); - } + public static <K, V> SortedMap<K, V> getLazySortedMap(SortedMap<K, V> map, Transformer<? super K, ? extends V> factory) { + return new LazySortedMap<K,V>(map, factory); + } //----------------------------------------------------------------------- /** http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/MockTestCase.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/MockTestCase.java b/src/test/org/apache/commons/collections/MockTestCase.java index 9362fcd..7a3e48c 100644 --- a/src/test/org/apache/commons/collections/MockTestCase.java +++ b/src/test/org/apache/commons/collections/MockTestCase.java @@ -31,37 +31,37 @@ import org.easymock.IExpectationSetters; * @author Stephen Kestle */ public abstract class MockTestCase { - private List<Object> mockObjects = new ArrayList<Object>(); + private List<Object> mockObjects = new ArrayList<Object>(); - @SuppressWarnings("unchecked") - protected <T> T createMock(Class name) { - T mock = (T) EasyMock.createMock(name); - return registerMock(mock); - } + @SuppressWarnings("unchecked") + protected <T> T createMock(Class name) { + T mock = (T) EasyMock.createMock(name); + return registerMock(mock); + } - private <T> T registerMock(T mock) { - mockObjects.add(mock); - return mock; - } + private <T> T registerMock(T mock) { + mockObjects.add(mock); + return mock; + } - protected <T> IExpectationSetters<T> expect(T t) { - return EasyMock.expect(t); - } + protected <T> IExpectationSetters<T> expect(T t) { + return EasyMock.expect(t); + } - protected final void replay() { - for (Object o : mockObjects) { - EasyMock.replay(o); - } - } + protected final void replay() { + for (Object o : mockObjects) { + EasyMock.replay(o); + } + } - protected final void verify() { - for (ListIterator<Object> i = mockObjects.listIterator(); i.hasNext();) { - try { - EasyMock.verify(i.next()); - } catch (AssertionError e) { - throw new AssertionError((i.previousIndex() + 1) + "" - + e.getMessage()); - } - } - } + protected final void verify() { + for (ListIterator<Object> i = mockObjects.listIterator(); i.hasNext();) { + try { + EasyMock.verify(i.next()); + } catch (AssertionError e) { + throw new AssertionError((i.previousIndex() + 1) + "" + + e.getMessage()); + } + } + } } http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/TestAllPackages.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/TestAllPackages.java b/src/test/org/apache/commons/collections/TestAllPackages.java index a67ca5a..48ec3d6 100644 --- a/src/test/org/apache/commons/collections/TestAllPackages.java +++ b/src/test/org/apache/commons/collections/TestAllPackages.java @@ -30,7 +30,7 @@ import org.junit.runners.Suite.SuiteClasses; */ @RunWith(Suite.class) @SuiteClasses({ - org.apache.commons.collections.TestAll.class, + org.apache.commons.collections.TestAll.class, org.apache.commons.collections.bag.TestAll.class, org.apache.commons.collections.bidimap.TestAll.class, org.apache.commons.collections.buffer.TestAll.class, http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/TestCollectionUtils.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/TestCollectionUtils.java b/src/test/org/apache/commons/collections/TestCollectionUtils.java index 6d102fb..547c7b5 100644 --- a/src/test/org/apache/commons/collections/TestCollectionUtils.java +++ b/src/test/org/apache/commons/collections/TestCollectionUtils.java @@ -875,7 +875,7 @@ public class TestCollectionUtils extends MockTestCase { //Up to here @SuppressWarnings("cast") - @Test + @Test public void filter() { List<Integer> ints = new ArrayList<Integer>(); ints.add(1); @@ -1396,10 +1396,10 @@ public class TestCollectionUtils extends MockTestCase { } /** - * TODO: Should {@link CollectionUtils} be able to be extended? If it is extended, subclasses must 'override' the static methods with - * call-throughs anyhow, otherwise java compiler warnings will result - */ - @Test + * TODO: Should {@link CollectionUtils} be able to be extended? If it is extended, subclasses must 'override' the static methods with + * call-throughs anyhow, otherwise java compiler warnings will result + */ + @Test public void ensureCollectionUtilsCanBeExtended() { new CollectionUtils() {}; } http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/TestIteratorUtils.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/TestIteratorUtils.java b/src/test/org/apache/commons/collections/TestIteratorUtils.java index dc24155..6b797b5 100644 --- a/src/test/org/apache/commons/collections/TestIteratorUtils.java +++ b/src/test/org/apache/commons/collections/TestIteratorUtils.java @@ -566,9 +566,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<String> iterator = getImmutableIterator(); @@ -672,7 +672,7 @@ public class TestIteratorUtils extends BulkTest { * Test remove() for an immutable ListIterator. */ public void testUnmodifiableListIteratorImmutability() { - ListIterator<String> listIterator = getImmutableListIterator(); + ListIterator<String> listIterator = getImmutableListIterator(); try { listIterator.remove(); http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java b/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java index 3c95033..3ebe3eb 100644 --- a/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java +++ b/src/test/org/apache/commons/collections/comparators/AbstractTestComparator.java @@ -192,15 +192,15 @@ public abstract class AbstractTestComparator<T> extends AbstractTestObject { // test to make sure the canonical form has been preserved try { comparator = (Comparator<T>) readExternalFormFromDisk(getCanonicalComparatorName(makeObject())); - } catch (FileNotFoundException exception) { + } catch (FileNotFoundException exception) { boolean autoCreateSerialized = false; - if (autoCreateSerialized) { - comparator = makeObject(); - String fileName = getCanonicalComparatorName(comparator); - writeExternalFormToDisk((Serializable) comparator, fileName); - fail("Serialized form could not be found. A serialized version " + if (autoCreateSerialized) { + comparator = makeObject(); + 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); } else { fail("The Serialized form could be located to test serialization " http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/comparators/TestNullComparator.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/comparators/TestNullComparator.java b/src/test/org/apache/commons/collections/comparators/TestNullComparator.java index c57f25d..14ffe77 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<Integer> **/ public static class TestNullComparator1 extends TestNullComparator { - public TestNullComparator1(String testName) { - super(testName); - } + public TestNullComparator1(String testName) { + super(testName); + } public Comparator<Integer> makeObject() { - return new NullComparator<Integer>(); - } + return new NullComparator<Integer>(); + } public List<Integer> getComparableObjectsOrdered() { List<Integer> list = new LinkedList<Integer>(); - 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"; + } } /** http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java b/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java index 2132302..3cbf500 100644 --- a/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java +++ b/src/test/org/apache/commons/collections/iterators/TestSingletonListIterator.java @@ -103,12 +103,12 @@ public class TestSingletonListIterator<E> extends AbstractTestListIterator<E> { 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(); http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/list/TestTreeList.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/list/TestTreeList.java b/src/test/org/apache/commons/collections/list/TestTreeList.java index 22381ad..9d950ac 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<E> extends AbstractTestList<E> { - public TestTreeList(String name) { - super(name); - } + public TestTreeList(String name) { + super(name); + } public static void main(String[] args) { junit.textui.TestRunner.run(suite()); @@ -105,29 +105,29 @@ public class TestTreeList<E> extends AbstractTestList<E> { } //----------------------------------------------------------------------- - public TreeList<E> makeObject() { - return new TreeList<E>(); - } + public TreeList<E> makeObject() { + return new TreeList<E>(); + } //----------------------------------------------------------------------- - @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked") public void testAddMultiple() { - List<E> l = makeObject(); - l.add((E) "hugo"); - l.add((E) "erna"); - l.add((E) "daniel"); - l.add((E) "andres"); - l.add((E) "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)); - } - - @SuppressWarnings("unchecked") + List<E> l = makeObject(); + l.add((E) "hugo"); + l.add((E) "erna"); + l.add((E) "daniel"); + l.add((E) "andres"); + l.add((E) "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)); + } + + @SuppressWarnings("unchecked") public void testRemove() { List<E> l = makeObject(); l.add((E) "hugo"); @@ -136,44 +136,44 @@ public class TestTreeList<E> extends AbstractTestList<E> { l.add((E) "andres"); l.add((E) "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++)); - - 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++)); - } - - @SuppressWarnings("unchecked") + 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++)); + + 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++)); + } + + @SuppressWarnings("unchecked") public void testInsertBefore() { List<E> l = makeObject(); l.add((E) "erna"); l.add(0, (E) "hugo"); - assertEquals("hugo", l.get(0)); - assertEquals("erna", l.get(1)); - } + assertEquals("hugo", l.get(0)); + assertEquals("erna", l.get(1)); + } @SuppressWarnings("unchecked") public void testIndexOf() { http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/map/TestAll.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/map/TestAll.java b/src/test/org/apache/commons/collections/map/TestAll.java index 7df3d66..711b089 100644 --- a/src/test/org/apache/commons/collections/map/TestAll.java +++ b/src/test/org/apache/commons/collections/map/TestAll.java @@ -33,7 +33,7 @@ import org.junit.runners.Suite.SuiteClasses; */ @RunWith(Suite.class) @SuiteClasses({ - TestCaseInsensitiveMap.class, + TestCaseInsensitiveMap.class, TestCompositeMap.class, TestDefaultedMap.class, TestFlat3Map.class, http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/map/TestLazyMap.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/map/TestLazyMap.java b/src/test/org/apache/commons/collections/map/TestLazyMap.java index c7042b2..1e51a3f 100644 --- a/src/test/org/apache/commons/collections/map/TestLazyMap.java +++ b/src/test/org/apache/commons/collections/map/TestLazyMap.java @@ -37,7 +37,7 @@ import org.junit.Test; */ public class TestLazyMap<K, V> extends AbstractTestIterableMap<K, V> { - private static final Factory<Integer> oneFactory = FactoryUtils.constantFactory(1); + private static final Factory<Integer> oneFactory = FactoryUtils.constantFactory(1); public TestLazyMap(String testName) { super(testName); @@ -49,14 +49,14 @@ public class TestLazyMap<K, V> extends AbstractTestIterableMap<K, V> { } @Override - public LazyMap<K,V> makeObject() { + public LazyMap<K,V> makeObject() { return getLazyMap(new HashMap<K,V>(), FactoryUtils.<V>nullFactory()); } //----------------------------------------------------------------------- @Override public void testMapGet() { - //TODO eliminate need for this via superclass - see svn history. + //TODO eliminate need for this via superclass - see svn history. } @Test @@ -79,21 +79,21 @@ public class TestLazyMap<K, V> extends AbstractTestIterableMap<K, V> { @Test public void mapGetWithTransformer() { - Transformer<Number, Integer> intConverter = new Transformer<Number, Integer>(){ - public Integer transform(Number input) { - return input.intValue(); - } - }; - Map<Long, Number> map = getLazyMap(new HashMap<Long,Number>(), intConverter ); - assertEquals(0, map.size()); - Number i1 = map.get(123L); - assertEquals(123, i1); - assertEquals(1, map.size()); + Transformer<Number, Integer> intConverter = new Transformer<Number, Integer>(){ + public Integer transform(Number input) { + return input.intValue(); + } + }; + Map<Long, Number> map = getLazyMap(new HashMap<Long,Number>(), intConverter ); + assertEquals(0, map.size()); + Number i1 = map.get(123L); + assertEquals(123, i1); + assertEquals(1, map.size()); } @Override - public String getCompatibilityVersion() { + public String getCompatibilityVersion() { return "3.1"; } http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/map/TestLazySortedMap.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/map/TestLazySortedMap.java b/src/test/org/apache/commons/collections/map/TestLazySortedMap.java index c4841c4..02ca1d4 100644 --- a/src/test/org/apache/commons/collections/map/TestLazySortedMap.java +++ b/src/test/org/apache/commons/collections/map/TestLazySortedMap.java @@ -40,7 +40,7 @@ import org.junit.Test; */ public class TestLazySortedMap<K, V> extends AbstractTestSortedMap<K, V> { - private static final Factory<Integer> oneFactory = FactoryUtils.constantFactory(1); + private static final Factory<Integer> oneFactory = FactoryUtils.constantFactory(1); public TestLazySortedMap(String testName) { super(testName); @@ -52,18 +52,18 @@ public class TestLazySortedMap<K, V> extends AbstractTestSortedMap<K, V> { } @Override - public SortedMap<K,V> makeObject() { + public SortedMap<K,V> makeObject() { return getLazySortedMap(new TreeMap<K,V>(), FactoryUtils.<V>nullFactory()); } @Override - public boolean isSubMapViewsSerializable() { + public boolean isSubMapViewsSerializable() { // TODO TreeMap sub map views have a bug in deserialization. return false; } @Override - public boolean isAllowNullKey() { + public boolean isAllowNullKey() { return false; } @@ -71,7 +71,7 @@ public class TestLazySortedMap<K, V> extends AbstractTestSortedMap<K, V> { //----------------------------------------------------------------------- @Override public void testMapGet() { - //TODO eliminate need for this via superclass - see svn history. + //TODO eliminate need for this via superclass - see svn history. } @Test @@ -128,7 +128,7 @@ public class TestLazySortedMap<K, V> extends AbstractTestSortedMap<K, V> { } @Override - public String getCompatibilityVersion() { + public String getCompatibilityVersion() { return "3.1"; } http://git-wip-us.apache.org/repos/asf/commons-collections/blob/8c2bb85d/src/test/org/apache/commons/collections/splitmap/TestAll.java ---------------------------------------------------------------------- diff --git a/src/test/org/apache/commons/collections/splitmap/TestAll.java b/src/test/org/apache/commons/collections/splitmap/TestAll.java index c3e54a4..005b1f2 100644 --- a/src/test/org/apache/commons/collections/splitmap/TestAll.java +++ b/src/test/org/apache/commons/collections/splitmap/TestAll.java @@ -36,7 +36,7 @@ import org.junit.runners.Suite.SuiteClasses; @RunWith(Suite.class) @SuiteClasses({ TestSplitMapUtils.class, - TestTransformedMap.class + TestTransformedMap.class }) public class TestAll extends TestCase { }