/**
 * The MIT License (MIT)
 *
 * Copyright (c) 2015 Yegor Bugayenko
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package org.takes.rq;

import java.io.IOException;
import java.util.Arrays;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;

/**
 * Test case for {@link RqForm}.
 * @author Yegor Bugayenko (yegor@teamed.io)
 * @version $Id$
 * @since 0.9
 */
public final class RqFormTest {

    /**
     * RqForm can parse body.
     * @throws IOException If some problem inside
     */
    @Test
    public void parsesHttpBody() throws IOException {
        final RqForm req = new RqForm.Base(
            new RqBuffered(
                new RqFake(
                    Arrays.asList(
                        "GET /h?a=3",
                        "Host: www.example.com"
                    ),
                    "alpha=a+b+c&beta=%20Yes%20"
                )
            )
        );
        MatcherAssert.assertThat(
            req.param("beta"),
            Matchers.hasItem(" Yes ")
        );
        MatcherAssert.assertThat(
            req.names(),
            Matchers.hasItem("alpha")
        );
    }

}

@@ -2183,10 +2183,638 @@
 %0A    %7D%0A%0A
+    /**%0A     * Returns always same instances (Cache).%0A     * @throws IOException if fails%0A     */%0A    @Test%0A    public void sameInstance() throws IOException %7B%0A        final RqForm req = new RqForm.Base(%0A            new RqBuffered(%0A                new RqFake(%0A                    Arrays.asList(%0A                        %22GET /path?a=3%22,%0A                        %22Host: www.example2.com%22%0A                    ),%0A                    %22alpha=a+b+c&beta=%2520No%2520%22%0A                )%0A            )%0A        );%0A        MatcherAssert.assertThat(%0A            req.names() == req.names(),%0A            Matchers.is(Boolean.TRUE)%0A        );%0A    %7D%0A
 %7D%0A

add test for cache