1   package org.apache.maven.struts;
2   
3   /* ====================================================================
4    *   Copyright 2001-2004 The Apache Software Foundation.
5    *
6    *   Licensed under the Apache License, Version 2.0 (the "License");
7    *   you may not use this file except in compliance with the License.
8    *   You may obtain a copy of the License at
9    *
10   *       http://www.apache.org/licenses/LICENSE-2.0
11   *
12   *   Unless required by applicable law or agreed to in writing, software
13   *   distributed under the License is distributed on an "AS IS" BASIS,
14   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   *   See the License for the specific language governing permissions and
16   *   limitations under the License.
17   * ====================================================================
18   */
19  
20  import junit.framework.TestCase;
21  
22  /**
23   * Unit tests for the {@link Forward} class
24   *
25   * @author dion
26   * @version $Id: ForwardTest.java 170200 2005-05-15 06:24:19Z brett $
27   */
28  public class ForwardTest extends TestCase
29  {
30      /** the instance being tested */
31      private Forward instance;
32      
33      /** Creates a new instance of Struts10WarFileTest 
34       * @param testName the name of the test
35       */
36      public ForwardTest(String testName)
37      {
38          super(testName);
39      }
40      
41      /**
42       * Initialize per test data
43       * @throws Exception when there is an unexpected problem
44       */
45      public void setUp() throws Exception
46      {
47          instance = new Forward();
48      }
49      
50      /** test the constructor
51       * @throws Exception when there is an unexpected problem
52       */
53      public void testConstructor() throws Exception
54      {
55          assertNotNull("instance not created", instance);
56          assertNull("name property is not null", instance.getName());
57          assertNull("className property is not null", instance.getClassName());
58          assertNull("path property is not null", instance.getPath());
59          assertNull("redirect property is not null", instance.getRedirect());
60      }
61      
62      /** test the name property
63       * @throws Exception when there is an unexpected problem
64       */
65      public void testName() throws Exception
66      { 
67          testConstructor();
68          String dummy = "dummyName";
69          instance.setName(dummy);
70          assertEquals("set or get failed", dummy, instance.getName());
71      }
72      
73      /** test the class name property
74       * @throws Exception when there is an unexpected problem
75       */
76      public void testClassName() throws Exception
77      { 
78          testConstructor();
79          String dummy = "dummyClassName";
80          instance.setClassName(dummy);
81          assertEquals("set or get failed", dummy, instance.getClassName());
82      }
83      
84      /** test the path property
85       * @throws Exception when there is an unexpected problem
86       */
87      public void testPath() throws Exception
88      { 
89          testConstructor();
90          String dummy = "dummyPath";
91          instance.setPath(dummy);
92          assertEquals("set or get failed", dummy, instance.getPath());
93      }
94      
95      /** test the redirect property
96       * @throws Exception when there is an unexpected problem
97       */
98      public void testRedirect() throws Exception
99      { 
100         testConstructor();
101         String dummy = "dummyRedirect";
102         instance.setRedirect(dummy);
103         assertEquals("set or get failed", dummy, instance.getRedirect());
104     }
105 }