commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sai Zhang (JIRA)" <>
Subject [jira] [Commented] (COLLECTIONS-373) Bug in class#ListOrderedSet with reproducible JUnit test
Date Thu, 18 Aug 2011 01:21:27 GMT


Sai Zhang commented on COLLECTIONS-373:


Here is the latest output of our documentation inference tool. It renames all
variable names and (hopefully) makes the test easier to read.

The comments generated by our research tool are shown in the form of:

//Test passes if:  xxxx (it indicates changes that will make a failed test pass)

Each piece of comments (not the combination of them) provides a way to correct the failed
We hope such additional information will help developers understand/fix the test faster/better.

So, it would be great if anyone can take a look at the reported bug to:
(1) confirm is it a real bug?
(2) is such comment information useful? If not, please give us feedback so we can do our best
     to improve our tool!

Thank you!


public void test0() {
    ListOrderedSet listOrderedSet0 = new ListOrderedSet();
    List list0 = listOrderedSet0.asList();
    List list1 = listOrderedSet0.asList();
    Integer i0 = new Integer((-1));
    ListOrderedSet listOrderedSet1 = new ListOrderedSet();
    Integer i1 = new Integer((-1));
    ListOrderedSet listOrderedSet2 = new ListOrderedSet();
    List list2 = listOrderedSet2.asList();
    ListOrderedSet listOrderedSet3 = ListOrderedSet.decorate((Set)listOrderedSet2);
    boolean b0 = listOrderedSet1.addAll(i1, (Collection)listOrderedSet2);
    boolean b1 = listOrderedSet0.addAll(i0, (Collection)listOrderedSet2);
    ListOrderedSet listOrderedSet4 = new ListOrderedSet();
    List list3 = listOrderedSet4.asList();
    List list4 = listOrderedSet4.asList();
    ListOrderedSet listOrderedSet5 = new ListOrderedSet();
    List list5 = listOrderedSet5.asList();
    ListOrderedSet listOrderedSet6 = ListOrderedSet.decorate((Set)listOrderedSet5);
    ListOrderedSet listOrderedSet7 = new ListOrderedSet();
    List list6 = listOrderedSet7.asList();
    ListOrderedSet listOrderedSet8 = ListOrderedSet.decorate((Set)listOrderedSet5, list6);
    boolean b2 = listOrderedSet4.containsAll((Collection)list6);
    ListOrderedSet listOrderedSet9 = ListOrderedSet.decorate((Set)listOrderedSet0, list6);
    ListOrderedSet listOrderedSet10 = new ListOrderedSet();
    int i2 = listOrderedSet10.size();
    boolean b3 = listOrderedSet0.add((Object)i2);
    //Test passes if line is: Integer s0 = new Integer(0)
    Short s0 = new Short((short)1);
    //Test passes if s0 is not added to listOrderedSet0
    boolean b4 = listOrderedSet0.add((Object)s0);
    ListOrderedSet listOrderedSet11 = new ListOrderedSet();
    List list7 = listOrderedSet11.asList();
    List list8 = listOrderedSet11.asList();
    Integer i3 = new Integer((-1));
    ListOrderedSet listOrderedSet12 = new ListOrderedSet();
    Integer i4 = new Integer((-1));
    ListOrderedSet listOrderedSet13 = new ListOrderedSet();
    List list9 = listOrderedSet13.asList();
    ListOrderedSet listOrderedSet14 = ListOrderedSet.decorate((Set)listOrderedSet13);
    boolean b5 = listOrderedSet12.addAll(i4, (Collection)listOrderedSet13);
    boolean b6 = listOrderedSet11.addAll(i3, (Collection)listOrderedSet13);
    ListOrderedSet listOrderedSet15 = new ListOrderedSet();
    List list10 = listOrderedSet15.asList();
    List list11 = listOrderedSet15.asList();
    ListOrderedSet listOrderedSet16 = new ListOrderedSet();
    List list12 = listOrderedSet16.asList();
    ListOrderedSet listOrderedSet17 = ListOrderedSet.decorate((Set)listOrderedSet16);
    ListOrderedSet listOrderedSet18 = new ListOrderedSet();
    List list13 = listOrderedSet18.asList();
    ListOrderedSet listOrderedSet19 = ListOrderedSet.decorate((Set)listOrderedSet16, list13);
    boolean b7 = listOrderedSet15.containsAll((Collection)list13);
    ListOrderedSet listOrderedSet20 = ListOrderedSet.decorate((Set)listOrderedSet11, list13);
    ListOrderedSet listOrderedSet21 = new ListOrderedSet();
    int i5 = listOrderedSet21.size();
    //Test passes if i5 is not added to listOrderedSet11
    boolean b8 = listOrderedSet11.add((Object)i5);
    boolean b9 = listOrderedSet0.removeAll((Collection)listOrderedSet11);
    // Checks the contract:  equals-hashcode on listOrderedSet0 and listOrderedSet20
    assertTrue("Contract failed: equals-hashcode on listOrderedSet0 and listOrderedSet20",
listOrderedSet0.equals(listOrderedSet20) ? listOrderedSet0.hashCode() == listOrderedSet20.hashCode()
: true);
    // Checks the contract:  equals-hashcode on listOrderedSet9 and listOrderedSet20
    assertTrue("Contract failed: equals-hashcode on listOrderedSet9 and listOrderedSet20",
listOrderedSet9.equals(listOrderedSet20) ? listOrderedSet9.hashCode() == listOrderedSet20.hashCode()
: true);
    // Checks the contract:  equals-hashcode on listOrderedSet11 and listOrderedSet9
    assertTrue("Contract failed: equals-hashcode on listOrderedSet11 and listOrderedSet9",
listOrderedSet11.equals(listOrderedSet9) ? listOrderedSet11.hashCode() == listOrderedSet9.hashCode()
: true);
    // Checks the contract:  equals-hashcode on listOrderedSet20 and listOrderedSet9
    assertTrue("Contract failed: equals-hashcode on listOrderedSet20 and listOrderedSet9",
listOrderedSet20.equals(listOrderedSet9) ? listOrderedSet20.hashCode() == listOrderedSet9.hashCode()
: true);
    // Checks the contract:  equals-symmetric on listOrderedSet0 and listOrderedSet20.
    assertTrue("Contract failed: equals-symmetric on listOrderedSet0 and listOrderedSet20.",
listOrderedSet0.equals(listOrderedSet20) == listOrderedSet20.equals(listOrderedSet0));
    // Checks the contract:  equals-symmetric on listOrderedSet11 and listOrderedSet9.
    assertTrue("Contract failed: equals-symmetric on listOrderedSet11 and listOrderedSet9.",
listOrderedSet11.equals(listOrderedSet9) == listOrderedSet9.equals(listOrderedSet11));


> Bug in class#ListOrderedSet with reproducible JUnit test
> --------------------------------------------------------
>                 Key: COLLECTIONS-373
>                 URL:
>             Project: Commons Collections
>          Issue Type: Bug
>    Affects Versions: 3.2
>         Environment: jdk 1.6.x
>            Reporter: Sai Zhang
>              Labels: patch
>         Attachments:
> Hi all:
> I am writing an automated bug finding tool, and using
> Apache Commons Collections as an experimental subject
> for evaluation.
> The tool creates executable JUnit tests as well as
> explanatory code comments. I attached one bug-revealing
> test as follows. Could you please kindly check it, to
> see if it is a real bug or not? 
> Also, it would be tremendous helpful if you could give
> some feedback and suggestion on the generated code comments?
> From the perspective of developers who are relatively familiar
> with the code,
> is the automatically-inferred comment useful in understanding
> the generated test? is the comment helpful in bug fixing?
> Your suggestion will help us improve the tool.
> Please see attachment for the failed test. A little explaination
> on the generated code comments in the failed test
> //explaination:
> //Test passes if var53 is: (java.lang.Boolean)false  ===> means: 
> //     test passes if var52 is not added to var28 (only in that case, var53 is false)
> boolean var53 = var28.add((java.lang.Object)var52);

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message