[No Audio]
Before we get into the asserts, let's just run
it and put a breakpoint here and make sure
that we actually get some users back.
Just testing this method.
I could test all the methods, but I
just want to test this method.
I'd rather run this method.
Sorry, I'll try again I'd rather Debug this method.
So right click Debug.
And then when we get to that breakpoint
there at this point, we should see that. Yes, indeed.
We've got the UserLookupService.
We've got the userRepository, which is a mock.
And here we have the user list, which is a full
set of users, which was returned back from the mock.
So that's our list of users we had.
We can see here, we've got anne and
donald, which are both REGULAR_USERS, and then
we've got beebop, who is an ADMIN_USER. Yeah.
And then we have the actual users themselves,
which have been filtered through as they've been
returned from the production method we actually
invoked, which is this method here, this
UserLookupService, getRegularUsers.
So we can have a look in here. We can have a sneak
peek. It's what I normally do when I'm writing
tests as well. It can be nice.
And we can see we've got REGULAR_USER, REGULAR_USER.
They're both what we expect.
So to me, at a first glance, just
in debug mode, we've got enough data here
to test the production code that we're invoking.
The method we're testing. We've tested the method.
And as a curious developer, I've set a breakpoint and
I can see here that I'm getting back the
data that I think I should get back.
So at this point now, as a developer, I've kind
of got confidence that the API seems to work at
least for a happy path the way it's supposed to.
So that's kind of nice. It's always nice to do that,
to be honest, because rather than like churning out
a ton of assertions or whatever
it might be or writing out all of unit
tests, first of all, give yourself that reward.
Write a bit of production code.
Write a little bit of test code to invoke it.
Check it, getting back what you expect.
And it gives you that little bit of bit of a buzz
to you know, to move on because you're a little bit
happier that you're getting closer to your
own solution or to your end goal rather.
If you happen to be writing tests but the same as you
developing your production code, but always give
yourself a little boost just to keep you motivated.
[No Audio]