Synesso / instinct

Automatically exported from code.google.com/p/instinct
0 stars 0 forks source link

CollectionChecker.hasTheSameContentAs() is broken #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
@Specification
    public void shouldNotFailAndDoesntYay() {
        final List<Integer> expected = asList(1,1,3,4);
        final List<Integer> returned = asList(1,2,4,3);
        expect.that(expected).hasTheSameContentAs(returned);
    }

    @Specification
    public void shouldNotFailButDoesYouNoob() {
        final List<Integer> expected = asList(1, 1, 3, 4);
        final List<Integer> returned = asList(1, 2, 4, 3);
        expect.that(returned).hasTheSameContentAs(expected);
    }

http://pastie.caboo.se/138076

Original issue reported on code.google.com by tomjad...@gmail.com on 11 Jan 2008 at 5:55

GoogleCodeExporter commented 9 years ago
This is the correct behaviour. In the first example it ensures that "expected" 
contains 1, 3 and 4. In the second 
case it ensures that "returned" contains 1, 3 and 4, which it doesn't.

It is a little confusing, as it's doing a contains on the list, not an equals. 
I'll speak to Sanjiv about changing this 
behaviour or method name.

Original comment by tomjad...@gmail.com on 14 Jan 2008 at 4:19