webtau icon indicating copy to clipboard operation
webtau copied to clipboard

containExactly missing Collection argument.

Open efrench-novi opened this issue 1 year ago • 3 comments

I was unable to use containExactly matcher given a body which is a list of json objects:

body.should(containExactly(payload));

I had to convert the collection to an array:

body.should(containExactly(payload.toArray()));

Please add a method that accepts a Collection as well as an array, similar to containAll

    public static ContainAllMatcher containExactly(Collection<Object> expected) {
        return new ContainExactlyMatcher(expected);
    }

efrench-novi avatar Mar 15 '24 02:03 efrench-novi

This makes a lot of sense, thanks for the reporting!

MykolaGolubyev avatar Mar 16 '24 01:03 MykolaGolubyev

Just noticed that containExactly doesn't work well with HTTP responses: it highlights nodes as incorrect in the output (using red **). Is this something you noticed as well @efrench-novi?

Also looks like the support for the list arg is in the pipeline to release already.

MykolaGolubyev avatar Mar 20 '24 11:03 MykolaGolubyev

Yes I did notice that. If the order is not exactly the same, it will highlight the differences in red. However it looks like the tests still pass when that happens. It would be great id that could be fixed.

efrench-novi avatar Mar 22 '24 15:03 efrench-novi

@efrench-novi 2.4 was released

MykolaGolubyev avatar Jun 12 '24 10:06 MykolaGolubyev