Package gobo.slim3.tester

Examples of gobo.slim3.tester.MockHttpServletRequest


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


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

    @Test
    public void copyBRForConverter() throws Exception {
        SrcBR src = new SrcBR();
        src.aaa = "1,000";
        MockServletContext servletContext = new MockServletContext();
        MockHttpServletRequest dest =
            new MockHttpServletRequest(servletContext);
        BeanUtil.copy(src, dest, new CopyOptions().numberConverter(
            "#,##0",
            "aaa"));
        assertThat((Long) dest.getAttribute("aaa"), is(1000L));
    }
View Full Code Here

        private ScenicPage page;
        TestScenicController(ScenicPage page) {
            this.page = page;
            this.basePath = "aaa";
            this.servletContext = new MockServletContext();
            this.request = new MockHttpServletRequest(servletContext);
            this.response = new MockHttpServletResponse();
            this.errors = new Errors();
        }
View Full Code Here

    @Before
    public void setUp() throws Exception {
        target = new ScenicPage() {
        };
        servletContext = new MockServletContext();
        request = new MockHttpServletRequest(servletContext);
        response = new MockHttpServletResponse();
        controller = new ScenicController() {
            {
                super.servletContext = ScenicPageTest.this.servletContext;
                super.request = ScenicPageTest.this.request;
View Full Code Here

    }

    @Test
    public void getMethodForREST() throws Exception {
        ScenicFrontController target = new ScenicFrontControllerStub("controller");
        MockHttpServletRequest request = getRequest("GET");
        assertThat(target.getMethodForREST(request), is("GET"));
    }
View Full Code Here

    }

    @Test
    public void getMethodForREST_POST() throws Exception {
        ScenicFrontController target = new ScenicFrontControllerStub("controller");
        MockHttpServletRequest request = getRequest("POST");
        assertThat(target.getMethodForREST(request), is("POST"));
    }
View Full Code Here

    }

    @Test
    public void getMethodForREST_xPUT() throws Exception {
        ScenicFrontController target = new ScenicFrontControllerStub("controller");
        MockHttpServletRequest request = getRequest("POST");
        request.setHeader("X-HTTP-Override-Method", "PUT");
        assertThat(target.getMethodForREST(request), is("PUT"));
    }
View Full Code Here

    }

    @Test
    public void getMethodForREST_xDELETE() throws Exception {
        ScenicFrontController target = new ScenicFrontControllerStub("controller");
        MockHttpServletRequest request = getRequest("POST");
        request.setHeader("X-HTTP-Override-Method", "DELETE");
        assertThat(target.getMethodForREST(request), is("DELETE"));
    }
View Full Code Here

    }

    @Test
    public void getMethodForREST_method_PUT() throws Exception {
        ScenicFrontController target = new ScenicFrontControllerStub("controller");
        MockHttpServletRequest request = getRequest("POST");
        request.setParameter("_method", "PUT");
        assertThat(target.getMethodForREST(request), is("PUT"));
    }
View Full Code Here

TOP

Related Classes of gobo.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.