/*
 * TestWeberLogicDispacher.java
 *
 * Created on 2007/01/30, 16:03
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package test.org.itscool.weber.action;

import junit.framework.TestCase;
import org.itscool.weber.controller.RequestDispatcher;

/**
 *
 * @author ios
 */
public class TestWeberLogicDispacher extends TestCase{
    
    public void testGetReturnPath() {
        RequestDispatcher path = new RequestDispatcher( "/hello/show.do");
        System.out.println(path.getReturnPath("success"));
        System.out.println(path.getModuleName());
        System.out.println(path.getActionName());
        assertEquals(path.getReturnPath("success"), "/html/hello/hello_show_success");
    }
    
    public void testGetReturnPath2() {
        RequestDispatcher path = new RequestDispatcher( "/aa/bb.do");
        assertEquals(path.getReturnPath("success"), "/html/aa/aa_bb_success");
    }
    
    public void testGetReturnPath3() {
        RequestDispatcher path = new RequestDispatcher( "/a/b.do");
        System.out.println(path.getReturnPath("success"));
        assertEquals(path.getReturnPath("success"), "/html/a/absuccess");
        
    }
    
    public void testGetReturnPath5() {
        RequestDispatcher path = new RequestDispatcher("/hello_good_by/show.do");
        System.out.println(path.getReturnPath("success"));
        assertEquals(path.getReturnPath("success"), "/html/hello_good_by/hello_good_by_show_success");
    }
    
    public void testGetActionName() {
        RequestDispatcher path = new RequestDispatcher("/hello/show.do");
        assertEquals(path.getPkgActionName("sample.org.itscool"), "sample.org.itscool.hello.HelloShowAction");
        
    }
     
    public void testGetFormName() {
        RequestDispatcher path = new RequestDispatcher("/hello/show.do");
        assertEquals(path.getFormName("sample.org.itscool"), "sample.org.itscool.hello.Hello");
    }
}
