Submitted by: Paul Jack ( pjack at sfaf dot org ).
Needed to change Paul's implementation slightly to get things compile properly
using JDK 1.2. The 1.2 compiler thought that the "confirmed" field was
ambiguous in the anonymous inner class and thus needed to be qualified with a
ClassName.this. In order to do that, the anonymous inner classes needed to be
made named inner classes.
This change exposes one test failure for MultiHashMap that appears to be caused
by its values() method not being backed by the map (bug 9573).
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130725 13f79535-47bb-0310-9956-ffa450edef68
should use makeEmptySet and makeFullSet rather than their collection
counterparts.
Added getSet() and getConfirmedSet() methods which wrap the collection and
confirmed fixtures so that tests don't need to perform the cast to a Set.
Modified tests that used makeEmptySet and makeFullSet to use the fixture
getSet() along with resetEmpty() and resetFull(). This allows for more calls
to verify() to ensure that calls to methods that should not modify a
collection don't actually modify it.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130724 13f79535-47bb-0310-9956-ffa450edef68
complete Set contract. This will be used to test Set implementations and set
views of other collections (e.g. Map.entrySet() and Map.keySet()).
Submitted by: Paul Jack ( pjack at sfaf dot org ).
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130723 13f79535-47bb-0310-9956-ffa450edef68
Removed commented out tests for equals and hashCode (the collection contract
does not specify a specific contract on equals and hashCode), and added a
comment at the top of the class so that no one comes in later and re-adds the
test cases.
Removed dependence on HashBag. If HashBag has a bug, this may adversly affect
the tests that are using it. Reimplemented without using HashBag.
Modified tests that used makeFullCollection and makeCollection to use the
fixture field "collection" along with resetEmpty() and resetFull(). This
allowed for more calls to verify to ensure that calls to methods that should
not modify a collection don't actually modify it.
When removing using the iterator, an equivalent operation cannot really be
performed on the confirmed collection for verification. After some
investigation, changed the existing tests (tested for instances of Set, List
and Bag) to one that is a bit more generic: A new flag (that test subclasses
can override) which specifies whether the elements in the collection are
distinguishable from each other (and such that it might matter which element is
actually removed from the collection when the iterator's remove method is
called).
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130722 13f79535-47bb-0310-9956-ffa450edef68
will be used to test straight Collection implementations and for collection
views of other collections (e.g. Map.values()).
Submitted by: Paul Jack ( pjack at sfaf dot org ).
Changed TestBag to extend from TestObject instead of TestCollection since the
Bag contract conflicts with the Collection contract. This needs to be
addressed at some point.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130721 13f79535-47bb-0310-9956-ffa450edef68
testing collections, maps, etc., can be reused to test collections, maps,
etc. that are returned from other collections. For example, the Map interface
defines entrySet() which is supposed to return a valid Set. The framework
added here would allow the Set testing code to be used for testing Sets and the
set returned from Map's entrySet() method.
Submitted by: Paul Jack < pjack at sfaf dot org >
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130720 13f79535-47bb-0310-9956-ffa450edef68
This can help avoid folks having to use the o.a*.c*.collections.comparators package, providing nice simple static helper method instead along the same lines as java.util.Collections and CollectionUtils here.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130714 13f79535-47bb-0310-9956-ffa450edef68
when one didn't exist before. That is, if containsKey(foo) returns
false, then get(foo) will not change that.
Added serial version UID to maintain backwards compatibility. The auto
generated serialization UID differs from the released version because
of the addition of a new method.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130699 13f79535-47bb-0310-9956-ffa450edef68
"default map based implementation" and differs in design from the
AbstractSet, AbstractMap classes which do not make assumptions about
how they might be implemented. To be consistent with JDK AbstractX
collections, an AbstractBag class should just be providing default
implementations that could be used regardless of underlying storage
mechanism. For example, the add(Object) method would call the abstract
add(Object,int) method passing the object and 1. Since this
implementation assumes a Map based storage for the Bag, it does not
follow the AbstractX pattern, and thus has been renamed. There is
still room for future addition of an AbstractBag that does not assume
a storage data structure.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130675 13f79535-47bb-0310-9956-ffa450edef68