@SuppressWarnings("deprecation") @Test(expected=ValidationException.class) public void onHttpResultShouldThrowExceptionsOnMoved() throws Exception { HttpResult httpResult = mock(HttpResult.class); when(result.use(HttpResult.class)).thenReturn(httpResult); when(httpResult.movedPermanentlyTo(RandomComponent.class)).thenReturn(new RandomComponent()); try { factory.instanceFor(HttpResult.class, errors).movedPermanentlyTo(RandomComponent.class); } catch (ValidationException e) { Assert.fail("The exception must occur only on method call"); } factory.instanceFor(HttpResult.class, errors).movedPermanentlyTo(RandomComponent.class).random(); }
public <T extends View> T instanceFor(final Class<T> view, final List<Message> errors) { if (view.equals(EmptyResult.class)) { throw new ValidationException(errors); } return proxifier.proxify(view, throwValidationErrorOnFinalMethods(view, errors, result.use(view))); }
DefaultValidationViewsFactory implements ValidationViewsFactory { public <T extends View> T instanceFor(final Class<T> view, final List<Message> errors) { if (view.equals(EmptyResult.class)) { throw new ValidationException(errors); } return proxifier.proxify(view, throwValidationErrorOnFinalMethods(view, errors, result.use(view))); } }
DefaultValidationViewsFactory implements ValidationViewsFactory { public <T extends View> T instanceFor(final Class<T> view, final List<Message> errors) { if (view.equals(EmptyResult.class)) { throw new ValidationException(errors); } return proxifier.proxify(view, throwValidationErrorOnFinalMethods(view, errors, result.use(view))); } DefaultValidationViewsFactory(Result result, Proxifier proxifier); }
DefaultValidationViewsFactory implements ValidationViewsFactory { public <T extends View> T instanceFor(final Class<T> view, final List<Message> errors) { if (view.equals(EmptyResult.class)) { throw new ValidationException(errors); } return proxifier.proxify(view, throwValidationErrorOnFinalMethods(view, errors, result.use(view))); } DefaultValidationViewsFactory(Result result, Proxifier proxifier); T instanceFor(final Class<T> view, final List<Message> errors); }
DefaultValidationViewsFactory implements ValidationViewsFactory { public <T extends View> T instanceFor(final Class<T> view, final List<Message> errors) { if (view.equals(EmptyResult.class)) { throw new ValidationException(errors); } return proxifier.proxify(view, throwValidationErrorOnFinalMethods(view, errors, result.use(view))); } DefaultValidationViewsFactory(Result result, Proxifier proxifier); T instanceFor(final Class<T> view, final List<Message> errors);  }