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 TypeMethodDescriptionvoidaddPreparedMocks(Set<Object> mocks) Add the scanned and prepared mock instance to the given collection.private booleanisAnnotatedByMockOrSpy(Field field) private booleanisMockOrSpy(Object instance) private ObjectpreparedMock(Object instance, Field field) scan()Scan and prepare mocks for the giventestClassInstanceandclazzin 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 giventestClassInstanceandclazzin the type hierarchy.- Returns:
- A prepared set of mock
-
preparedMock
-
isAnnotatedByMockOrSpy
-
isMockOrSpy
-