/* * Copyright (c) 2019 Mockito contributors * This program is made available under the terms of the MIT License. */ package org.mockito.plugins; /** * Enforcer that is applied to every type in the type hierarchy of the class-to-be-mocked. */ public interface DoNotMockEnforcer { /** * 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. * * @param type The type to check * @return Optional message if this type can not be mocked, or an empty optional if type can be mocked */ String checkTypeForDoNotMockViolation(Class type); }