[ 
https://issues.apache.org/jira/browse/COLLECTIONS-373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13560827#comment-13560827
 ] 

Thomas Neidhart commented on COLLECTIONS-373:
---------------------------------------------

Hi,

thanks for the bug report. Such automated test generation tools can be really 
helpful and interesting, but I do have a hard time trying to understand this 
testcase. Has there been any improvement to your test tool wrt to understanding 
the tested scenario?

I adapted the testcase for the latest trunk (4.0-SNAPSHOT) by simply changing 
the decorate methods with the corresponding listOrderedSet.
The test fails here:

{noformat}
        assertTrue("Contract failed: equals-hashcode on var0 and var50", 
var0.equals(var50) ? var0.hashCode() == var50.hashCode() : true);
{noformat}

When looking at the testcase, var50 is initialized as follows:

{noformat}
        org.apache.commons.collections.set.ListOrderedSet var50 = 
org.apache.commons.collections.set.ListOrderedSet.listOrderedSet((java.util.Set)var28,
 var47);
{noformat}

according to the contract of the decorate/listOrderedSet static factory method, 
the provided List and Set have to be empty and not null. This is not true for 
your testcase, as the provided argument var28 is not empty.

So I have to reject this testcase as invalid, but would be interested to see 
advancements in this field.
                
> Bug in class#ListOrderedSet with reproducible JUnit test
> --------------------------------------------------------
>
>                 Key: COLLECTIONS-373
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-373
>             Project: Commons Collections
>          Issue Type: Bug
>    Affects Versions: 3.2
>         Environment: jdk 1.6.x
>            Reporter: Sai Zhang
>              Labels: patch
>         Attachments: ApacheListOrderSet_Documented_Test.java
>
>
> 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.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to