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. Strict and non-strict expectations
    6. Recording results for an expectation
    7. Matching invocations to specific instances
    8. Flexible matching of argument values
    9. Specifying invocation count constraints
    10. Explicit verification
    11. Delegates: specifying custom results
    12. Capturing invocation arguments for verification
    13. Accessing private fields, methods and constructors
    14. Partial mocking
    15. Cascading mocks
    16. Capturing implementation classes and instances of mocked types
    17. Automatic instantiation and injection of tested classes
    18. Reusing expectation and verification blocks
    19. Other topics
  5. Writing state-based tests and fakes
    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. Proceeding into the real implementation
    8. Reusing mocks between tests
    9. Using mock-ups over entire test classes and suites
  6. Reflection-based utilities
  7. 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