private static <T> void testToString( Class<T> interfaceType, Function<? super T, ? extends T> wrapperFunction) { T proxy = new FreshValueGenerator().newFreshProxy(interfaceType); assertEquals( "toString() isn't properly forwarded", proxy.toString(), wrapperFunction.apply(proxy).toString()); }
private static <T> void testEquals( Class<T> interfaceType, Function<? super T, ? extends T> wrapperFunction) { FreshValueGenerator generator = new FreshValueGenerator(); T instance = generator.newFreshProxy(interfaceType); new EqualsTester() .addEqualityGroup(wrapperFunction.apply(instance), wrapperFunction.apply(instance)) .addEqualityGroup(wrapperFunction.apply(generator.newFreshProxy(interfaceType))) // TODO: add an overload to EqualsTester to print custom error message? .testEquals(); }
private static <T> void testToString( Class<T> interfaceType, Function<? super T, ? extends T> wrapperFunction) { T proxy = new FreshValueGenerator().newFreshProxy(interfaceType); assertEquals( "toString() isn't properly forwarded", proxy.toString(), wrapperFunction.apply(proxy).toString()); }
private static <T> void testEquals( Class<T> interfaceType, Function<? super T, ? extends T> wrapperFunction) { FreshValueGenerator generator = new FreshValueGenerator(); T instance = generator.newFreshProxy(interfaceType); new EqualsTester() .addEqualityGroup(wrapperFunction.apply(instance), wrapperFunction.apply(instance)) .addEqualityGroup(wrapperFunction.apply(generator.newFreshProxy(interfaceType))) // TODO: add an overload to EqualsTester to print custom error message? .testEquals(); }