- All Superinterfaces:
DoNotMockEnforcerWithType
Enforcer that is applied to every type in the type hierarchy of the class-to-be-mocked.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classStatic cache for types that are known to be mockable and thus may be skipped while traversing the class hierarchy. -
Method Summary
Modifier and TypeMethodDescriptioncheckTypeForDoNotMockViolation(Class<?> type) Check whether this type is allowed to be mocked.default StringcheckTypeForDoNotMockViolation(MockCreationSettings<?> creationSettings) Check whether this type is allowed to be mocked.
-
Method Details
-
checkTypeForDoNotMockViolation
Check whether this type is allowed to be mocked. Returnnullif the enforcer allows this type to be mocked. Return a message if there is a reason this type can not be mocked.Note that traversal of the type hierarchy is performed externally to this method. Implementations of it should therefore not perform type traversal themselves.
- Parameters:
type- The type to check- Returns:
- Optional message if this type can not be mocked, or
nullotherwise - See Also:
-
checkTypeForDoNotMockViolation
Check whether this type is allowed to be mocked. Returnnullif the enforcer allows this type to be mocked. Return a message if there is a reason this type can not be mocked.The default implementation traverses the class hierarchy of the type to be mocked and checks it against
checkTypeForDoNotMockViolation(Class). If any types fails the validation, the traversal is interrupted and the error message is returned.- Specified by:
checkTypeForDoNotMockViolationin interfaceDoNotMockEnforcerWithType- Parameters:
creationSettings- The mock creation settings- Returns:
- Optional message if this type can not be mocked, or
nullotherwise - Since:
- 5.9.0
-