Package org.apache.tapestry.upload.services

Examples of org.apache.tapestry.upload.services.ParametersServletRequestWrapper


    @Test
    public void getParameterNamesIsNotDelegated() throws Exception
    {
        HttpServletRequest request = createMock(HttpServletRequest.class);

        ParametersServletRequestWrapper wrapper = new ParametersServletRequestWrapper(request);

        replay(request);

        Enumeration names = wrapper.getParameterNames();

        verify(request);

        assertNotNull(names);
        assertFalse(names.hasMoreElements());
View Full Code Here


    @Test
    public void getParameterMapIsNotDelegated() throws Exception
    {
        HttpServletRequest request = createMock(HttpServletRequest.class);

        ParametersServletRequestWrapper wrapper = new ParametersServletRequestWrapper(request);

        replay(request);

        Map parameters = wrapper.getParameterMap();

        verify(request);
        assertNotNull(parameters);
        assertTrue(parameters.isEmpty());
    }
View Full Code Here

    @Test
    public void getParameterIsNotDelegated() throws Exception
    {
        HttpServletRequest request = createMock(HttpServletRequest.class);

        ParametersServletRequestWrapper wrapper = new ParametersServletRequestWrapper(request);

        replay(request);

        String value = wrapper.getParameter("foo");

        verify(request);
        assertNull(value);
    }
View Full Code Here

    @Test
    public void getParameterValuesIsNotDelegated() throws Exception
    {
        HttpServletRequest request = createMock(HttpServletRequest.class);

        ParametersServletRequestWrapper wrapper = new ParametersServletRequestWrapper(request);

        replay(request);

        String[] values = wrapper.getParameterValues("foo");

        verify(request);
        assertNull(values);
    }
View Full Code Here

    @Test
    public void getParameterForSingleValue() throws Exception
    {
        HttpServletRequest request = createMock(HttpServletRequest.class);
        ParametersServletRequestWrapper wrapper = new ParametersServletRequestWrapper(request);
        replay(request);

        wrapper.addParameter("foo", "blah");

        assertEquals(wrapper.getParameter("foo"), "blah");
        verify(request);
    }
View Full Code Here

    @Test
    public void getParameterForMultiValueGivesFirstValue() throws Exception
    {
        HttpServletRequest request = createMock(HttpServletRequest.class);
        ParametersServletRequestWrapper wrapper = new ParametersServletRequestWrapper(request);
        replay(request);

        wrapper.addParameter("foo", "blah");
        wrapper.addParameter("foo", "another");

        assertEquals(wrapper.getParameter("foo"), "blah");
        verify(request);
    }
View Full Code Here

    @Test
    public void getParameterValuesForMultiValueGivesAll() throws Exception
    {
        HttpServletRequest request = createMock(HttpServletRequest.class);
        ParametersServletRequestWrapper wrapper = new ParametersServletRequestWrapper(request);
        replay(request);

        wrapper.addParameter("foo", "blah");
        wrapper.addParameter("foo", "another");

        assertEquals(wrapper.getParameterValues("foo"), new String[]
        { "blah", "another" });
        verify(request);
    }
View Full Code Here

    @Test
    public void getParameterNamesHasAllNames() throws Exception
    {
        HttpServletRequest request = createMock(HttpServletRequest.class);
        ParametersServletRequestWrapper wrapper = new ParametersServletRequestWrapper(request);
        replay(request);

        wrapper.addParameter("one", "blah");
        wrapper.addParameter("two", "another");

        Enumeration nameEnumerator = wrapper.getParameterNames();
        Set<String> names = new HashSet<String>();
        assertTrue(nameEnumerator.hasMoreElements());
        names.add((String) nameEnumerator.nextElement());
        assertTrue(nameEnumerator.hasMoreElements());
        names.add((String) nameEnumerator.nextElement());
View Full Code Here

    @Test
    public void getParameterMapHasAllValues() throws Exception
    {
        HttpServletRequest request = createMock(HttpServletRequest.class);
        ParametersServletRequestWrapper wrapper = new ParametersServletRequestWrapper(request);
        replay(request);

        wrapper.addParameter("single", "blah");
        wrapper.addParameter("multi", "one");
        wrapper.addParameter("multi", "two");

        Map parameters = wrapper.getParameterMap();
        assertEquals(parameters.size(), 2);
        assertEquals(parameters.get("single"), "blah");
        assertEquals((String[]) parameters.get("multi"), new String[]
        { "one", "two" });
View Full Code Here

TOP

Related Classes of org.apache.tapestry.upload.services.ParametersServletRequestWrapper

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.