Skip to content

Commit

Permalink
(#918) Code review fixes, attempt 3
Browse files Browse the repository at this point in the history
  • Loading branch information
fanifieiev committed Nov 20, 2019
1 parent 39a6c72 commit 5a70417
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 151 deletions.
145 changes: 0 additions & 145 deletions src/main/java/org/takes/misc/InputStreamsEqual.java

This file was deleted.

8 changes: 6 additions & 2 deletions src/main/java/org/takes/rq/RequestOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import org.cactoos.io.BytesOf;
import org.cactoos.scalar.And;
import org.cactoos.scalar.Equality;
import org.cactoos.scalar.HashCode;
import org.cactoos.scalar.Or;
import org.cactoos.scalar.Unchecked;
import org.takes.Request;
import org.takes.Scalar;
import org.takes.misc.InputStreamsEqual;

/**
* This {@link Request} implementation provides a way to build a request
Expand Down Expand Up @@ -103,7 +104,10 @@ public boolean equals(final Object that) {
this.head()
).value();
},
new InputStreamsEqual(this.body(), other.body())
() -> new Equality<>(
new BytesOf(this.body()),
new BytesOf(other.body())
).value() == 0
).value();
}
)
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/org/takes/rs/ResponseOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import org.cactoos.io.BytesOf;
import org.cactoos.scalar.And;
import org.cactoos.scalar.Equality;
import org.cactoos.scalar.HashCode;
import org.cactoos.scalar.Or;
import org.cactoos.scalar.Unchecked;
import org.takes.Response;
import org.takes.Scalar;
import org.takes.misc.InputStreamsEqual;

/**
* Response of head and body.
Expand Down Expand Up @@ -104,7 +105,10 @@ public boolean equals(final Object that) {
this.head()
).value();
},
new InputStreamsEqual(this.body(), other.body())
() -> new Equality<>(
new BytesOf(this.body()),
new BytesOf(other.body())
).value() == 0
).value();
}
)
Expand Down
5 changes: 3 additions & 2 deletions src/test/java/org/takes/rs/RsPrettyJsonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,15 @@ public void reportsCorrectContentLength() throws Exception {
*/
@Test
public void mustEvaluateTrueEquality() throws Exception {
final String body = "{\"person\":{\"name\":\"John\"}}";
new Assertion<>(
"Must evaluate true equality",
new RsPrettyJson(
new RsWithBody("{\"person\":{\"name\":\"John\"}}")
new RsWithBody(body)
),
new IsEqual<>(
new RsPrettyJson(
new RsWithBody("{\"person\":{\"name\":\"John\"}}")
new RsWithBody(body)
)
)
).affirm();
Expand Down

3 comments on commit 5a70417

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on 5a70417 Nov 25, 2019

Choose a reason for hiding this comment

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

Puzzle 918-4b25f3bd discovered in src/main/java/org/takes/misc/EnglishLowerCase.java and submitted as #998. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on 5a70417 Nov 25, 2019

Choose a reason for hiding this comment

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

Puzzle 918-a277e748 discovered in src/main/java/org/takes/rq/RqOnce.java and submitted as #999. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on 5a70417 Nov 25, 2019

Choose a reason for hiding this comment

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

Puzzle 918-47bb7809 discovered in src/main/java/org/takes/facets/fallback/TkFallback.java and submitted as #1000. 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.