[No Audio]
So now if we go back to our UserLookupServiceTest,
we'll still keep those commented just as a reference.
But now, we could convert the first
one, for example, to this format.
So assertThat(actualUsers) now we're giving
the collection to the assertion statement itself as
opposed to an individual element of the collection.
So we give in the full collection here.
actualUsers, IsIterableContainingInAnyOrder
[No Audio]
which is in this package here.
So I put an explicit package them in there
[No Audio]
and then contains in any order. Here
you can see it takes a set of matches where
each match represents an element of the collection
that you're matching to be in that collection.
So the first thing we expect is
equalTo which is a matcher.
And we can just use this create function for now
[No Audio]
because actually gives a new instance, which we
can test the quality for and then copy that
and give the other instance
[No Audio]
which is donald.
[No Audio]
dbc321
So now if I run with Ctrl R,
[No Audio]
you can see that that works.
Just fix that (not clear) up here.
And that works because it's got
both anne and donald in there.
Now if we didn't have both of
those things in actually before that
bit if I keep running this, we'll see that no
matter how many times I run this, I'm keeping running
it now as I'm talking, no matter how many times
I run it, it's always consistently passing.
And that's because even though actualUsers is a
set, this doesn't take any order into account.
It's just saying it needs to have these two
elements here in whatever order that come back.
Which is great for testing sets, to make
this nicer again by the static import trick.
And it makes it much more readable.
So the actual users consent in any order.
And then these two things here.
So that looks good to me.
It's not as verbose, at least as the JUnit
assertions version, but we can still improve it.
And we'll see how in the next videos.