Package org.mojavemvc.core

Examples of org.mojavemvc.core.MojaveRoute


        assertEquals(r1, router.route("/"));
    }
   
    @Test
    public void getRoute_SimilarMatchesConstant() {
        MojaveRoute r1 = new MojaveRoute(null, null, "clients/all");
        MojaveRoute r2 = new MojaveRoute(null, null, "clients/:id");
        router.add(r1);
        router.add(r2);
        assertEquals(r1, router.route("/clients/all"));
    }
View Full Code Here


        assertEquals(r1, router.route("/clients/all"));
    }
   
    @Test
    public void getRoute_SimilarMatchesParam() {
        MojaveRoute r1 = new MojaveRoute(null, null, "clients/all");
        MojaveRoute r2 = new MojaveRoute(null, null, "clients/:id");
        router.add(r1);
        router.add(r2);
        assertEquals(r2, router.route("/clients/123"));
    }
View Full Code Here

        assertEquals(r2, router.route("/clients/123"));
    }
   
    @Test
    public void getRoute_IgnoresParamRegion() {
        MojaveRoute r1 = new MojaveRoute("cntrl", null, null);
        MojaveRoute r2 = new MojaveRoute("cntrl", null, "clients/:id");
        router.add(r1);
        router.add(r2);
        assertEquals(r1, router.route("/cntrl"));
    }
View Full Code Here

        assertEquals(r1, router.route("/cntrl"));
    }
   
    @Test
    public void getRoute_FindsParamRegion() {
        MojaveRoute r1 = new MojaveRoute("cntrl", null, null);
        MojaveRoute r2 = new MojaveRoute("cntrl", null, "clients/:id");
        router.add(r1);
        router.add(r2);
        assertEquals(r2, router.route("/cntrl/clients/23455"));
    }
View Full Code Here

        assertEquals(r2, router.route("/cntrl/clients/23455"));
    }
   
    @Test
    public void getRoute_DistinguishesBetweenControllerAndAction() {
        MojaveRoute r1 = new MojaveRoute("cntrl", null, null);
        MojaveRoute r2 = new MojaveRoute(null, "actn", null);
        router.add(r1);
        router.add(r2);
        assertEquals(r2, router.route("/actn"));
    }
View Full Code Here

        assertEquals(r2, router.route("/actn"));
    }
   
    @Test
    public void getRoute_NotFound() {
        MojaveRoute r1 = new MojaveRoute("cntrl", null, null);
        MojaveRoute r2 = new MojaveRoute(null, "actn", null);
        router.add(r1);
        router.add(r2);
        assertNull(router.route("/test"));
    }
View Full Code Here

        assertNull(router.route("/test"));
    }
   
    @Test
    public void getRoute_MultiParamRegions_Multiple() {
        MojaveRoute r1 = new MojaveRoute("cntrl", "actn", ":id");
        MojaveRoute r2 = new MojaveRoute("cntrl", "actn", ":id/:name");
        router.add(r1);
        router.add(r2);
        assertEquals(r2, router.route("/cntrl/actn/123/bob"));
    }
View Full Code Here

        assertEquals(r2, router.route("/cntrl/actn/123/bob"));
    }
   
    @Test
    public void getRoute_MultiParamRegions_Single() {
        MojaveRoute r1 = new MojaveRoute("cntrl", "actn", ":id");
        MojaveRoute r2 = new MojaveRoute("cntrl", "actn", ":id/:name");
        router.add(r1);
        router.add(r2);
        assertEquals(r1, router.route("/cntrl/actn/123"));
    }
View Full Code Here

        assertEquals(r1, router.route("/cntrl/actn/123"));
    }
   
    @Test
    public void getRoute_CustomRegexAlpha() {
        MojaveRoute r1 = new MojaveRoute("cntrl", "actn", ":id<[0-9]+>");
        MojaveRoute r2 = new MojaveRoute("cntrl", "actn", ":id<[a-z]+>");
        router.add(r1);
        router.add(r2);
        assertEquals(r2, router.route("/cntrl/actn/bob"));
    }
View Full Code Here

        assertEquals(r2, router.route("/cntrl/actn/bob"));
    }
   
    @Test
    public void getRoute_CustomRegexNumeric() {
        MojaveRoute r1 = new MojaveRoute("cntrl", "actn", ":id<[0-9]+>");
        MojaveRoute r2 = new MojaveRoute("cntrl", "actn", ":id<[a-z]+>");
        router.add(r1);
        router.add(r2);
        assertEquals(r1, router.route("/cntrl/actn/123"));
    }
View Full Code Here

TOP

Related Classes of org.mojavemvc.core.MojaveRoute

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.