public class MockGateway extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DONT_MOCK_NEXT_CALL
Used to tell the MockGateway that the next call should not be mocked
regardless if a
MethodInvocationControl is found in the
MockRepository . |
static boolean |
MOCK_ANNOTATION_METHODS
Tells PowerMock whether or not to mock
Class.isAnnotationPresent(Class) and
Class.getAnnotation(Class) . |
static boolean |
MOCK_GET_CLASS_METHOD
Tells PowerMock whether or not to mock
Object.getClass() . |
static boolean |
MOCK_STANDARD_METHODS
Tells PowerMock to mock standard methods.
|
static Object |
PROCEED |
static Object |
SUPPRESS |
Constructor and Description |
---|
MockGateway() |
Modifier and Type | Method and Description |
---|---|
static Object |
constructorCall(Class<?> type,
Object[] args,
Class<?>[] sig) |
static Object |
fieldCall(Object instanceOrClassContainingTheField,
Class<?> classDefiningField,
String fieldName,
Class<?> fieldType) |
static Object |
methodCall(Class<?> type,
String methodName,
Object[] args,
Class<?>[] sig,
String returnTypeAsString) |
static Object |
methodCall(Object instance,
String methodName,
Object[] args,
Class<?>[] sig,
String returnTypeAsString) |
static Object |
newInstanceCall(Class<?> type,
Object[] args,
Class<?>[] sig) |
static Object |
staticConstructorCall(String className) |
static boolean |
suppressConstructorCall(Class<?> type,
Object[] args,
Class<?>[] sig) |
public static final Object PROCEED
public static final Object SUPPRESS
public static final String DONT_MOCK_NEXT_CALL
MethodInvocationControl
is found in the
MockRepository
. Used to allow for e.g. recursive partial mocking.public static boolean MOCK_STANDARD_METHODS
Object.toString()
, Object.hashCode()
and
Object.equals(Object)
. By default this is true
.public static boolean MOCK_GET_CLASS_METHOD
Object.getClass()
.public static boolean MOCK_ANNOTATION_METHODS
Class.isAnnotationPresent(Class)
and
Class.getAnnotation(Class)
.public static Object newInstanceCall(Class<?> type, Object[] args, Class<?>[] sig) throws Throwable
Throwable
public static Object fieldCall(Object instanceOrClassContainingTheField, Class<?> classDefiningField, String fieldName, Class<?> fieldType)
public static Object constructorCall(Class<?> type, Object[] args, Class<?>[] sig) throws Throwable
Throwable
public static boolean suppressConstructorCall(Class<?> type, Object[] args, Class<?>[] sig) throws Throwable
Throwable
public static Object methodCall(Object instance, String methodName, Object[] args, Class<?>[] sig, String returnTypeAsString) throws Throwable
Throwable
Copyright © 2019. All rights reserved.