Class MockScanner
java.lang.Object
org.mockito.internal.configuration.injection.scanner.MockScanner
Scan mocks, and prepare them if needed.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPreparedMocks
(Set<Object> mocks) Add the scanned and prepared mock instance to the given collection.private boolean
isAnnotatedByMockOrSpy
(Field field) private boolean
isMockOrSpy
(Object instance) private Object
preparedMock
(Object instance, Field field) scan()
Scan and prepare mocks for the giventestClassInstance
andclazz
in the type hierarchy.
-
Field Details
-
instance
-
clazz
-
-
Constructor Details
-
MockScanner
Creates a MockScanner.- Parameters:
instance
- The test instanceclazz
- The class in the type hierarchy of this instance.
-
-
Method Details
-
addPreparedMocks
Add the scanned and prepared mock instance to the given collection.The preparation of mocks consists only in defining a MockName if not already set.
- Parameters:
mocks
- Set of mocks
-
scan
Scan and prepare mocks for the giventestClassInstance
andclazz
in the type hierarchy.- Returns:
- A prepared set of mock
-
preparedMock
-
isAnnotatedByMockOrSpy
-
isMockOrSpy
-