Path: blob/master/test/langtools/jdk/javadoc/doclet/testClassCrossReferences/TestClassCrossReferences.java
40971 views
/*1* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 4652655 4857717 8025633 8026567 8071982 8164407 8182765 8205593 824016926* @summary This test verifies that class cross references work properly.27* @library ../../lib28* @modules jdk.javadoc/jdk.javadoc.internal.tool29* @build javadoc.tester.*30* @build TestClassCrossReferences31* @run main TestClassCrossReferences32*/3334import javadoc.tester.JavadocTester;3536public class TestClassCrossReferences extends JavadocTester {3738static final String uri = "http://docs.oracle.com/javase/8/docs/api/";3940public static void main(String... args) throws Exception {41TestClassCrossReferences tester = new TestClassCrossReferences();42tester.runTests();43}4445@Test46public void test() {47javadoc("-d", "out",48"-source", "8",49"-Xdoclint:none",50"-sourcepath", testSrc,51"-linkoffline", uri, testSrc,52"--no-platform-links",53testSrc("C.java"));54checkExit(Exit.OK);5556checkOutput("C.html", true,57"<a href=\"" + uri + """58java/math/package-summary.html" class="external-link"><code>Link to math package</code></a>""",59"<a href=\"" + uri + """60javax/swing/text/AbstractDocument.AttributeContext.html" title="class or interfa\61ce in javax.swing.text" class="external-link"><code>Link to AttributeContext inn\62erclass</code></a>""",63"<a href=\"" + uri + """64java/math/BigDecimal.html" title="class or interface in java.math" class="extern\65al-link"><code>Link to external class BigDecimal</code></a>""",66"<a href=\"" + uri + """67java/math/BigInteger.html#gcd(java.math.BigInteger)" title="class or interface i\68n java.math" class="external-link"><code>Link to external member gcd</code></a>""",69"<a href=\"" + uri + """70javax/tools/SimpleJavaFileObject.html#uri" title="class or interface in javax.to\71ols" class="external-link"><code>Link to external member URI</code></a>""",72"""73<dl class="notes">74<dt>Overrides:</dt>75<dd><code>toString</code> in class <code>java.lang.Object</code></dd>76</dl>""");77}7879@Test80public void test_warning() {81javadoc("-d", "out-warning",82"-Xdoclint:none",83"-sourcepath", testSrc,84"-linkoffline", uri, testSrc,85"--no-platform-links",86testSrc("C.java"));87checkExit(Exit.OK);8889checkOutput(Output.OUT, true,90"The code being documented uses modules but the packages defined"91+ " in http://docs.oracle.com/javase/8/docs/api/ are in the unnamed module");9293checkOutput("C.html", true,94"<a href=\"" + uri + """95java/math/package-summary.html" class="external-link"><code>Link to math package</code></a>""",96"<a href=\"" + uri + """97javax/swing/text/AbstractDocument.AttributeContext.html" title="class or interfa\98ce in javax.swing.text" class="external-link"><code>Link to AttributeContext inn\99erclass</code></a>""",100"<a href=\"" + uri + """101java/math/BigDecimal.html" title="class or interface in java.math" class="extern\102al-link"><code>Link to external class BigDecimal</code></a>""",103"<a href=\"" + uri + """104java/math/BigInteger.html#gcd(java.math.BigInteger)" title="class or interface i\105n java.math" class="external-link"><code>Link to external member gcd</code></a>""",106"<a href=\"" + uri + """107javax/tools/SimpleJavaFileObject.html#uri" title="class or interface in javax.to\108ols" class="external-link"><code>Link to external member URI</code></a>""",109"""110<dl class="notes">111<dt>Overrides:</dt>112<dd><code>toString</code> in class <code>java.lang.Object</code></dd>113</dl>""");114}115}116117118