Package net.violet.nuvoos.web.server

Source Code of net.violet.nuvoos.web.server.AppTest

package net.violet.nuvoos.web.server;

import com.nabalive.framework.web.Route;
import org.junit.Test;

import static org.junit.Assert.*;

import java.util.Map;

/**
* Unit test for simple App.
*/
public class AppTest {
    @Test
    public void testRouteMatcher() {
        final Route route = new Route("/api/:name/:id");
        final Map<String, String> rez = route.parse("/api/julien/123", null);
        System.out.println(rez);
        assertEquals("should contain julien", rez.get("name"), "julien");
        assertEquals("should contain 123", rez.get("id"), "123");
    }

    @Test
    public void testRouteMatcherFalse() {
        final Route route = new Route("/api/:name/:id");
        final Map<String, String> rez = route.parse("/api/julien/toto/123", null);
        assertNull("should contain julien", rez);
    }
}
TOP

Related Classes of net.violet.nuvoos.web.server.AppTest

TOP
Copyright © 2018 www.massapi.com. 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.