Class MockGateway
java.lang.Object
org.powermock.core.MockGateway
All mock invocations are routed through this gateway. This includes method
calls, construction of new instances and more. Do not use this class
directly, but always go through the PowerMock facade.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringUsed to tell the MockGateway that the next call should not be mocked regardless if aMethodInvocationControlis found in theMockRepository.static booleanTells PowerMock whether or not to mockClass.isAnnotationPresent(Class)andClass.getAnnotation(Class).static booleanTells PowerMock whether or not to mockObject.getClass().static booleanTells PowerMock to mock standard methods.static final Objectstatic final Object -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectconstructorCall(Class<?> type, Object[] args, Class<?>[] sig) static ObjectfieldCall(Object instanceOrClassContainingTheField, Class<?> classDefiningField, String fieldName, Class<?> fieldType) static ObjectmethodCall(Class<?> type, String methodName, Object[] args, Class<?>[] sig, String returnTypeAsString) static ObjectmethodCall(Object instance, String methodName, Object[] args, Class<?>[] sig, String returnTypeAsString) static ObjectnewInstanceCall(Class<?> type, Object[] args, Class<?>[] sig) static ObjectstaticConstructorCall(String className) static booleansuppressConstructorCall(Class<?> type, Object[] args, Class<?>[] sig)
-
Field Details
-
PROCEED
-
SUPPRESS
-
DONT_MOCK_NEXT_CALL
Used to tell the MockGateway that the next call should not be mocked regardless if aMethodInvocationControlis found in theMockRepository. Used to allow for e.g. recursive partial mocking.- See Also:
-
MOCK_STANDARD_METHODS
public static boolean MOCK_STANDARD_METHODSTells PowerMock to mock standard methods. These areObject.toString(),Object.hashCode()andObject.equals(Object). By default this istrue. -
MOCK_GET_CLASS_METHOD
public static boolean MOCK_GET_CLASS_METHODTells PowerMock whether or not to mockObject.getClass(). -
MOCK_ANNOTATION_METHODS
public static boolean MOCK_ANNOTATION_METHODSTells PowerMock whether or not to mockClass.isAnnotationPresent(Class)andClass.getAnnotation(Class).
-
-
Constructor Details
-
MockGateway
public MockGateway()
-
-
Method Details
-
newInstanceCall
-
fieldCall
-
staticConstructorCall
-
constructorCall
-
suppressConstructorCall
-
methodCall
-
methodCall
-