Skip to content

Commit

Permalink
#730 Problem do not relate to TkSlf4j, but to FtRemote
Browse files Browse the repository at this point in the history
  • Loading branch information
Izbassar Tolegen committed Feb 13, 2018
1 parent 39c7c01 commit f355160
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
33 changes: 33 additions & 0 deletions src/test/java/org/takes/http/FtRemoteTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,27 @@
import java.util.concurrent.Future;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.hamcrest.core.IsEqual;
import org.junit.Ignore;
import org.junit.Test;
import org.takes.Response;
import org.takes.Take;
import org.takes.rq.form.RqFormBase;
import org.takes.rs.RsText;
import org.takes.tk.TkEmpty;
import org.takes.tk.TkFixed;

/**
* Test case for {@link FtRemote}.
* @author Yegor Bugayenko (yegor256@gmail.com)
* @version $Id$
* @since 0.21
*
* @todo #730:30min Fix FtRemote for empty response body test case and
* unignore returnsAnEmptyResponseBody. After that the
* {@link org.takes.tk.TkSlf4jRemoteTest} should be fixed and relevant
* test case should be unignored.
*
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
*/
public final class FtRemoteTest {
Expand Down Expand Up @@ -121,4 +130,28 @@ public void exec(final URI home) throws IOException {
}
}

/**
* FtRemote can return empty response body for {@link TkEmpty}.
* @throws IOException If some problems inside
*/
@Ignore
@Test
public void returnsAnEmptyResponseBody() throws IOException {
new FtRemote(
new TkEmpty()
).exec(
new FtRemote.Script() {
@Override
public void exec(final URI home) throws IOException {
new JdkRequest(home)
.method("POST")
.body().set("returnsAnEmptyResponseBody").back()
.fetch()
.as(RestResponse.class)
.assertBody(new IsEqual<>(""))
.assertStatus(HttpURLConnection.HTTP_OK);
}
}
);
}
}
4 changes: 0 additions & 4 deletions src/test/java/org/takes/tk/TkSlf4jRemoteTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@
* @author Yegor Bugayenko (yegor256@gmail.com)
* @version $Id$
* @since 0.11.2
*
* @todo #712:30min Prepare implementation for empty response body test and
* unignore returnsAnEmptyResponseBody test to fix such error which was
* reported in #712.
*/
public final class TkSlf4jRemoteTest {

Expand Down
9 changes: 9 additions & 0 deletions src/test/java/org/takes/tk/TkSlf4jTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,13 @@ public void logsMessage() throws IOException {
public void logsException() throws IOException {
new TkSlf4j(new TkFailure(new IOException(""))).act(new RqFake());
}

/**
* TkSlf4j can work with {@link TkEmpty}.
* @throws IOException If some problem inside
*/
@Test
public void logsEmptyMessage() throws IOException {
new TkSlf4j(new TkEmpty()).act(new RqFake());
}
}

2 comments on commit f355160

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on f355160 Feb 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 712-e6a34ddb disappeared from src/test/java/org/takes/tk/TkSlf4jTest.java, that's why I closed #730. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on f355160 Feb 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 730-80b57821 discovered in src/test/java/org/takes/http/FtRemoteTest.java and submitted as #800. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but
we discovered it only now.

Please sign in to comment.