Mockito Concepts

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

Internal

Overview

MockitoJUnitRunner

Mockito.mock()

Programming Model | API

@Mock

Programming Model | Annotations

Can't Mock

  • Final classes
  • Final methods
  • Enums
  • Static methods
  • Private methods
  • hashCode() and equals() methods
  • Anonymous classes
  • Primitive types

PowerMock can mock these constructs.

Managed Test Double

A test double managed by Mockito. It can be created either via the API with Mockito.mock(<object>) or by annotating the field referencing the object in question with Mock.