public final class MockMakers extends Object
IMockMaker
implementations.
You can select the mock maker during mock creation:
YourClass yourMock = Mock(mockMaker: MockMakers.byteBuddy)
Modifier and Type | Field and Description |
---|---|
static IMockMakerSettings |
byteBuddy
Uses Byte Buddy to create mocks.
|
static IMockMakerSettings |
cglib
Uses CGLIB to create mocks.
|
static IMockMakerSettings |
javaProxy
Uses the Java
Proxy API to create mocks of interfaces. |
static IMockMakerSettings |
mockito
Uses Mockito to create mocks,
which also supports final classes, enums and final methods.
|
Modifier and Type | Method and Description |
---|---|
static IMockMakerSettings |
mockito(Closure<?> settingsCode)
Uses Mockito to create mocks,
which also supports final classes, enums and final methods.
|
public static final IMockMakerSettings byteBuddy
The supported mocking features are:
INTERFACE
CLASS
ADDITIONAL_INTERFACES
EXPLICIT_CONSTRUCTOR_ARGUMENTS
public static final IMockMakerSettings cglib
The supported mocking features are:
INTERFACE
CLASS
ADDITIONAL_INTERFACES
EXPLICIT_CONSTRUCTOR_ARGUMENTS
public static final IMockMakerSettings javaProxy
Proxy
API to create mocks of interfaces.
The supported mocking features are:
INTERFACE
ADDITIONAL_INTERFACES
public static final IMockMakerSettings mockito
The supported mocking features are:
INTERFACE
CLASS
ADDITIONAL_INTERFACES
EXPLICIT_CONSTRUCTOR_ARGUMENTS
FINAL_CLASS
FINAL_METHOD
It uses MockMakers.INLINE
under the hood,
please see the Mockito manual for all pros and cons, when using MockMakers.INLINE
.
public static IMockMakerSettings mockito(@DelegatesTo(type="org.mockito.MockSettings",strategy=1) Closure<?> settingsCode)
The supported mocking features are:
INTERFACE
CLASS
ADDITIONAL_INTERFACES
EXPLICIT_CONSTRUCTOR_ARGUMENTS
FINAL_CLASS
FINAL_METHOD
It uses MockMakers.INLINE
under the hood,
please see the Mockito manual for all pros and cons, when using MockMakers.INLINE
.
settingsCode
- the code to execute to configure MockSettings
for further configuration of the mock to create