commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 38074] New: - [collections] FilterIterator doesn't reset when properties are set
Date Thu, 29 Dec 2005 20:14:03 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38074>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38074

           Summary: [collections] FilterIterator doesn't reset when
                    properties are set
           Product: Commons
           Version: unspecified
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Collections
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: huw12345@hotmail.com


Test case follows:

[pre]
    /**
     * Test that when the iterator is changed, the hasNext method
     * returns the correct response for the new iterator.
     */
    public void testSetIterator() {
        Iterator iter1 = Collections.singleton(new Object()).iterator();
        Iterator iter2 = Collections.EMPTY_LIST.iterator();
        
        FilterIterator filterIterator = new FilterIterator(iter1);
        filterIterator.setPredicate(TruePredicate.getInstance());
        
        assertTrue("filterIterator should have an element", 
filterIterator.hasNext());
        
        filterIterator.setIterator(iter2);
        
        assertTrue("filterIterator should not have an element", !
filterIterator.hasNext());
    }

    /**
     * Test that when the predicate is changed, the hasNext method
     * returns the correct response for the new predicate.
     */
    public void testSetPredicate() {
        Iterator iter = Collections.singleton(null).iterator();
        
        FilterIterator filterIterator = new FilterIterator(iter);
        filterIterator.setPredicate(TruePredicate.getInstance());
        
        assertTrue("filterIterator should have an element", 
filterIterator.hasNext());
        
        filterIterator.setPredicate(NotNullPredicate.getInstance());
        
        assertTrue("filterIterator should not have an element", !
filterIterator.hasNext());
    }
[/pre]

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message