View Javadoc
1   package org.apache.maven.model;
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 junit.framework.TestCase;
23  
24  /**
25   * Tests {@code Organization}.
26   *
27   * @author Benjamin Bentmann
28   */
29  public class OrganizationTest
30      extends TestCase
31  {
32  
33      public void testHashCodeNullSafe()
34      {
35          new Organization().hashCode();
36      }
37  
38      public void testEqualsNullSafe()
39      {
40          assertFalse( new Organization().equals( null ) );
41  
42          new Organization().equals( new Organization() );
43      }
44  
45      public void testEqualsIdentity()
46      {
47          Organization thing = new Organization();
48          assertTrue( thing.equals( thing ) );
49      }
50  
51      public void testToStringNullSafe()
52      {
53          assertNotNull( new Organization().toString() );
54      }
55  
56  
57      public void testToStringNotNonsense11()
58      {
59          Organization org = new Organization();
60          org.setName( "Testing Maven Unit" );
61          org.setUrl( "https://maven.localdomain" );
62  
63          assertEquals( "Organization {name=Testing Maven Unit, url=https://maven.localdomain}", org.toString() );
64      }
65  
66      public void testToStringNotNonsense10()
67      {
68          Organization org = new Organization();
69          org.setName( "Testing Maven Unit" );
70  
71          assertEquals( "Organization {name=Testing Maven Unit, url=null}", org.toString() );
72      }
73  
74      public void testToStringNotNonsense01()
75      {
76          Organization org = new Organization();
77          org.setUrl( "https://maven.localdomain" );
78  
79          assertEquals( "Organization {name=null, url=https://maven.localdomain}", org.toString() );
80      }
81  
82      public void testToStringNotNonsense00()
83      {
84          Organization org = new Organization();
85  
86          assertEquals( "Organization {name=null, url=null}", org.toString() );
87      }
88  }