Sounds like a bug in IteratorChain. hasNext() should never throw UOE. (b) is the best solution for your particuular problem however. Stephen
I have now committed the code. I made the following changes from Brian's last post:
1. Modified iterator to return an empty iterator when the CompositeCollection is empty
2. Modified toArray(array) to comply with the null padding requirement of the Collection spec (turned up by the test framework :-)
3. Reformatted code to match collections style.
4. Modified TestCompositeCollection to extend AbstractTestCollection, removing a few redundant tests, modifying to work on (sic) Junit 3.7 and adding some more mutator tests.
Phil
From: "Phil Steitz" <[EMAIL PROTECTED]>
Stephen Colebourne wrote:
From: "Phil Steitz" <[EMAIL PROTECTED]>
Anyone have any objections to committing this to the decorators
subpackage?
Phil
+1. The test needs work as its not a collections-testframework test.
I have reworked the test class to extend AbstractTestCollection and have run into a problem. The CompositeCollection interator method returns an IteratorChain.In the test class, I implemented makeCollection to return an empty CompositeCollection. The verifies are failing because IteratorChain.hasNext() throws an UnsupportedOperationException when the chain is empty.
So the question is, what (if anything?) should change: a) IteratorChain.hasNext() (return false when the chain is empty) b) CompositeCollection.iterator() (return an emtpy non-chained iterator when the CompsiteCollection is empty) c) No change
Thoughts?
Phil
Stephen
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
