From da6545cc43061fd036b5c08b86b1db5b7b136dda Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Sun, 10 May 2015 16:23:26 -0700 Subject: [PATCH] #277 TkForward bug reproduced --- .../takes/facets/forward/TkForwardTest.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/takes/facets/forward/TkForwardTest.java b/src/test/java/org/takes/facets/forward/TkForwardTest.java index e2c28af84..53cea3241 100644 --- a/src/test/java/org/takes/facets/forward/TkForwardTest.java +++ b/src/test/java/org/takes/facets/forward/TkForwardTest.java @@ -24,6 +24,7 @@ package org.takes.facets.forward; import java.io.IOException; +import java.io.InputStream; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.Test; @@ -62,15 +63,24 @@ public Response act(final Request request) throws RsForward { } /** - * TkForward can catch RsForward. + * TkForward can catch RsForward throws by Response. * @throws IOException If some problem inside */ @Test - public void catchesExceptionThrownByTake() throws IOException { + public void catchesExceptionThrownByResponse() throws IOException { final Take take = new Take() { @Override - public Response act(final Request request) throws RsForward { - throw new RsForward("/h"); + public Response act(final Request request) { + return new Response() { + @Override + public Iterable head() throws IOException { + throw new RsForward("/a"); + } + @Override + public InputStream body() throws IOException { + throw new RsForward("/b"); + } + }; } }; MatcherAssert.assertThat(