The original idea and part of the code where contributed by Rodrigo Damazio and Bruno Fonseca at Google
| Modifier and Type | Field and Description |
|---|---|
| private static final Predicate | |
| private Constructor | |
| private ConstructorArgs | |
| private Set | |
| private final EasyMockSupport | |
| private final Class |
| Access | Constructor and Description |
|---|---|
| public | |
| public | MockBuilder(Class<?>
The class of the mock to create toMock, EasyMockSupport The EasyMockSupport used to create mocks. Null if none support)Used by EasyMockSupport to allow the mock registration in the list of controls |
| Modifier and Type | Method and Description |
|---|---|
| public IMockBuilder | addMockedMethod(Method
method to be mocked method)Implements org. |
| public IMockBuilder | addMockedMethod(String
name of the method to be mocked methodName)Implements org. |
| public IMockBuilder | addMockedMethod(String
name of the method to be mocked methodName, Class<?>... types of the parameters of the method parameterTypes)Implements org. |
| public IMockBuilder | addMockedMethods(String...
names of the methods to be mocked methodNames)Implements org. |
| public IMockBuilder | addMockedMethods(Method...
methods to be mocked methods)Implements org. |
| private void | |
| public <R> R | createMock(MockType
the mock type type)Implements org. |
| public <R> R | createMock(String
the mock name name, MockType the mock type type)Implements org. |
| public <R> R | createMock(IMocksControl
org. used to create the objectImplements org. |
| public <R> R | createMock()
Implements org. |
| public <R> R | createMock(String
the mock name name, IMocksControl org. used to create the objectImplements org. |
| public <R> R | createMock(String
the mock name name)Implements org. |
| public <R> R | createNiceMock()
Implements org. |
| public <R> R | createNiceMock(String
the mock name name)Implements org. |
| public <R> R | createStrictMock()
Implements org. |
| public <R> R | createStrictMock(String
the mock name name)Implements org. |
| public IMockBuilder | withArgs(Object...
the arguments to pass to the constructor initArgs)Implements org. |
| public IMockBuilder | withConstructor(Constructor<?>
the constructor to be called constructor)Implements org. |
| public IMockBuilder | |
| public IMockBuilder | withConstructor()
Implements org. |
| public IMockBuilder | withConstructor(Object...
arguments of the constructor initArgs)Implements org. |
| public IMockBuilder | withConstructor(Class<?>...
the exact argument types of the constructor argTypes)Implements org. |
| CAN_BE_MOCKED | back to summary |
|---|---|
| private static final Predicate<Method> CAN_BE_MOCKED | |
| constructor | back to summary |
|---|---|
| private Constructor<?> constructor | |
| constructorArgs | back to summary |
|---|---|
| private ConstructorArgs constructorArgs | |
| mockedMethods | back to summary |
|---|---|
| private Set<Method> mockedMethods | |
| support | back to summary |
|---|---|
| private final EasyMockSupport support | |
| toMock | back to summary |
|---|---|
| private final Class<?> toMock | |
| MockBuilder | back to summary |
|---|---|
| public MockBuilder(Class<?> toMock) | |
| MockBuilder | back to summary |
|---|---|
| public MockBuilder(Class<?> toMock, EasyMockSupport support) Used by EasyMockSupport to allow the mock registration in the list of controls
| |
| addMockedMethod | back to summary |
|---|---|
| public IMockBuilder Implements org. Doc from org. Adds a method to be mocked in the testing class. Each call will add a new method to the result mock. The method is searched for in the class itself as well as superclasses.
| |
| addMockedMethod | back to summary |
|---|---|
| public IMockBuilder Implements org. Doc from org. Adds a method to be mocked in the testing class. Each call will add a new
method to the result mock.
The method is searched for in the class itself as well as superclasses.
There must be no overload of the method. You will have to rely on the
other
| |
| addMockedMethod | back to summary |
|---|---|
| public IMockBuilder Implements org. Doc from org. Adds a method to be mocked in the testing class. Each call will add a new method to the result mock. The method is searched for in the class itself as well as superclasses.
| |
| addMockedMethods | back to summary |
|---|---|
| public IMockBuilder Implements org. Doc from org. Adds methods to be mocked in the testing class. Same as
| |
| addMockedMethods | back to summary |
|---|---|
| public IMockBuilder Implements org. Doc from org. Adds methods to be mocked in the testing class. Same as
| |
| checkConstructorNotInitialized | back to summary |
|---|---|
| private void checkConstructorNotInitialized() | |
| createMock | back to summary |
|---|---|
| public <R> R createMock(MockType type) Implements org. Doc from org. Create mock of the request type from this builder. The same builder can be called to create multiple mocks.
| |
| createMock | back to summary |
|---|---|
| public <R> R createMock(String name, MockType type) Implements org. Doc from org. Create a named mock of the request type from this builder. The same builder can be called to create multiple mocks. | |
| createMock | back to summary |
|---|---|
| public <R> R createMock(IMocksControl control) Implements org. Doc from org. Create mock from the provided mock control using the arguments passed to the builder.
| |
| createMock | back to summary |
|---|---|
| public <R> R createMock() Implements org. Doc from org. Create a default mock from this builder. The same builder can be called to create multiple mocks.
| |
| createMock | back to summary |
|---|---|
| public <R> R createMock(String name, IMocksControl control) Implements org. Doc from org. Create named mock from the provided mock control using the arguments passed to the builder.
| |
| createMock | back to summary |
|---|---|
| public <R> R createMock(String name) Implements org. Doc from org. Create named mock from the provided mock control using the arguments passed to the builder.
| |
| createNiceMock | back to summary |
|---|---|
| public <R> R createNiceMock() Implements org. Doc from org. Create a nice mock from this builder. The same builder can be called to create multiple mocks.
| |
| createNiceMock | back to summary |
|---|---|
| public <R> R createNiceMock(String name) Implements org. Doc from org. Create a named nice mock from this builder. The same builder can be called to create multiple mocks.
| |
| createStrictMock | back to summary |
|---|---|
| public <R> R createStrictMock() Implements org. Doc from org. Create a strict mock from this builder. The same builder can be called to create multiple mocks.
| |
| createStrictMock | back to summary |
|---|---|
| public <R> R createStrictMock(String name) Implements org. Doc from org. Create a named strict mock from this builder. The same builder can be called to create multiple mocks.
| |
| withArgs | back to summary |
|---|---|
| public IMockBuilder Implements org. Doc from org. Defines the arguments to be passed to the constructor of the class. The
types of the arguments must match those previously defined with
| |
| withConstructor | back to summary |
|---|---|
| public IMockBuilder Implements org. Doc from org. Defines the constructor to use to instantiate the mock. It is expected
that you call
| |
| withConstructor | back to summary |
|---|---|
| public IMockBuilder | |
| withConstructor | back to summary |
|---|---|
| public IMockBuilder Implements org. Doc from org. Defines the empty constructor should be called.
| |
| withConstructor | back to summary |
|---|---|
| public IMockBuilder Implements org. Doc from org. Defines the constructor parameters for the mocked class. The builder will automatically find a constructor with compatible argument types. This throws an exception if there is more than one constructor which would accept the given parameters.
| |
| withConstructor | back to summary |
|---|---|
| public IMockBuilder Implements org. Doc from org. Defines the exact argument types for the constructor to use. It is
expected that you call
| |