Sign in Go Pro

Mockito

Writing Your First Unit Test with Mockito

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson
Autoplay

Up next

Previous

About

This lesson demonstrates a simple example of using Mockito.mock to produce a stub which can be used instead of the real database dependency.

In this lesson you will learn:

Creating a mock object using Mockito.mock method
Recommendation for naming mock objects
Writing a unit test which expects an exception to be thrown
Brief summary of anyString() matcher
Description of default behavior of objects created using Mockito
Controlling how the mock behaves using the Mockito.when method

Instructor

Links

Comments

There are no comments on this lesson, start the conversation below ...

>
You need to go PRO to post comments.

Lessons in Mockito