• Online, Self-Paced
Course Description

Mockito is a Java framework for building mocks during unit testing. When performing unit tests on an object, you often have other, complex objects that the object under test depends upon. Rather than using those complex objects, you can use Mockito to create mocks of those objects and stub their methods to simulate expected behavior.

Use this course to get to grips with mocking and its relationship with unit testing. Set up a Maven project and add the required Mockito and JUnit dependencies. Create mocks of built-in classes, such as the ArrayList, and built-in interfaces, such as the Comparator. Then, work with stub methods using Mockito's when().thenReturn() syntax.

When you're done, you'll be able to identify situations where using mocks is a good idea, construct mocks, stub methods in them using Mockito, and use mock objects in unit tests.

Learning Objectives

{"discover the key concepts covered in this course"}

Framework Connections

The materials within this course focus on the NICE Framework Task, Knowledge, and Skill statements identified within the indicated NICE Framework component(s):

Specialty Areas

  • Software Development
  • Test and Evaluation