org.powermock.api.support.membermodification
Class MemberModifier

java.lang.Object
  extended by org.powermock.api.support.membermodification.MemberMatcher
      extended by 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
MemberModifier()
           
 
Method Summary
static MethodReplaceStrategy replace(Method method)
          Replace a method invocation.
static
<T> MethodStubStrategy<T>
stub(Method method)
          Add a method that should be intercepted and return another value (i.e.
static void suppress(AccessibleObject[] accessibleObjects)
          Suppress an array of accessible objects.
static void suppress(Constructor<?> constructor)
          Suppress a constructor.
static void suppress(Constructor<?>[] constructors)
          Suppress multiple constructors.
static void suppress(Field field)
          Suppress a field.
static void suppress(Field[] fields)
          Suppress multiple fields.
static void suppress(Method method)
          Suppress a specific method.
static void suppress(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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemberModifier

public MemberModifier()
Method Detail

suppress

public static void suppress(Method method)
Suppress a specific method. This works on both instance methods and static methods.


suppress

public static void suppress(Method[] methods)
Suppress multiple methods. This works on both instance methods and static methods.


suppress

public static void suppress(Constructor<?> constructor)
Suppress a constructor.


suppress

public static void suppress(Constructor<?>[] constructors)
Suppress multiple constructors.


suppress

public static void suppress(Field field)
Suppress a field.


suppress

public static void suppress(Field[] fields)
Suppress multiple fields.


suppress

public static void suppress(AccessibleObject[] accessibleObjects)
Suppress an array of accessible objects.


stub

public static <T> MethodStubStrategy<T> stub(Method method)
Add a method that should be intercepted and return another value (i.e. the method is stubbed).


replace

public static MethodReplaceStrategy replace(Method method)
Replace a method invocation.



Copyright © 2007-2012. All Rights Reserved.