Thomas Mortagne created COLLECTIONS-898:
-------------------------------------------

             Summary: AbstractSetTest cannot be used with an explicitly typed 
Set (unless it's based on String)
                 Key: COLLECTIONS-898
                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-898
             Project: Commons Collections
          Issue Type: Bug
          Components: Set
    Affects Versions: 4.0
            Reporter: Thomas Mortagne


AbstractSetTest is very useful to validate the behavior of custom Set 
implementations, but there is unfortunately one small limitation preventing to 
test it with a typed Set (for example {{class MySet extends Set<MyType>}}): 
#testSetEquals calls #add with a hardcoded String, which immediately fail with 
a ClassCastException in such a case. It used to be possible to overwrite 
#testSetEquals(), but it moved to package private in 4.6.0, making it hard to 
workaround. So I cannot be lazy anymore and need to suggest a proper fix :)

I propose to rely on something like getFullElements() to find a proper element 
to add, instead of the harcoded String. Pull request coming up...



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to