Package com.google.common.testing
Class ForwardingWrapperTester
- java.lang.Object
-
- com.google.common.testing.ForwardingWrapperTester
-
@GwtIncompatible public final class ForwardingWrapperTester extends Object
Tester to ensure forwarding wrapper works by delegating calls to the corresponding method with the same parameters forwarded and return value forwarded back or exception propagated as is.For example:
new ForwardingWrapperTester().testForwarding(Foo.class, new Function<Foo, Foo>() { public Foo apply(Foo foo) { return new ForwardingFoo(foo); } });
- Since:
- 14.0
- Author:
- Ben Yu
-
-
Constructor Summary
Constructors Constructor Description ForwardingWrapperTester()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ForwardingWrapperTester
includingEquals()
Asks forObject.equals(java.lang.Object)
andObject.hashCode()
to be tested.<T> void
testForwarding(Class<T> interfaceType, com.google.common.base.Function<? super T,? extends T> wrapperFunction)
Tests that the forwarding wrapper returned bywrapperFunction
properly forwards method calls with parameters passed as is, return value returned as is, and exceptions propagated as is.
-
-
-
Constructor Detail
-
ForwardingWrapperTester
public ForwardingWrapperTester()
-
-
Method Detail
-
includingEquals
public ForwardingWrapperTester includingEquals()
Asks forObject.equals(java.lang.Object)
andObject.hashCode()
to be tested. That is, forwarding wrappers of equal instances should be equal.
-
testForwarding
public <T> void testForwarding(Class<T> interfaceType, com.google.common.base.Function<? super T,? extends T> wrapperFunction)
Tests that the forwarding wrapper returned bywrapperFunction
properly forwards method calls with parameters passed as is, return value returned as is, and exceptions propagated as is.
-
-