org.unitils.mock
Interface PartialMock<T>
- All Superinterfaces:
- Mock<T>
- All Known Implementing Classes:
- PartialMockObject
public interface PartialMock<T>
- extends Mock<T>
Declares the contract for a controller object that enables defining the behavior of methods of a partial mock object,
or for performing assert statements that verify that certain calls were effectively made. A method is also defined
that provides access to the actual partial mock object.
If Unitils encounters a field declared as PartialMock
, a MockObject
is automatically instantiated and
assigned to the declared field. This mock object will use the original implementation of each method as default
behavior.
Method Summary |
T |
stub()
Stubs out (removes) the behavior of the method when the invocation following
this call matches the observed behavior. |
Methods inherited from interface org.unitils.mock.Mock |
assertInvoked, assertInvokedInSequence, assertNotInvoked, getMock, oncePerforms, onceRaises, onceRaises, onceReturns, performs, raises, raises, resetBehavior, returns |
stub
T stub()
- Stubs out (removes) the behavior of the method when the invocation following
this call matches the observed behavior. E.g.
mock.stub().method1();
will not invoke the actual behavior of method1.
If the method has a return type, a default value will be returned.
Note: stubbed methods can still be asserted afterwards: e.g.
mock.assertInvoked().method1();
- Returns:
- The proxy instance that will record the method call, not null
Copyright © 2011. All Rights Reserved.