|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.unitils.mock.core.MockObject<T>
org.unitils.mock.core.PartialMockObject<T>
public class PartialMockObject<T>
Implementation of a PartialMock. For a partial mock, if a method is called that is not mocked, the original behavior will be called.
Field Summary |
---|
Fields inherited from class org.unitils.mock.core.MockObject |
---|
alwaysMatchingBehaviorDefiningInvocations, chainedMocksPerName, matchingInvocationBuilderThreadLocal, mockedType, mockProxy, name, oneTimeMatchingBehaviorDefiningInvocations, scenarioThreadLocal |
Constructor Summary | |
---|---|
PartialMockObject(Class<?> mockedType,
Object testObject)
Creates a mock of the given type with un-capitalized type name + Mock as name, e.g. myServiceMock. |
|
PartialMockObject(Object mockPrototype,
Object testObject)
Creates a mock of the same type as the given mock prototype with un-capitalized type name + Mock as name, e.g. myServiceMock. |
|
PartialMockObject(String name,
Class<?> mockedType,
Object testObject)
Creates a mock of the given type for the given scenario. |
|
PartialMockObject(String name,
Object mockedInstance,
Object testObject)
Creates a mock of the same type as the given mock prototype with the given name. |
Method Summary | |
---|---|
protected MockProxy<T> |
createMockProxy()
|
T |
stub()
Stubs out (removes) the behavior of the method when the invocation following this call matches the observed behavior. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.unitils.mock.Mock |
---|
assertInvoked, assertInvokedInSequence, assertNotInvoked, getMock, oncePerforms, onceRaises, onceRaises, onceReturns, performs, raises, raises, resetBehavior, returns |
Constructor Detail |
---|
public PartialMockObject(Object mockPrototype, Object testObject)
mockPrototype
- The instance that will be wrapped with a proxy, use the raw type when mocking generic types, not nulltestObject
- The test object, not nullpublic PartialMockObject(String name, Object mockedInstance, Object testObject)
name
- The name of the mock, e.g. the field-name, null for the defaultmockedInstance
- The instance that will be wrapped with a proxy, use the raw type when mocking generic types, not nulltestObject
- The test object, not nullpublic PartialMockObject(Class<?> mockedType, Object testObject)
mockedType
- The mock type that will be proxied, use the raw type when mocking generic types, not nulltestObject
- The test object, not nullpublic PartialMockObject(String name, Class<?> mockedType, Object testObject)
name
- The name of the mock, e.g. the field-name, null for the defaultmockedType
- The mock type that will be proxied, use the raw type when mocking generic types, not nulltestObject
- The test object, not nullMethod Detail |
---|
public T stub()
stub
in interface PartialMock<T>
protected MockProxy<T> createMockProxy()
createMockProxy
in class MockObject<T>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |