Package mockit
Class PartialMockingTest
java.lang.Object
mockit.PartialMockingTest
The Class PartialMockingTest.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
The Interface AnotherInterface. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Attempt to partially mock A class.void
Attempt to partially mock native method.void
attemptToUseDynamicMockingForInvalidTypes
(PartialMockingTest.AnotherInterface publicInterfaceMock, mockit.PartialMockingTest.NonPublicInterface nonPublicInterfaceMock) Attempt to use dynamic mocking for invalid types.void
Dynamically mock an anonymous class instance through the implemented interface.void
Dynamically mock an instance.void
Dynamically mock A sub collaborator instance.void
Dynamic mock fully verified verify all recorded expectations but not all of the replayed ones.void
Dynamic mock fully verified in order verify all recorded expectations but not all of the replayed ones.void
Dynamic partial mocking with exact argument matching.void
Dynamic partial mocking with flexible argument matching.void
Dynamic partial mocking with instance specific matching.void
Dynamic partial mocking with instance specific matching on two instances of same class.void
Expect one invocation on dynamic mock but replay twice.void
Expect two invocations on dynamic mock but replay once.void
Method with no recorded expectation called twice during replay.void
Mock annotated constructor.void
mockClassIndirectlyExtendingBaseWhoseFirstConstructorHasMoreParametersThanTheSecondOne
(mockit.PartialMockingTest.SubSubClass mock) Mock class indirectly extending base whose first constructor has more parameters than the second one.void
Mock method in same class.
-
Field Details
-
thrown
public final org.junit.rules.ExpectedException thrownThe thrown.
-
-
Constructor Details
-
PartialMockingTest
public PartialMockingTest()
-
-
Method Details
-
attemptToPartiallyMockAClass
public void attemptToPartiallyMockAClass()Attempt to partially mock A class. -
dynamicMockFullyVerified_verifyAllRecordedExpectationsButNotAllOfTheReplayedOnes
public void dynamicMockFullyVerified_verifyAllRecordedExpectationsButNotAllOfTheReplayedOnes()Dynamic mock fully verified verify all recorded expectations but not all of the replayed ones. -
dynamicMockFullyVerifiedInOrder_verifyAllRecordedExpectationsButNotAllOfTheReplayedOnes
public void dynamicMockFullyVerifiedInOrder_verifyAllRecordedExpectationsButNotAllOfTheReplayedOnes()Dynamic mock fully verified in order verify all recorded expectations but not all of the replayed ones. -
expectTwoInvocationsOnDynamicMockButReplayOnce
public void expectTwoInvocationsOnDynamicMockButReplayOnce()Expect two invocations on dynamic mock but replay once. -
expectOneInvocationOnDynamicMockButReplayTwice
public void expectOneInvocationOnDynamicMockButReplayTwice()Expect one invocation on dynamic mock but replay twice. -
dynamicallyMockAnInstance
public void dynamicallyMockAnInstance()Dynamically mock an instance. -
mockMethodInSameClass
public void mockMethodInSameClass()Mock method in same class. -
dynamicallyMockASubCollaboratorInstance
public void dynamicallyMockASubCollaboratorInstance()Dynamically mock A sub collaborator instance. -
dynamicallyMockAnAnonymousClassInstanceThroughTheImplementedInterface
public void dynamicallyMockAnAnonymousClassInstanceThroughTheImplementedInterface()Dynamically mock an anonymous class instance through the implemented interface. -
attemptToUseDynamicMockingForInvalidTypes
public void attemptToUseDynamicMockingForInvalidTypes(PartialMockingTest.AnotherInterface publicInterfaceMock, mockit.PartialMockingTest.NonPublicInterface nonPublicInterfaceMock) Attempt to use dynamic mocking for invalid types.- Parameters:
publicInterfaceMock
- the public interface mocknonPublicInterfaceMock
- the non public interface mock
-
dynamicPartialMockingWithExactArgumentMatching
public void dynamicPartialMockingWithExactArgumentMatching()Dynamic partial mocking with exact argument matching. -
dynamicPartialMockingWithFlexibleArgumentMatching
public void dynamicPartialMockingWithFlexibleArgumentMatching()Dynamic partial mocking with flexible argument matching. -
dynamicPartialMockingWithInstanceSpecificMatching
public void dynamicPartialMockingWithInstanceSpecificMatching()Dynamic partial mocking with instance specific matching. -
dynamicPartialMockingWithInstanceSpecificMatchingOnTwoInstancesOfSameClass
public void dynamicPartialMockingWithInstanceSpecificMatchingOnTwoInstancesOfSameClass()Dynamic partial mocking with instance specific matching on two instances of same class. -
methodWithNoRecordedExpectationCalledTwiceDuringReplay
public void methodWithNoRecordedExpectationCalledTwiceDuringReplay()Method with no recorded expectation called twice during replay. -
attemptToPartiallyMockNativeMethod
public void attemptToPartiallyMockNativeMethod()Attempt to partially mock native method. -
mockAnnotatedConstructor
Mock annotated constructor.- Parameters:
mock
- the mock- Throws:
Exception
- the exception
-
mockClassIndirectlyExtendingBaseWhoseFirstConstructorHasMoreParametersThanTheSecondOne
public void mockClassIndirectlyExtendingBaseWhoseFirstConstructorHasMoreParametersThanTheSecondOne(mockit.PartialMockingTest.SubSubClass mock) Mock class indirectly extending base whose first constructor has more parameters than the second one.- Parameters:
mock
- the mock
-