Package com.google.common.testing
Class ForwardingWrapperTester.InteractionTester<T>
- java.lang.Object
-
- com.google.common.reflect.AbstractInvocationHandler
-
- com.google.common.testing.ForwardingWrapperTester.InteractionTester<T>
-
- All Implemented Interfaces:
java.lang.reflect.InvocationHandler
- Enclosing class:
- ForwardingWrapperTester
private static final class ForwardingWrapperTester.InteractionTester<T> extends AbstractInvocationHandler
Tests a single interaction against a method.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicIntegercalledprivate java.lang.Class<T>interfaceTypeprivate java.lang.reflect.Methodmethodprivate java.lang.Object[]passedArgsprivate java.lang.ObjectreturnValue
-
Constructor Summary
Constructors Constructor Description InteractionTester(java.lang.Class<T> interfaceType, java.lang.reflect.Method method)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.ObjecthandleInvocation(java.lang.Object p, java.lang.reflect.Method calledMethod, java.lang.Object[] args)AbstractInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])delegates to this method upon any method invocation on the proxy instance, exceptObject.equals(java.lang.Object),Object.hashCode()andObject.toString().(package private) voidtestInteraction(Function<? super T,? extends T> wrapperFunction)java.lang.StringtoString()By default delegates toObject.toString().-
Methods inherited from class com.google.common.reflect.AbstractInvocationHandler
equals, hashCode, invoke
-
-
-
-
Field Detail
-
interfaceType
private final java.lang.Class<T> interfaceType
-
method
private final java.lang.reflect.Method method
-
passedArgs
private final java.lang.Object[] passedArgs
-
returnValue
private final java.lang.Object returnValue
-
called
private final java.util.concurrent.atomic.AtomicInteger called
-
-
Constructor Detail
-
InteractionTester
InteractionTester(java.lang.Class<T> interfaceType, java.lang.reflect.Method method)
-
-
Method Detail
-
handleInvocation
protected java.lang.Object handleInvocation(java.lang.Object p, java.lang.reflect.Method calledMethod, java.lang.Object[] args) throws java.lang.ThrowableDescription copied from class:AbstractInvocationHandlerAbstractInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])delegates to this method upon any method invocation on the proxy instance, exceptObject.equals(java.lang.Object),Object.hashCode()andObject.toString(). The result will be returned as the proxied method's return value.Unlike
AbstractInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]),argswill never be null. When the method has no parameter, an empty array is passed in.- Specified by:
handleInvocationin classAbstractInvocationHandler- Throws:
java.lang.Throwable
-
toString
public java.lang.String toString()
Description copied from class:AbstractInvocationHandlerBy default delegates toObject.toString(). The dynamic proxies'toString()will delegate to this method. Subclasses can override this method to provide custom string representation for the proxies.- Overrides:
toStringin classAbstractInvocationHandler
-
-