@Test public void shoudNotExecuteLogicWhenUsingResultOf() { when(request.getRequestDispatcher(anyString())).thenReturn(dispatcher); try { view.of(SimpleController.class).notAllowedMethod(); } catch (UnsupportedOperationException e) { fail("Method should not be executed"); } }
public <T> T of(final Class<T> controllerType) { return proxifier.proxify(controllerType, new MethodInvocation<T>() { public Object intercept(T proxy, Method method, Object[] args, SuperMethod superMethod) { try { request.getRequestDispatcher( resolver.pathFor(DefaultResourceMethod.instanceFor(controllerType, method))).forward( request, response); return null; } catch (Exception e) { throw new ProxyInvocationException(e); } } }); }
DefaultPageResult implements PageResult { public <T> T of(final Class<T> controllerType) { return proxifier.proxify(controllerType, new MethodInvocation<T>() { public Object intercept(T proxy, Method method, Object[] args, SuperMethod superMethod) { try { request.getRequestDispatcher( resolver.pathFor(DefaultResourceMethod.instanceFor(controllerType, method))).forward( request, response); return null; } catch (Exception e) { throw new ProxyInvocationException(e); } } }); } }
DefaultPageResult implements PageResult { public <T> T of(final Class<T> controllerType) { return proxifier.proxify(controllerType, new MethodInvocation<T>() { public Object intercept(T proxy, Method method, Object[] args, SuperMethod superMethod) { try { request.getRequestDispatcher( resolver.pathFor(DefaultResourceMethod.instanceFor(controllerType, method))).forward( request, response); return null; } catch (Exception e) { throw new ProxyInvocationException(e); } } }); } @Inject  DefaultPageResult(MutableRequest req, MutableResponse res, MethodInfo requestInfo,
			PathResolver resolver, Proxifier proxifier); }
DefaultPageResult implements PageResult { public <T> T of(final Class<T> controllerType) { return proxifier.proxify(controllerType, new MethodInvocation<T>() { public Object intercept(T proxy, Method method, Object[] args, SuperMethod superMethod) { try { request.getRequestDispatcher( resolver.pathFor(DefaultResourceMethod.instanceFor(controllerType, method))).forward( request, response); return null; } catch (Exception e) { throw new ProxyInvocationException(e); } } }); } @Inject  DefaultPageResult(MutableRequest req, MutableResponse res, MethodInfo requestInfo,
			PathResolver resolver, Proxifier proxifier); void defaultView(); void include(); void redirectTo(String url); void forwardTo(String url); T of(final Class<T> controllerType); void redirect(String url); void forward(String url); void forward(); }
DefaultPageResult implements PageResult { public <T> T of(final Class<T> controllerType) { return proxifier.proxify(controllerType, new MethodInvocation<T>() { public Object intercept(T proxy, Method method, Object[] args, SuperMethod superMethod) { try { request.getRequestDispatcher( resolver.pathFor(DefaultResourceMethod.instanceFor(controllerType, method))).forward( request, response); return null; } catch (Exception e) { throw new ProxyInvocationException(e); } } }); } @Inject  DefaultPageResult(MutableRequest req, MutableResponse res, MethodInfo requestInfo,
			PathResolver resolver, Proxifier proxifier); void defaultView(); void include(); void redirectTo(String url); void forwardTo(String url); T of(final Class<T> controllerType); void redirect(String url); void forward(String url); void forward();  }