[No Audio]
Let's create a test for this now then.
So if I do shift command T, Create New Test.
It's a UserLookupServiceTest and we'll
have two sub methods here to create these
test methods to test RegularUsers.
AdminUsers get functionality of those respectively.
So let's do OK, we've got our two Tests ready to go.
So if we run this now just to make sure everything is
set up okay, I can see we've got our two Tests.
It still says that they're passed
2 of 2 tests, one milliseconds.
Everything's good.
Let's write a test for this. Now
whenever you're writing a unit test, always
reflect back and look at the actual
production code that you're testing.
So you can do this by shift command T
to go back to the corresponding production class.
So command shift T will toggle between the
production class you're testing and the actual class,
which is the test class itself.
So here we can go to production
code, UserLookupService again, command shift
T, you can go back to a test.
So anyway, let's go shift command T back
to the production code, UserLookupService
and that would generate the test methods.
We can move on.
But I wanted to show you that to show you just
how easy it is to toggle between the production class
and the test class that's testing it because you'll
find yourself frequently wanting to toggle between
the two classes to either code up your test while
referencing the production code is testing or even
fix bugs in the production code
as the test you're writing reveal defects in it.
So, yeah, a useful trick to having your toolbox.