Package org.nutz.mvc.init

Source Code of org.nutz.mvc.init.AtMapInitTest

package org.nutz.mvc.init;

import static org.junit.Assert.assertEquals;

import java.io.IOException;

import javax.servlet.ServletException;

import org.junit.Test;
import org.nutz.mvc.AbstractMvcTest;
import org.nutz.mvc.Mvcs;
import org.nutz.mvc.config.AtMap;
import org.nutz.mvc.init.conf.MainModuleAtMap;

public class AtMapInitTest extends AbstractMvcTest {

    @Override
    protected void initServletConfig() {
        servletConfig.addInitParameter("modules", MainModuleAtMap.class.getName());
    }

    @Test
    public void test_at_map() throws ServletException, IOException {
        request.setPathInfo("/atmap/ABC");
        servlet.service(request, response);
        assertEquals("\">>abc\"", response.getAsString());

        newreq();
        request.setPathInfo("/atmap/xyz");
        servlet.service(request, response);
        assertEquals("\">>xyz\"", response.getAsString());
       
        Mvcs.set("nutz", request, response);
       
        AtMap am = Mvcs.getAtMap();
        assertEquals("/atmap/ABC", am.get("at.abc"));
        assertEquals("/atmap/xyz", am.get("at.xyz"));
    }

}
TOP

Related Classes of org.nutz.mvc.init.AtMapInitTest

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.