Skip to content

Commit

Permalink
(yegor256#950) Qulice complains
Browse files Browse the repository at this point in the history
  • Loading branch information
andreoss committed Oct 22, 2020
1 parent 681d21d commit fa55979
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
1 change: 0 additions & 1 deletion src/main/java/org/takes/rq/RequestOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.cactoos.scalar.And;
import org.cactoos.scalar.Equality;
import org.cactoos.scalar.HashCode;
import org.cactoos.scalar.IoChecked;
import org.cactoos.scalar.Or;
import org.cactoos.scalar.Unchecked;
import org.takes.Body;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/rq/multipart/RqMtBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ public final class RqMtBase implements RqMultipart {
* Ctor.
* @param req Original request
* @throws IOException If fails
* @checkstyle ExecutableStatementCountCheck (2 lines)
* @todo #950:30m Remove code from this ctor, leaving only
* initialization. Currently this constructor access body
* of the request and triggers its evaluation. This breaks
* composition of multiple request, as it can be seen in
* {@link RqMtFake.}. When this task is done, remove
* {@link RqMtFake}. When this task is done, remove
* explicit lazy evaluation for RqMtFake.
* @checkstyle ExecutableStatementCountCheck (2 lines)
*/
public RqMtBase(final Request req) throws IOException {
this.origin = req;
Expand Down
20 changes: 12 additions & 8 deletions src/main/java/org/takes/rq/multipart/RqMtFake.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ public final class RqMtFake implements RqMultipart {
* @param dispositions Fake request body parts
* @throws IOException If fails
*/
public RqMtFake(final Request req, final Request... dispositions)
throws IOException {
public RqMtFake(final Request req, final Request... dispositions) {
this.fake = new Sticky<>(
() -> new RqMtBase(
new RqMtFake.FakeMultipartRequest(req, dispositions)
Expand Down Expand Up @@ -141,20 +140,25 @@ private static final class FakeMultipartRequest extends RqWrap {

/**
* Fake body .
*
* @since 0.33
*/
private static final class FakeBody implements Body {

private final String text;
/**
* Content of the body.
*/
private final String content;

/**
* Ctor
* Ctor.
* @param parts Fake request body partsFakeBody
* @throws IOException If fails
*/
@SuppressWarnings(
"PMD.ConstructorOnlyInitializesOrCallOtherConstructors"
)
private FakeBody(final Request... parts) throws IOException {
final StringBuilder builder = new StringBuilder();
final StringBuilder builder = new StringBuilder(128);
for (final Request part : parts) {
builder.append(String.format("--%s", RqMtFake.BOUNDARY))
.append(RqMtFake.CRLF)
Expand All @@ -174,12 +178,12 @@ private FakeBody(final Request... parts) throws IOException {
builder.append("Content-Transfer-Encoding: utf-8")
.append(RqMtFake.CRLF)
.append(String.format("--%s--", RqMtFake.BOUNDARY));
this.text = builder.toString();
this.content = builder.toString();
}

@Override
public InputStream body() throws IOException {
return new InputStreamOf(this.text);
return new InputStreamOf(this.content);
}

}
Expand Down
1 change: 0 additions & 1 deletion src/test/java/org/takes/rq/multipart/RqMtFakeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.hamcrest.Matchers;
import org.hamcrest.core.IsInstanceOf;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.takes.rq.RqFake;
import org.takes.rq.RqHeaders;
Expand Down

0 comments on commit fa55979

Please sign in to comment.