Package mockit
Class MockInstanceMatchingTest
java.lang.Object
mockit.MockInstanceMatchingTest
The Class MockInstanceMatchingTest.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
matchOnMockInstance
(mockit.MockInstanceMatchingTest.Collaborator otherInstance) Match on mock instance.void
Match on two mock instances.void
matchOnTwoMockInstancesAndReplayInDifferentOrder
(mockit.MockInstanceMatchingTest.Collaborator mock2) Match on two mock instances and replay in different order.void
matchOnTwoMockInstancesForOtherwiseIdenticalExpectations
(mockit.MockInstanceMatchingTest.Collaborator mock2) Match on two mock instances for otherwise identical expectations.void
Record expectation matching on instance created inside code under test.void
recordExpectationsMatchingOnMultipleMockInstances
(mockit.MockInstanceMatchingTest.Collaborator mock2) Record expectations matching on multiple mock instances.void
recordExpectationsOnTwoInstancesOfSameMockedInterface
(DataSource mockDS1, DataSource mockDS2, Attr n) Record expectations on two instances of same mocked interface.void
recordOnMockInstanceButReplayOnDifferentInstance
(mockit.MockInstanceMatchingTest.Collaborator verifiedMock) Record on mock instance but replay on different instance.void
recordOnSpecificMockInstancesButReplayOnDifferentOnes
(mockit.MockInstanceMatchingTest.Collaborator mock2) Record on specific mock instances but replay on different ones.void
Verify expectation matching on mock instance.void
verifyExpectationsMatchingOnMultipleMockInstances
(mockit.MockInstanceMatchingTest.Collaborator mock2) Verify expectations matching on multiple mock instances.void
verifyExpectationsMatchingOnMultipleMockParametersButReplayedOutOfOrder
(AbstractExecutorService es1, AbstractExecutorService es2) Verify expectations matching on multiple mock parameters but replayed out of order.void
verifyExpectationsOnSameMethodCallForDifferentMockedInstances
(mockit.MockInstanceMatchingTest.Collaborator verifiedMock) Verify expectations on same method call for different mocked instances.void
verifyingCallsOnSpecificInstancesOfDifferentSubclasses
(mockit.MockInstanceMatchingTest.SubclassA anyA, mockit.MockInstanceMatchingTest.SubclassA a, mockit.MockInstanceMatchingTest.SubclassB anyB) Verifying calls on specific instances of different subclasses.void
verifyOnMockInstanceButReplayOnDifferentInstance
(mockit.MockInstanceMatchingTest.Collaborator verifiedMock) Verify on mock instance but replay on different instance.void
verifyOnSpecificMockInstancesButReplayOnDifferentOnes
(mockit.MockInstanceMatchingTest.Collaborator mock2) Verify on specific mock instances but replay on different ones.
-
Field Details
-
thrown
public final org.junit.rules.ExpectedException thrownThe thrown.
-
-
Constructor Details
-
MockInstanceMatchingTest
public MockInstanceMatchingTest()
-
-
Method Details
-
matchOnMockInstance
Match on mock instance.- Parameters:
otherInstance
- the other instance
-
recordOnMockInstanceButReplayOnDifferentInstance
public void recordOnMockInstanceButReplayOnDifferentInstance(mockit.MockInstanceMatchingTest.Collaborator verifiedMock) Record on mock instance but replay on different instance.- Parameters:
verifiedMock
- the verified mock
-
verifyExpectationMatchingOnMockInstance
public void verifyExpectationMatchingOnMockInstance(mockit.MockInstanceMatchingTest.Collaborator verifiedMock) Verify expectation matching on mock instance.- Parameters:
verifiedMock
- the verified mock
-
verifyExpectationsOnSameMethodCallForDifferentMockedInstances
public void verifyExpectationsOnSameMethodCallForDifferentMockedInstances(mockit.MockInstanceMatchingTest.Collaborator verifiedMock) Verify expectations on same method call for different mocked instances.- Parameters:
verifiedMock
- the verified mock
-
verifyOnMockInstanceButReplayOnDifferentInstance
public void verifyOnMockInstanceButReplayOnDifferentInstance(mockit.MockInstanceMatchingTest.Collaborator verifiedMock) Verify on mock instance but replay on different instance.- Parameters:
verifiedMock
- the verified mock
-
recordExpectationsMatchingOnMultipleMockInstances
public void recordExpectationsMatchingOnMultipleMockInstances(mockit.MockInstanceMatchingTest.Collaborator mock2) Record expectations matching on multiple mock instances.- Parameters:
mock2
- the mock 2
-
recordOnSpecificMockInstancesButReplayOnDifferentOnes
public void recordOnSpecificMockInstancesButReplayOnDifferentOnes(mockit.MockInstanceMatchingTest.Collaborator mock2) Record on specific mock instances but replay on different ones.- Parameters:
mock2
- the mock 2
-
verifyExpectationsMatchingOnMultipleMockInstances
public void verifyExpectationsMatchingOnMultipleMockInstances(mockit.MockInstanceMatchingTest.Collaborator mock2) Verify expectations matching on multiple mock instances.- Parameters:
mock2
- the mock 2
-
verifyOnSpecificMockInstancesButReplayOnDifferentOnes
public void verifyOnSpecificMockInstancesButReplayOnDifferentOnes(mockit.MockInstanceMatchingTest.Collaborator mock2) Verify on specific mock instances but replay on different ones.- Parameters:
mock2
- the mock 2
-
matchOnTwoMockInstances
Match on two mock instances.- Parameters:
mock2
- the mock 2
-
matchOnTwoMockInstancesAndReplayInDifferentOrder
public void matchOnTwoMockInstancesAndReplayInDifferentOrder(mockit.MockInstanceMatchingTest.Collaborator mock2) Match on two mock instances and replay in different order.- Parameters:
mock2
- the mock 2
-
matchOnTwoMockInstancesForOtherwiseIdenticalExpectations
public void matchOnTwoMockInstancesForOtherwiseIdenticalExpectations(mockit.MockInstanceMatchingTest.Collaborator mock2) Match on two mock instances for otherwise identical expectations.- Parameters:
mock2
- the mock 2
-
verifyExpectationsMatchingOnMultipleMockParametersButReplayedOutOfOrder
public void verifyExpectationsMatchingOnMultipleMockParametersButReplayedOutOfOrder(AbstractExecutorService es1, AbstractExecutorService es2) Verify expectations matching on multiple mock parameters but replayed out of order.- Parameters:
es1
- the es 1es2
- the es 2
-
recordExpectationMatchingOnInstanceCreatedInsideCodeUnderTest
public void recordExpectationMatchingOnInstanceCreatedInsideCodeUnderTest()Record expectation matching on instance created inside code under test. -
recordExpectationsOnTwoInstancesOfSameMockedInterface
public void recordExpectationsOnTwoInstancesOfSameMockedInterface(DataSource mockDS1, DataSource mockDS2, Attr n) throws Exception Record expectations on two instances of same mocked interface.- Parameters:
mockDS1
- the mock DS 1mockDS2
- the mock DS 2n
- the n- Throws:
Exception
- the exception
-
verifyingCallsOnSpecificInstancesOfDifferentSubclasses
public void verifyingCallsOnSpecificInstancesOfDifferentSubclasses(mockit.MockInstanceMatchingTest.SubclassA anyA, mockit.MockInstanceMatchingTest.SubclassA a, mockit.MockInstanceMatchingTest.SubclassB anyB) Verifying calls on specific instances of different subclasses.- Parameters:
anyA
- the any Aa
- the aanyB
- the any B
-