Wrapping Up
So far, we’ve introduced that Mockito generates fake classes that stand in for actual dependencies so you can isolate the class you’re testing. We’ve talked about using stubs when we need to simply provide known outputs for known inputs. When we want to check that the class under test called the methods on the mock the right number of times in the right order, we know to use a mock. In short, we’ve covered why you’d use the Mockito framework.
Now we’re ready to get into the process of using Mockito in tests. In the next chapter, we’ll create mocks, inject them into class under test, and get them to respond the way we want.
Get Mockito Made Clear now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.