1   package org.apache.maven.plugin.javadoc;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.plugin.javadoc.options.Group;
23  import org.codehaus.plexus.PlexusTestCase;
24  
25  /**
26   * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
27   */
28  public class GroupTest
29      extends PlexusTestCase
30  {
31      /**
32       * @see org.codehaus.plexus.PlexusTestCase#setUp()
33       */
34      protected void setUp()
35          throws Exception
36      {
37          super.setUp();
38      }
39  
40      /**
41       * @see org.codehaus.plexus.PlexusTestCase#tearDown()
42       */
43      protected void tearDown()
44          throws Exception
45      {
46          super.tearDown();
47      }
48  
49      /**
50       * Test when the passed object is not a Group object
51       *
52       * @throws Exception
53       */
54      public void testNotEquals()
55          throws Exception
56      {
57          Group group = new Group();
58          group.setTitle( "GROUP" );
59          group.setPackages( "PACKAGES" );
60  
61          assertFalse( group.equals( new String() ) );
62      }
63  
64      /**
65       * Test if the passed object is a Group object
66       *
67       * @throws Exception
68       */
69      public void testEquals()
70          throws Exception
71      {
72          Group group = new Group();
73          group.setTitle( "GROUP" );
74          group.setPackages( "PACKAGES" );
75  
76          Group equalGroup = new Group();
77          equalGroup.setTitle( "GROUP" );
78          equalGroup.setPackages( "PACKAGES" );
79  
80          assertTrue( group.equals( equalGroup ) );
81      }
82  
83      /**
84       * Test the hashCode method
85       *
86       * @throws Exception
87       */
88      public void testHashCode()
89          throws Exception
90      {
91          Group group = new Group();
92          group.setTitle( "GROUP" );
93          group.setPackages( "PACKAGES" );
94  
95          assertEquals( group.hashCode(), -242064495 );
96      }
97  
98      /**
99       * Test the toString() method
100      *
101      * @throws Exception
102      */
103     public void testToString()
104         throws Exception
105     {
106         Group group = new Group();
107         group.setTitle( "GROUP" );
108         group.setPackages( "PACKAGES" );
109 
110         assertTrue( group.toString().indexOf( "GROUP" ) != -1 );
111         assertTrue( group.toString().indexOf( "PACKAGES" ) != -1 );
112     }
113 }