Package org.slim3.tester

Examples of org.slim3.tester.MockHttpServletRequest


     * @throws Exception
     */
    @Test
    public void copyRBForExclude() throws Exception {
        MockServletContext servletContext = new MockServletContext();
        MockHttpServletRequest src = new MockHttpServletRequest(servletContext);
        src.setAttribute("aaa", "111");
        src.setAttribute("ccc", "222");
        DestRB dest = new DestRB();
        BeanUtil.copy(src, dest, new CopyOptions().exclude("ccc"));
        assertThat(dest.aaa, is("111"));
        assertThat(dest.ccc, is(nullValue()));
    }
View Full Code Here


     * @throws Exception
     */
    @Test
    public void copyRBForNull() throws Exception {
        MockServletContext servletContext = new MockServletContext();
        MockHttpServletRequest src = new MockHttpServletRequest(servletContext);
        DestRB dest = new DestRB();
        dest.aaa = "111";
        BeanUtil.copy(src, dest);
        assertThat(dest.aaa, is("111"));
    }
View Full Code Here

     * @throws Exception
     */
    @Test
    public void copyRBForExcludeNull() throws Exception {
        MockServletContext servletContext = new MockServletContext();
        MockHttpServletRequest src = new MockHttpServletRequest(servletContext);
        src.setAttribute("aaa", null);
        DestRB dest = new DestRB();
        dest.aaa = "111";
        BeanUtil.copy(src, dest, new CopyOptions().excludeNull());
        assertThat(dest.aaa, is("111"));
    }
View Full Code Here

     * @throws Exception
     */
    @Test
    public void copyRBForEmptyString() throws Exception {
        MockServletContext servletContext = new MockServletContext();
        MockHttpServletRequest src = new MockHttpServletRequest(servletContext);
        src.setAttribute("aaa", "");
        DestRB dest = new DestRB();
        dest.aaa = "111";
        BeanUtil.copy(src, dest);
        assertThat(dest.aaa, is(""));
    }
View Full Code Here

     * @throws Exception
     */
    @Test
    public void copyRBForExcludeEmptyString() throws Exception {
        MockServletContext servletContext = new MockServletContext();
        MockHttpServletRequest src = new MockHttpServletRequest(servletContext);
        src.setAttribute("aaa", "");
        DestRB dest = new DestRB();
        dest.aaa = "111";
        BeanUtil.copy(src, dest, new CopyOptions().excludeEmptyString());
        assertThat(dest.aaa, is("111"));
    }
View Full Code Here

     * @throws Exception
     */
    @Test
    public void copyRBForExcludeNullAndCopyEmptyString() throws Exception {
        MockServletContext servletContext = new MockServletContext();
        MockHttpServletRequest src = new MockHttpServletRequest(servletContext);
        src.setAttribute("aaa", "");
        DestRB dest = new DestRB();
        dest.aaa = "111";
        BeanUtil.copy(src, dest, new CopyOptions()
            .excludeNull()
            .excludeEmptyString());
View Full Code Here

     * @throws Exception
     */
    @Test
    public void copyRBForConverter() throws Exception {
        MockServletContext servletContext = new MockServletContext();
        MockHttpServletRequest src = new MockHttpServletRequest(servletContext);
        src.setAttribute("ddd", "1,000");
        DestRB dest = new DestRB();
        BeanUtil.copy(src, dest, new CopyOptions().numberConverter("#,##0"));
        assertThat(dest.ddd, is(1000));
    }
View Full Code Here

    @Test
    public void copyBR() throws Exception {
        SrcBR src = new SrcBR();
        src.aaa = "111";
        MockServletContext servletContext = new MockServletContext();
        MockHttpServletRequest dest =
            new MockHttpServletRequest(servletContext);
        BeanUtil.copy(src, dest);
        assertThat((String) dest.getAttribute("aaa"), is("111"));
    }
View Full Code Here

    @Test
    public void copyBRFromReadOnly() throws Exception {
        SrcBR src = new SrcBR();
        src.bbb = "111";
        MockServletContext servletContext = new MockServletContext();
        MockHttpServletRequest dest =
            new MockHttpServletRequest(servletContext);
        BeanUtil.copy(src, dest);
        assertThat((String) dest.getAttribute("bbb"), is("111"));
    }
View Full Code Here

    @Test
    public void copyBRFromWriteOnly() throws Exception {
        SrcBR src = new SrcBR();
        src.ccc = "111";
        MockServletContext servletContext = new MockServletContext();
        MockHttpServletRequest dest =
            new MockHttpServletRequest(servletContext);
        BeanUtil.copy(src, dest);
        assertThat(dest.getAttribute("ccc"), is(nullValue()));
    }
View Full Code Here

TOP

Related Classes of org.slim3.tester.MockHttpServletRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.