### Question:
ProxyFactory { public static Object getProxy(Object target, Object[] invocationHandlers) throws Exception { if (invocationHandlers != null && invocationHandlers.length > 0) { Object proxy = target; for (int i = 0; i < invocationHandlers.length; i++) { proxy = getProxy(target, (AbstractInvocationHandler) invocationHandlers[i], proxy); } return proxy; } else { return target; } }  static Object getProxy(Object target, Object[] invocationHandlers);  }### Answer:
@Test public void testGetProxy() throws Exception { Object[] chainA = {new FlipBooleanHandler(), new ReverseStringHandler()}; Object[] chainB = {new ReverseStringHandler(), new PrefixStringWithXHandler()}; Object[] chainC = {new PrefixStringWithXHandler(), new ReverseStringHandler()}; TargetInterface proxy = (TargetInterface) ProxyFactory.getProxy(target, chainA); assertTrue(proxy.bar(false)); assertEquals("olleh", proxy.baz("hello")); proxy = (TargetInterface) ProxyFactory.getProxy(target, chainB); assertEquals("ollehX", proxy.baz("hello")); proxy = (TargetInterface) ProxyFactory.getProxy(target, chainC); assertEquals("Xolleh", proxy.baz("hello")); }