View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  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,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.plugin.jxr;
20  
21  import java.io.File;
22  
23  /**
24   * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
25   */
26  public class JxrTestReportTest extends AbstractJxrTestCase {
27      /**
28       * Method to test when the source dir is the test source dir
29       *
30       * @throws Exception
31       */
32      public void testSourceDir() throws Exception {
33          generateReport("test-jxr", "testsourcedir-test/testsourcedir-test-plugin-config.xml");
34  
35          File xrefTestDir = new File(getBasedir(), "target/test/unit/testsourcedir-test/target/site/xref-test");
36  
37          // check if the jxr docs were generated
38          assertTrue(new File(xrefTestDir, "testsourcedir/test/AppSampleTest.html").exists());
39          assertTrue(new File(xrefTestDir, "testsourcedir/test/AppTest.html").exists());
40          assertTrue(new File(xrefTestDir, "testsourcedir/test/package-frame.html").exists());
41          assertTrue(new File(xrefTestDir, "testsourcedir/test/package-summary.html").exists());
42          assertTrue(new File(xrefTestDir, "allclasses-frame.html").exists());
43          assertTrue(new File(xrefTestDir, "index.html").exists());
44          assertTrue(new File(xrefTestDir, "overview-frame.html").exists());
45          assertTrue(new File(xrefTestDir, "overview-summary.html").exists());
46          assertTrue(new File(xrefTestDir, "stylesheet.css").exists());
47  
48          // check if there's a link to the javadoc files
49          String str = readFile(xrefTestDir, "testsourcedir/test/AppSampleTest.html");
50          assertFalse(str.toLowerCase().contains("/apidocs/testsourcedir/test/AppSample.html\"".toLowerCase()));
51  
52          str = readFile(xrefTestDir, "testsourcedir/test/AppTest.html");
53          assertFalse(str.toLowerCase().contains("/apidocs/testsourcedir/test/App.html\"".toLowerCase()));
54      }
55  }