org.powermock.core
Class MockGateway
java.lang.Object
org.powermock.core.MockGateway
public class MockGateway
- extends Object
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.
Method Summary |
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)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PROCEED
public static final Object PROCEED
SUPPRESS
public static final Object SUPPRESS
DONT_MOCK_NEXT_CALL
public static final 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
. Used to allow for e.g. recursive partial mocking.
- See Also:
- Constant Field Values
MOCK_STANDARD_METHODS
public static boolean MOCK_STANDARD_METHODS
- Tells PowerMock to mock standard methods. These are
Object.toString()
, Object.hashCode()
and
Object.equals(Object)
. By default this is true
.
MOCK_GET_CLASS_METHOD
public static boolean MOCK_GET_CLASS_METHOD
- Tells PowerMock whether or not to mock
Object.getClass()
.
MockGateway
public MockGateway()
methodCall
public static Object methodCall(Class<?> type,
String methodName,
Object[] args,
Class<?>[] sig,
String returnTypeAsString)
throws Throwable
- Throws:
Throwable
methodCall
public static Object methodCall(Object instance,
String methodName,
Object[] args,
Class<?>[] sig,
String returnTypeAsString)
throws Throwable
- Throws:
Throwable
newInstanceCall
public static Object newInstanceCall(Class<?> type,
Object[] args,
Class<?>[] sig)
throws Throwable
- Throws:
Throwable
fieldCall
public static Object fieldCall(Object instanceOrClassContainingTheField,
Class<?> classDefiningField,
String fieldName,
Class<?> fieldType)
staticConstructorCall
public static Object staticConstructorCall(String className)
constructorCall
public static Object constructorCall(Class<?> type,
Object[] args,
Class<?>[] sig)
throws Throwable
- Throws:
Throwable
Copyright © 2007-2012. All Rights Reserved.