public interface Mock<T>
Mock, a MockObject is automatically instantiated and
assigned to the declared field.| Modifier and Type | Method and Description |
|---|---|
T |
assertInvoked()
Asserts that an invocation that matches the invocation following this call has been observed
on this mock object during this test.
|
T |
assertInvokedInSequence()
Asserts that an invocation that matches the invocation following this call has been observed
on this mock object during this test.
|
T |
assertNotInvoked()
Asserts that no invocation that matches the invocation following this call has been observed
on this mock object during this test.
|
T |
getMock()
Gets the mock proxy instance.
|
T |
oncePerforms(MockBehavior mockBehavior)
Defines behavior for this mock so that will be performed when the invocation following
this call matches the observed behavior.
|
T |
onceRaises(Class<? extends Throwable> exceptionClass)
Defines behavior for this mock so that it raises an instance of the given exception class when the invocation following
this call matches the observed behavior.
|
T |
onceRaises(Throwable exception)
Defines behavior for this mock so that it raises an instance of the given exception class when the invocation following
this call matches the observed behavior.
|
T |
onceReturns(Object returnValue)
Defines behavior for this mock so that it will return the given value when the invocation following
this call matches the observed behavior.
|
T |
performs(MockBehavior mockBehavior)
Defines behavior for this mock so that will be performed when the invocation following
this call matches the observed behavior.
|
T |
raises(Class<? extends Throwable> exceptionClass)
Defines behavior for this mock so that it raises an instance of the given exception class when the invocation following
this call matches the observed behavior.
|
T |
raises(Throwable exception)
Defines behavior for this mock so that it raises the given exception when the invocation following
this call matches the observed behavior.
|
void |
resetBehavior()
Removes all behavior defined for this mock.
|
T |
returns(Object returnValue)
Defines behavior for this mock so that it will return the given value when the invocation following
this call matches the observed behavior.
|
T getMock()
T returns(Object returnValue)
onceReturns(java.lang.Object) method.returnValue - The value to returnT raises(Throwable exception)
onceRaises(java.lang.Throwable) method.exception - The exception to raise, not nullT raises(Class<? extends Throwable> exceptionClass)
onceRaises(java.lang.Throwable) method.exceptionClass - The class of the exception to raise, not nullT performs(MockBehavior mockBehavior)
oncePerforms(org.unitils.mock.mockbehavior.MockBehavior) method.mockBehavior - The behavior to perform, not nullT onceReturns(Object returnValue)
returns(java.lang.Object) instead.returnValue - The value to returnT onceRaises(Throwable exception)
raises(java.lang.Throwable) instead.exception - The exception to raise, not nullT onceRaises(Class<? extends Throwable> exceptionClass)
raises(java.lang.Throwable) instead.exceptionClass - The class of the exception to raise, not nullT oncePerforms(MockBehavior mockBehavior)
performs(org.unitils.mock.mockbehavior.MockBehavior) instead.mockBehavior - The behavior to perform, not nullT assertInvoked()
T assertInvokedInSequence()
T assertNotInvoked()
void resetBehavior()
Copyright © 2016. All Rights Reserved.