java-mock-class

Force mocking of given class.

Description

In some special cases, it may be necessary to tell Diffblue Cover to mock the calls to methods of some classes. When using this option alone, and given the fully-qualified name of a class, Diffblue Cover will mock all calls to all methods of the given class.

Usage

There are two main use-cases for which mocking is suitable:

  • code which is dangerous to execute in unit tests (for example, I/O operations)

  • methods for which the return value is inconsistent (for example, random number generators)

phases:
-
  cbmcArguments:
    java-mock-class:  ['java.io.File', 'java.io.FileInputStream']

Default

A predefined list of classes is set within Diffblue Cover

results matching ""

    No results matching ""