Package mockit
Class ExpectationsTest
java.lang.Object
mockit.ExpectationsTest
The Class ExpectationsTest.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Expectations recorded on same method with matcher in one and fixed argument in another.void
Expectations recorded on same method with same matchers but different arguments.void
Expect nothing on mocked type but exercise it during replay.void
Expect only one invocation but exercise others during replay.void
Failure from unexpected invocation in another thread.void
Mocked class with annotated elements.void
recordingExpectationOnMethodWithOneArgumentButReplayingWithAnotherShouldProduceUsefulErrorMessage
(mockit.ExpectationsTest.Collaborator mock) Recording expectation on method with one argument but replaying with another should produce useful error message.void
Record invocations with expected invocation counts.void
Record invocations with min invocation count larger than will occur.void
Record invocation that will not occur.void
Record invocation with exact expected number of invocations but fail to satisfy.void
Record invocation with maximum expected number of invocations but fail to satisfy.void
Record invocation with minimum expected number of invocations but fail to satisfy.void
Record simple invocations.void
Record with argument matcher and individual invocation counts.void
Record with max invocation count followed by return value.void
Record with max invocation count followed by return value but replay one time beyond max.void
Record with min invocation count followed by return value using delegate.void
Record with return value followed by expected invocation count.void
Replay with unexpected static method invocation.
-
Field Details
-
thrown
public final org.junit.rules.ExpectedException thrownThe thrown.
-
-
Constructor Details
-
ExpectationsTest
public ExpectationsTest()
-
-
Method Details
-
recordSimpleInvocations
public void recordSimpleInvocations()Record simple invocations. -
recordInvocationThatWillNotOccur
public void recordInvocationThatWillNotOccur()Record invocation that will not occur. -
expectationsRecordedOnSameMethodWithSameMatchersButDifferentArguments
public void expectationsRecordedOnSameMethodWithSameMatchersButDifferentArguments()Expectations recorded on same method with same matchers but different arguments. -
expectationsRecordedOnSameMethodWithMatcherInOneAndFixedArgumentInAnother
public void expectationsRecordedOnSameMethodWithMatcherInOneAndFixedArgumentInAnother()Expectations recorded on same method with matcher in one and fixed argument in another. -
recordInvocationWithExactExpectedNumberOfInvocationsButFailToSatisfy
public void recordInvocationWithExactExpectedNumberOfInvocationsButFailToSatisfy()Record invocation with exact expected number of invocations but fail to satisfy. -
recordInvocationWithMinimumExpectedNumberOfInvocationsButFailToSatisfy
public void recordInvocationWithMinimumExpectedNumberOfInvocationsButFailToSatisfy()Record invocation with minimum expected number of invocations but fail to satisfy. -
recordInvocationWithMaximumExpectedNumberOfInvocationsButFailToSatisfy
public void recordInvocationWithMaximumExpectedNumberOfInvocationsButFailToSatisfy()Record invocation with maximum expected number of invocations but fail to satisfy. -
recordInvocationsWithExpectedInvocationCounts
public void recordInvocationsWithExpectedInvocationCounts()Record invocations with expected invocation counts. -
recordInvocationsWithMinInvocationCountLargerThanWillOccur
public void recordInvocationsWithMinInvocationCountLargerThanWillOccur()Record invocations with min invocation count larger than will occur. -
recordWithArgumentMatcherAndIndividualInvocationCounts
public void recordWithArgumentMatcherAndIndividualInvocationCounts()Record with argument matcher and individual invocation counts. -
recordWithMaxInvocationCountFollowedByReturnValue
public void recordWithMaxInvocationCountFollowedByReturnValue()Record with max invocation count followed by return value. -
recordWithMaxInvocationCountFollowedByReturnValueButReplayOneTimeBeyondMax
public void recordWithMaxInvocationCountFollowedByReturnValueButReplayOneTimeBeyondMax()Record with max invocation count followed by return value but replay one time beyond max. -
recordWithReturnValueFollowedByExpectedInvocationCount
public void recordWithReturnValueFollowedByExpectedInvocationCount()Record with return value followed by expected invocation count. -
recordWithMinInvocationCountFollowedByReturnValueUsingDelegate
public void recordWithMinInvocationCountFollowedByReturnValueUsingDelegate()Record with min invocation count followed by return value using delegate. -
mockedClassWithAnnotatedElements
Mocked class with annotated elements.- Throws:
Exception
- the exception
-
expectOnlyOneInvocationButExerciseOthersDuringReplay
public void expectOnlyOneInvocationButExerciseOthersDuringReplay(mockit.ExpectationsTest.Collaborator mock) Expect only one invocation but exercise others during replay.- Parameters:
mock
- the mock
-
expectNothingOnMockedTypeButExerciseItDuringReplay
public void expectNothingOnMockedTypeButExerciseItDuringReplay(mockit.ExpectationsTest.Collaborator mock) Expect nothing on mocked type but exercise it during replay.- Parameters:
mock
- the mock
-
replayWithUnexpectedStaticMethodInvocation
Replay with unexpected static method invocation.- Parameters:
mock
- the mock
-
failureFromUnexpectedInvocationInAnotherThread
public void failureFromUnexpectedInvocationInAnotherThread(mockit.ExpectationsTest.Collaborator mock) throws Exception Failure from unexpected invocation in another thread.- Parameters:
mock
- the mock- Throws:
Exception
- the exception
-
recordingExpectationOnMethodWithOneArgumentButReplayingWithAnotherShouldProduceUsefulErrorMessage
public void recordingExpectationOnMethodWithOneArgumentButReplayingWithAnotherShouldProduceUsefulErrorMessage(mockit.ExpectationsTest.Collaborator mock) Recording expectation on method with one argument but replaying with another should produce useful error message.- Parameters:
mock
- the mock
-