Skip to content

Commit

Permalink
Add reproducer for yegor256#577
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Lamby committed Jan 16, 2019
1 parent 210c7ef commit acc3b52
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/test/java/org/takes/rq/multipart/RqMtFakeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,21 @@
package org.takes.rq.multipart;

import java.io.IOException;
import java.io.InputStream;
import java.nio.channels.ClosedChannelException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;

import org.cactoos.io.InputOf;
import org.cactoos.list.ListOf;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.hamcrest.core.IsInstanceOf;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.takes.Request;
import org.takes.rq.RqFake;
import org.takes.rq.RqHeaders;
import org.takes.rq.RqMultipart;
Expand Down Expand Up @@ -343,6 +350,29 @@ public void returnsCorrectNamesSet() throws IOException {
}
}

/*
* @todo #577:30min The test below fails with the message
* "header "Content-Disposition" is mandatory".
* The error disappears when `new RqFake(new ListOf<>(""), "")` is
* changed to `new RqFake(new ListOf<>(""), "someValue")`.
* Fix the underlying problem and remove the `@Ignore` annotation.
* */
@Test
@Ignore("See puzzle above")
public void contentDispositionShouldBeRecognized() throws IOException {
new RqMtFake(
new RqFake(),
new RqWithHeader(
new RqFake(new ListOf<>(""), ""),
contentDispositionHeader("form-data; name=\"field1\"")
),
new RqWithHeader(
new RqFake("", "", "field2Value"),
contentDispositionHeader("form-data; name=\"field2\"")
)
);
}

/**
* Format Content-Disposition header.
* @param dsp Disposition
Expand Down

0 comments on commit acc3b52

Please sign in to comment.