package org.apache.maven.struts;

/* ====================================================================
 *   Copyright 2001-2004 The Apache Software Foundation.
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 * ====================================================================
 */

import junit.framework.TestCase;

/**
 * Unit tests for the {@link Forward} class
 *
 * @author dion
 * @version $Id: ForwardTest.java,v 1.2 2004/03/02 15:36:14 evenisse Exp $
 */
public class ForwardTest extends TestCase
{
    /** the instance being tested */
    private Forward instance;
    
    /** Creates a new instance of Struts10WarFileTest 
     * @param testName the name of the test
     */
    public ForwardTest(String testName)
    {
        super(testName);
    }
    
    /**
     * Initialize per test data
     * @throws Exception when there is an unexpected problem
     */
    public void setUp() throws Exception
    {
        instance = new Forward();
    }
    
    /** test the constructor
     * @throws Exception when there is an unexpected problem
     */
    public void testConstructor() throws Exception
    {
        assertNotNull("instance not created", instance);
        assertNull("name property is not null", instance.getName());
        assertNull("className property is not null", instance.getClassName());
        assertNull("path property is not null", instance.getPath());
        assertNull("redirect property is not null", instance.getRedirect());
    }
    
    /** test the name property
     * @throws Exception when there is an unexpected problem
     */
    public void testName() throws Exception
    { 
        testConstructor();
        String dummy = "dummyName";
        instance.setName(dummy);
        assertEquals("set or get failed", dummy, instance.getName());
    }
    
    /** test the class name property
     * @throws Exception when there is an unexpected problem
     */
    public void testClassName() throws Exception
    { 
        testConstructor();
        String dummy = "dummyClassName";
        instance.setClassName(dummy);
        assertEquals("set or get failed", dummy, instance.getClassName());
    }
    
    /** test the path property
     * @throws Exception when there is an unexpected problem
     */
    public void testPath() throws Exception
    { 
        testConstructor();
        String dummy = "dummyPath";
        instance.setPath(dummy);
        assertEquals("set or get failed", dummy, instance.getPath());
    }
    
    /** test the redirect property
     * @throws Exception when there is an unexpected problem
     */
    public void testRedirect() throws Exception
    { 
        testConstructor();
        String dummy = "dummyRedirect";
        instance.setRedirect(dummy);
        assertEquals("set or get failed", dummy, instance.getRedirect());
    }
}
