View Javadoc
1   package org.apache.maven.doxia.site.decoration.inheritance;
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.junit.Test;
23  
24  import static org.junit.Assert.assertEquals;
25  
26  /**
27   * Tests for DOXIA-91 problems. All tests make sure that a passed in null will not generate any path conversion but
28   * just returns the old path.
29   *
30   * @author <a href="mailto:henning@apache.org">Henning P. Schmiedehausen</a>
31   */
32  public class Doxia91Test
33  {
34      /** @throws Exception */
35      @Test
36      public void testOldPathNull()
37          throws Exception
38      {
39          PathDescriptor oldPath = new PathDescriptor( null );
40          PathDescriptor newPath = new PathDescriptor( "http://www.apache.org/" );
41  
42          PathDescriptor diff = PathUtils.convertPath( oldPath, newPath );
43  
44          assertEquals( diff, oldPath );
45      }
46  
47      /** @throws Exception */
48      @Test
49      public void testNewPathNull()
50          throws Exception
51      {
52          PathDescriptor oldPath = new PathDescriptor( "http://www.apache.org/", "file:///home/henning/foo" );
53          PathDescriptor newPath = new PathDescriptor( null );
54  
55          PathDescriptor diff = PathUtils.convertPath( oldPath, newPath );
56  
57          assertEquals( diff, oldPath );
58      }
59  
60      /** @throws Exception */
61      @Test
62      public void testBothPathNull()
63          throws Exception
64      {
65          PathDescriptor oldPath = new PathDescriptor( null );
66          PathDescriptor newPath = new PathDescriptor( null );
67  
68          PathDescriptor diff = PathUtils.convertPath( oldPath, newPath );
69  
70          assertEquals( diff, oldPath );
71      }
72  }