1 00:00:00,000 --> 00:00:02,350 [No Audio] 2 00:00:02,350 --> 00:00:04,542 So now if we go back to our UserLookupServiceTest, 3 00:00:04,542 --> 00:00:07,576 we'll still keep those commented just as a reference. 4 00:00:07,576 --> 00:00:10,112 But now, we could convert the first 5 00:00:10,112 --> 00:00:11,818 one, for example, to this format. 6 00:00:11,818 --> 00:00:16,123 So assertThat(actualUsers) now we're giving 7 00:00:16,123 --> 00:00:18,476 the collection to the assertion statement itself as 8 00:00:18,476 --> 00:00:20,434 opposed to an individual element of the collection. 9 00:00:20,434 --> 00:00:22,136 So we give in the full collection here. 10 00:00:22,136 --> 00:00:27,299 actualUsers, IsIterableContainingInAnyOrder 11 00:00:27,299 --> 00:00:30,060 [No Audio] 12 00:00:30,060 --> 00:00:32,844 which is in this package here. 13 00:00:32,844 --> 00:00:35,060 So I put an explicit package them in there 14 00:00:35,060 --> 00:00:39,758 [No Audio] 15 00:00:39,758 --> 00:00:42,196 and then contains in any order. Here 16 00:00:42,196 --> 00:00:43,974 you can see it takes a set of matches where 17 00:00:43,974 --> 00:00:46,362 each match represents an element of the collection 18 00:00:46,362 --> 00:00:48,992 that you're matching to be in that collection. 19 00:00:48,992 --> 00:00:51,412 So the first thing we expect is 20 00:00:51,412 --> 00:00:54,174 equalTo which is a matcher. 21 00:00:54,174 --> 00:00:58,520 And we can just use this create function for now 22 00:00:58,520 --> 00:01:01,695 [No Audio] 23 00:01:01,695 --> 00:01:04,982 because actually gives a new instance, which we 24 00:01:04,995 --> 00:01:08,745 can test the quality for and then copy that 25 00:01:08,745 --> 00:01:10,379 and give the other instance 26 00:01:10,379 --> 00:01:12,353 [No Audio] 27 00:01:12,353 --> 00:01:13,337 which is donald. 28 00:01:13,337 --> 00:01:15,103 [No Audio] 29 00:01:15,103 --> 00:01:16,616 dbc321 30 00:01:16,616 --> 00:01:18,282 So now if I run with Ctrl R, 31 00:01:18,282 --> 00:01:20,499 [No Audio] 32 00:01:20,499 --> 00:01:22,028 you can see that that works. 33 00:01:22,028 --> 00:01:24,596 Just fix that (not clear) up here. 34 00:01:24,596 --> 00:01:26,504 And that works because it's got 35 00:01:26,504 --> 00:01:28,340 both anne and donald in there. 36 00:01:28,340 --> 00:01:29,816 Now if we didn't have both of 37 00:01:29,816 --> 00:01:31,304 those things in actually before that 38 00:01:31,304 --> 00:01:35,696 bit if I keep running this, we'll see that no 39 00:01:35,696 --> 00:01:37,652 matter how many times I run this, I'm keeping running 40 00:01:37,652 --> 00:01:39,752 it now as I'm talking, no matter how many times 41 00:01:39,752 --> 00:01:42,358 I run it, it's always consistently passing. 42 00:01:42,358 --> 00:01:44,996 And that's because even though actualUsers is a 43 00:01:44,996 --> 00:01:47,432 set, this doesn't take any order into account. 44 00:01:47,432 --> 00:01:49,004 It's just saying it needs to have these two 45 00:01:49,004 --> 00:01:51,560 elements here in whatever order that come back. 46 00:01:51,560 --> 00:01:54,716 Which is great for testing sets, to make 47 00:01:54,716 --> 00:01:59,016 this nicer again by the static import trick. 48 00:01:59,016 --> 00:02:00,730 And it makes it much more readable. 49 00:02:00,730 --> 00:02:03,596 So the actual users consent in any order. 50 00:02:03,596 --> 00:02:05,204 And then these two things here. 51 00:02:05,204 --> 00:02:06,512 So that looks good to me. 52 00:02:06,512 --> 00:02:08,482 It's not as verbose, at least as the JUnit 53 00:02:08,482 --> 00:02:10,808 assertions version, but we can still improve it. 54 00:02:10,808 --> 00:02:12,715 And we'll see how in the next videos.