Interface DoNotMockEnforcer


public interface DoNotMockEnforcer
Enforcer that is applied to every type in the type hierarchy of the class-to-be-mocked.
  • Method Details

    • checkTypeForDoNotMockViolation

      String checkTypeForDoNotMockViolation(Class<?> type)
      If this type is allowed to be mocked. Return an empty optional if the enforcer allows this type to be mocked. Return a message if there is a reason this type can not be mocked. Note that Mockito performs traversal of the type hierarchy. Implementations of this class should therefore not perform type traversal themselves but rely on Mockito.
      Parameters:
      type - The type to check
      Returns:
      Optional message if this type can not be mocked, or an empty optional if type can be mocked