@Test(expected = UncheckedIOException.class) public void alwaysFail() throws Exception { DummyService target = new DummyServiceImpl(); DummyService dummyService = FlakyProxy.newJdkProxy(target, FlakinessFunction.alwaysFail()); dummyService.countWords(parsedPage); }
public static <T> T newJdkProxy(Object obj, FlakinessFunction flakinessFunction) { Class<?> clazz = obj.getClass(); List<Class<?>> interfaces = ClassUtils.getAllInterfaces(clazz); return (T) java.lang.reflect.Proxy.newProxyInstance( clazz.getClassLoader(), interfaces.toArray(new Class[interfaces.size()]), new FlakyProxy(obj, flakinessFunction)); }
FlakyProxy extends DefaultProxyBehavior { public static <T> T newJdkProxy(Object obj, FlakinessFunction flakinessFunction) { Class<?> clazz = obj.getClass(); List<Class<?>> interfaces = ClassUtils.getAllInterfaces(clazz); return (T) java.lang.reflect.Proxy.newProxyInstance( clazz.getClassLoader(), interfaces.toArray(new Class[interfaces.size()]), new FlakyProxy(obj, flakinessFunction)); } }
FlakyProxy extends DefaultProxyBehavior { public static <T> T newJdkProxy(Object obj, FlakinessFunction flakinessFunction) { Class<?> clazz = obj.getClass(); List<Class<?>> interfaces = ClassUtils.getAllInterfaces(clazz); return (T) java.lang.reflect.Proxy.newProxyInstance( clazz.getClassLoader(), interfaces.toArray(new Class[interfaces.size()]), new FlakyProxy(obj, flakinessFunction)); } private  FlakyProxy(Object obj, FlakinessFunction flakinessFunction); }
FlakyProxy extends DefaultProxyBehavior { public static <T> T newJdkProxy(Object obj, FlakinessFunction flakinessFunction) { Class<?> clazz = obj.getClass(); List<Class<?>> interfaces = ClassUtils.getAllInterfaces(clazz); return (T) java.lang.reflect.Proxy.newProxyInstance( clazz.getClassLoader(), interfaces.toArray(new Class[interfaces.size()]), new FlakyProxy(obj, flakinessFunction)); } private  FlakyProxy(Object obj, FlakinessFunction flakinessFunction); static T newJdkProxy(Object obj, FlakinessFunction flakinessFunction); }
FlakyProxy extends DefaultProxyBehavior { public static <T> T newJdkProxy(Object obj, FlakinessFunction flakinessFunction) { Class<?> clazz = obj.getClass(); List<Class<?>> interfaces = ClassUtils.getAllInterfaces(clazz); return (T) java.lang.reflect.Proxy.newProxyInstance( clazz.getClassLoader(), interfaces.toArray(new Class[interfaces.size()]), new FlakyProxy(obj, flakinessFunction)); } private  FlakyProxy(Object obj, FlakinessFunction flakinessFunction); static T newJdkProxy(Object obj, FlakinessFunction flakinessFunction);  }