The JMockit Testing Toolkit Tutorial

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