• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2019 Mockito contributors
3  * This program is made available under the terms of the MIT License.
4  */
5 package org.mockito.plugins;
6 
7 /**
8  * Enforcer that is applied to every type in the type hierarchy of the class-to-be-mocked.
9  */
10 public interface DoNotMockEnforcer {
11 
12     /**
13      * If this type is allowed to be mocked. Return an empty optional if the enforcer allows
14      * this type to be mocked. Return a message if there is a reason this type can not be mocked.
15      *
16      * Note that Mockito performs traversal of the type hierarchy. Implementations of this class
17      * should therefore not perform type traversal themselves but rely on Mockito.
18      *
19      * @param type The type to check
20      * @return Optional message if this type can not be mocked, or an empty optional if type can be mocked
21      */
checkTypeForDoNotMockViolation(Class<?> type)22     String checkTypeForDoNotMockViolation(Class<?> type);
23 }
24