Class MemberModifier
- java.lang.Object
-
- org.powermock.api.support.membermodification.MemberMatcher
-
- org.powermock.api.support.membermodification.MemberModifier
-
- Direct Known Subclasses:
PowerMock
,PowerMockito
public class MemberModifier extends MemberMatcher
Contains various utilities for modifying members of classes such as constructors, fields and methods. Modifying means e.g. changing return value of method invocations or suppressing a constructor.
-
-
Constructor Summary
Constructors Constructor Description MemberModifier()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MethodReplaceStrategy
replace(java.lang.reflect.Method method)
Replace a method invocation.static <T> MethodStubStrategy<T>
stub(java.lang.reflect.Method method)
Add a method that should be intercepted and return another value (i.e.static void
suppress(java.lang.reflect.AccessibleObject[] accessibleObjects)
Suppress an array of accessible objects.static void
suppress(java.lang.reflect.Constructor<?> constructor)
Suppress a constructor.static void
suppress(java.lang.reflect.Constructor<?>[] constructors)
Suppress multiple constructors.static void
suppress(java.lang.reflect.Field field)
Suppress a field.static void
suppress(java.lang.reflect.Field[] fields)
Suppress multiple fields.static void
suppress(java.lang.reflect.Method method)
Suppress a specific method.static void
suppress(java.lang.reflect.Method[] methods)
Suppress multiple methods.-
Methods inherited from class org.powermock.api.support.membermodification.MemberMatcher
constructor, constructor, constructors, constructorsDeclaredIn, defaultConstructorIn, everythingDeclaredIn, field, fields, fields, fields, fields, method, method, methods, methods, methods, methodsDeclaredIn
-
-
-
-
Method Detail
-
suppress
public static void suppress(java.lang.reflect.Method method)
Suppress a specific method. This works on both instance methods and static methods.
-
suppress
public static void suppress(java.lang.reflect.Method[] methods)
Suppress multiple methods. This works on both instance methods and static methods.
-
suppress
public static void suppress(java.lang.reflect.Constructor<?> constructor)
Suppress a constructor.
-
suppress
public static void suppress(java.lang.reflect.Constructor<?>[] constructors)
Suppress multiple constructors.
-
suppress
public static void suppress(java.lang.reflect.Field field)
Suppress a field.
-
suppress
public static void suppress(java.lang.reflect.Field[] fields)
Suppress multiple fields.
-
suppress
public static void suppress(java.lang.reflect.AccessibleObject[] accessibleObjects)
Suppress an array of accessible objects.
-
stub
public static <T> MethodStubStrategy<T> stub(java.lang.reflect.Method method)
Add a method that should be intercepted and return another value (i.e. the method is stubbed).
-
replace
public static MethodReplaceStrategy replace(java.lang.reflect.Method method)
Replace a method invocation.
-
-