|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.easymock.internal.MockBuilder<T>
T - type of the mock createdpublic class MockBuilder<T>
Default implementation of IMockBuilder.
The original idea and part of the code where contributed by Rodrigo Damazio and Bruno Fonseca at Google
| Constructor Summary | |
|---|---|
MockBuilder(Class<T> toMock)
|
|
MockBuilder(Class<T> toMock,
EasyMockSupport support)
Used by EasyMockSupport to allow the mock registration in the list of controls |
|
| Method Summary | |
|---|---|
IMockBuilder<T> |
addMockedMethod(Method method)
Adds a method to be mocked in the testing class. |
IMockBuilder<T> |
addMockedMethod(String methodName)
Adds a method to be mocked in the testing class. |
IMockBuilder<T> |
addMockedMethod(String methodName,
Class<?>... parameterTypes)
Adds a method to be mocked in the testing class. |
IMockBuilder<T> |
addMockedMethods(Method... methods)
Adds methods to be mocked in the testing class. |
IMockBuilder<T> |
addMockedMethods(String... methodNames)
Adds methods to be mocked in the testing class. |
T |
createMock()
Create a default mock from this builder. |
T |
createMock(IMocksControl control)
Create mock from the provided mock control using the arguments passed to the builder. |
T |
createMock(String name)
Create named mock from the provided mock control using the arguments passed to the builder. |
T |
createMock(String name,
IMocksControl control)
Create named mock from the provided mock control using the arguments passed to the builder. |
T |
createNiceMock()
Create a nice mock from this builder. |
T |
createNiceMock(String name)
Create a named nice mock from this builder. |
T |
createStrictMock()
Create a strict mock from this builder. |
T |
createStrictMock(String name)
Create a named strict mock from this builder. |
IMockBuilder<T> |
withArgs(Object... initArgs)
Defines the arguments to be passed to the constructor of the class. |
IMockBuilder<T> |
withConstructor()
Defines the empty constructor should be called. |
IMockBuilder<T> |
withConstructor(Class<?>... argTypes)
Defines the exact argument types for the constructor to use. |
IMockBuilder<T> |
withConstructor(Constructor<?> constructor)
Defines the constructor to use to instantiate the mock. |
IMockBuilder<T> |
withConstructor(ConstructorArgs constructorArgs)
|
IMockBuilder<T> |
withConstructor(Object... initArgs)
Defines the constructor parameters for the mocked class. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MockBuilder(Class<T> toMock)
public MockBuilder(Class<T> toMock,
EasyMockSupport support)
toMock - The class of the mock to createsupport - The EasyMockSupport used to create mocks. Null if none| Method Detail |
|---|
public IMockBuilder<T> addMockedMethod(Method method)
IMockBuilder
addMockedMethod in interface IMockBuilder<T>method - method to be mocked
public IMockBuilder<T> addMockedMethod(String methodName)
IMockBuilderaddMockedMethods in this class if that is the case.
addMockedMethod in interface IMockBuilder<T>methodName - name of the method to be mocked
public IMockBuilder<T> addMockedMethod(String methodName,
Class<?>... parameterTypes)
IMockBuilder
addMockedMethod in interface IMockBuilder<T>methodName - name of the method to be mockedparameterTypes - types of the parameters of the method
public IMockBuilder<T> addMockedMethods(String... methodNames)
IMockBuilderIMockBuilder.addMockedMethod(String) but to mock many methods at once.
addMockedMethods in interface IMockBuilder<T>methodNames - names of the methods to be mocked
public IMockBuilder<T> addMockedMethods(Method... methods)
IMockBuilderIMockBuilder.addMockedMethod(Method) but to mock many methods at once.
addMockedMethods in interface IMockBuilder<T>methods - methods to be mocked
public IMockBuilder<T> withConstructor(Constructor<?> constructor)
IMockBuilderIMockBuilder.withArgs(java.lang.Object...) with the actual constructor argument
values after this.
withConstructor in interface IMockBuilder<T>constructor - the constructor to be called
public IMockBuilder<T> withConstructor(ConstructorArgs constructorArgs)
public IMockBuilder<T> withConstructor()
IMockBuilder
withConstructor in interface IMockBuilder<T>public IMockBuilder<T> withConstructor(Object... initArgs)
IMockBuilder
withConstructor in interface IMockBuilder<T>initArgs - arguments of the constructor
public IMockBuilder<T> withConstructor(Class<?>... argTypes)
IMockBuilderIMockBuilder.withArgs(java.lang.Object...) with the actual constructor
argument values after this.
withConstructor in interface IMockBuilder<T>argTypes - the exact argument types of the constructor
public IMockBuilder<T> withArgs(Object... initArgs)
IMockBuilderIMockBuilder.withConstructor(Class...) or
IMockBuilder.withConstructor(Constructor).
withArgs in interface IMockBuilder<T>initArgs - the arguments to pass to the constructor
public T createMock(IMocksControl control)
IMockBuilder
createMock in interface IMockBuilder<T>control - IMocksControl used to create the object
public T createMock()
IMockBuilder
createMock in interface IMockBuilder<T>public T createNiceMock()
IMockBuilder
createNiceMock in interface IMockBuilder<T>public T createStrictMock()
IMockBuilder
createStrictMock in interface IMockBuilder<T>
public T createMock(String name,
IMocksControl control)
IMockBuilder
createMock in interface IMockBuilder<T>name - the mock namecontrol - IMocksControl used to create the object
public T createMock(String name)
IMockBuilder
createMock in interface IMockBuilder<T>name - the mock name
public T createNiceMock(String name)
IMockBuilder
createNiceMock in interface IMockBuilder<T>name - the mock name
public T createStrictMock(String name)
IMockBuilder
createStrictMock in interface IMockBuilder<T>name - the mock name
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||