Skip to content

Commit

Permalink
#277 TkForward bug reproduced
Browse files Browse the repository at this point in the history
  • Loading branch information
Yegor Bugayenko committed May 10, 2015
1 parent e89a7d9 commit da6545c
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/test/java/org/takes/facets/forward/TkForwardTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String> head() throws IOException {
throw new RsForward("/a");
}
@Override
public InputStream body() throws IOException {
throw new RsForward("/b");
}
};
}
};
MatcherAssert.assertThat(
Expand Down

0 comments on commit da6545c

Please sign in to comment.