The JMockit Testing Toolkit Tutorial
- Introduction
- An example
- Running tests with JMockit
-
Writing behavior-based tests
- Mocked types
- Expectations
- The record-replay-verify model
- Declaring and using mocked types
- Recording results for an expectation
- Matching invocations to specific instances
- Flexible matching of argument values
- Specifying invocation count constraints
- Strict and non-strict expectations
- Explicit verification
- Delegates: specifying custom results
- Validating invocation arguments
- Capturing invocation arguments for verification
- Accessing private fields, methods and constructors
- Partial mocking
- Cascading mocks
- Capturing internal instances of mocked types
- Automatic instantiation and injection of tested classes
- Reusing expectation and verification blocks
-
Writing state-based tests
- Mock methods and mock classes
- Setting up mocks for a test
- Mocking interfaces
- Invocation count constraints
- Mocking class initializers
- Accessing the invocation context
- Reentrant mocks
- Reusing mocks between tests
-
Reflection-based utilities
-
Using mocks and stubs over entire test classes and suites
-
Measuring code coverage
- Line coverage
- Path coverage
- Data coverage
- Types of coverage output
- Configuring the coverage tool
- Generating aggregate reports for separate test runs
- Checking minimum coverage
- Activating coverage in a Maven project
- Turning coverage output off
- Standalone mode