|Constructor and Description|
|Modifier and Type||Method and Description|
If you want to provide your own implementation of
Returns the handler for the
Indicates if the given type can be mocked by this mockmaker.
Replaces the existing handler on
public <T> T createMock(MockCreationSettings<T> settings, MockHandler handler)
MockMakerthis method should:
settings.typeToMockand potentially also
settingsto create/configure your proxy object.
handlerwith it. For example, if you generate byte code to create the proxy you could generate an extra field to keep the
handlerwith the generated object. Your implementation of
MockMakeris required to provide this instance of
T- Type of the mock to return, actually the
settings- Mock creation settings like type to mock, extra interfaces and so on.
MockHandler. Do not provide your own implementation at this time. Make sure your implementation of
MockMaker.getHandler(Object)will return this instance.
public MockHandler getHandler(Object mock)
mock. Do not provide your own implementations at this time because the work on the
MockHandlerapi is not completed. Use the instance provided to you by Mockito at
MockMaker.resetMock(java.lang.Object, org.mockito.invocation.MockHandler, org.mockito.mock.MockCreationSettings).
public void resetMock(Object mock, MockHandler newHandler, MockCreationSettings settings)
The invocation handler actually store invocations to achieve stubbing and verification. In order to reset the mock, we pass a new instance of the invocation handler.
Your implementation should make sure the
newHandler is correctly associated to passed
public MockMaker.TypeMockability isTypeMockable(Class<?> type)
Mockmaker may have different capabilities in term of mocking, typically Mockito 1.x's internal mockmaker cannot mock final types. Other implementations, may have different limitations.