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.AtomicInteger
called
private java.lang.Class<T>
interfaceType
private java.lang.reflect.Method
method
private java.lang.Object[]
passedArgs
private java.lang.Object
returnValue
-
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.Object
handleInvocation(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) void
testInteraction(Function<? super T,? extends T> wrapperFunction)
java.lang.String
toString()
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.Throwable
Description copied from class:AbstractInvocationHandler
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()
. 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[])
,args
will never be null. When the method has no parameter, an empty array is passed in.- Specified by:
handleInvocation
in classAbstractInvocationHandler
- Throws:
java.lang.Throwable
-
toString
public java.lang.String toString()
Description copied from class:AbstractInvocationHandler
By 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:
toString
in classAbstractInvocationHandler
-
-