Package org.mojavemvc.core

Examples of org.mojavemvc.core.RoutedRequest


    }
   
    @Test
    public void handlesNullPath() {
       
        RoutedRequest routed = newRouter(null).route();
       
        assertNull(routed.getController());
        assertNull(routed.getAction());
        assertTrue(routed.getParameterMap().isEmpty());
    }
View Full Code Here


    }
   
    @Test
    public void handlesEmptyPath() {
       
        RoutedRequest routed = newRouter("").route();
       
        assertNull(routed.getController());
        assertNull(routed.getAction());
        assertTrue(routed.getParameterMap().isEmpty());
    }
View Full Code Here

       
        String pathInfo = "/";
        when(router.route(pathInfo))
            .thenReturn(new MojaveRoute(null, null, null));
       
        RoutedRequest routed = newRouter(pathInfo).route();
       
        assertNull(routed.getController());
        assertNull(routed.getAction());
        assertTrue(routed.getParameterMap().isEmpty());
    }
View Full Code Here

        String pathInfo = "/cntrl";
        when(router.route(pathInfo))
            .thenReturn(new MojaveRoute("cntrl", null, null));
       
       
        RoutedRequest routed = newRouter(pathInfo).route();
       
        assertEquals("cntrl", routed.getController());
        assertNull(routed.getAction());
        assertTrue(routed.getParameterMap().isEmpty());
    }
View Full Code Here

       
        String pathInfo = "/cntrl/actn";
        when(router.route(pathInfo))
            .thenReturn(new MojaveRoute("cntrl", "actn", null));
       
        RoutedRequest routed = newRouter(pathInfo).route();
       
        assertEquals("cntrl", routed.getController());
        assertEquals("actn", routed.getAction());
        assertTrue(routed.getParameterMap().isEmpty());
    }
View Full Code Here

       
        String pathInfo = "/cntrl/actn/123";
        when(router.route(pathInfo))
            .thenReturn(new MojaveRoute("cntrl", "actn", ":id"));
       
        RoutedRequest routed = newRouter(pathInfo).route();
       
        assertEquals("cntrl", routed.getController());
        assertEquals("actn", routed.getAction());
        Map<String, Object> paramMap = routed.getParameterMap();
        Object val = paramMap.get("id");
        assertNotNull(val);
        assertArrayEquals(new String[]{"123"}, (String[])val);
    }
View Full Code Here

       
        String pathInfo = "/cntrl/actn/123/tom";
        when(router.route(pathInfo))
            .thenReturn(new MojaveRoute("cntrl", "actn", ":id/:name"));
       
        RoutedRequest routed = newRouter(pathInfo).route();
       
        assertEquals("cntrl", routed.getController());
        assertEquals("actn", routed.getAction());
        Map<String, Object> paramMap = routed.getParameterMap();
        Object val = paramMap.get("id");
        assertNotNull(val);
        assertArrayEquals(new String[]{"123"}, (String[])val);
        val = paramMap.get("name");
        assertNotNull(val);
View Full Code Here

        String pathInfo = "/cntrl/actn/123";
        when(router.route(pathInfo))
            .thenReturn(new MojaveRoute("cntrl", "actn", ":id"));
        paramMap.put("id", new String[]{"456"});
       
        RoutedRequest routed = newRouter(pathInfo).route();
       
        assertEquals("cntrl", routed.getController());
        assertEquals("actn", routed.getAction());
        Map<String, Object> paramMap = routed.getParameterMap();
        Object val = paramMap.get("id");
        assertNotNull(val);
        assertArrayEquals(new String[]{"123"}, (String[])val);
    }
View Full Code Here

        String pathInfo = "/cntrl/actn/123";
        when(router.route(pathInfo))
            .thenReturn(new MojaveRoute("cntrl", "actn", ":id"));
        paramMap.put("name", new String[]{"tom"});
       
        RoutedRequest routed = newRouter(pathInfo).route();
       
        assertEquals("cntrl", routed.getController());
        assertEquals("actn", routed.getAction());
        Map<String, Object> paramMap = routed.getParameterMap();
        Object val = paramMap.get("id");
        assertNotNull(val);
        assertArrayEquals(new String[]{"123"}, (String[])val);
        val = paramMap.get("name");
        assertNotNull(val);
View Full Code Here

        injector = Guice.createInjector(
                new ServletResourceModule(appProperties), new SomeModule());
        ServletResourceModule.set(req, res);

        routed = new RoutedRequest(null, null, parametersMap);
    }
View Full Code Here

TOP

Related Classes of org.mojavemvc.core.RoutedRequest

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.