1 /* 2 * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 26 * @bug 4973609 8015249 8025633 8026567 6469561 8071982 8162363 8182765 27 * @summary Make sure that annotation types with 0 members does not have 28 * extra HR tags. 29 * @author jamieh 30 * @library ../../lib 31 * @modules jdk.javadoc/jdk.javadoc.internal.tool 32 * @build javadoc.tester.* 33 * @run main TestAnnotationTypes 34 */ 35 36 import javadoc.tester.JavadocTester; 37 38 public class TestAnnotationTypes extends JavadocTester { 39 40 public static void main(String... args) throws Exception { 41 TestAnnotationTypes tester = new TestAnnotationTypes(); 42 tester.runTests(); 43 } 44 45 @Test 46 public void test() { 47 javadoc("-d", "out-1", 48 "-sourcepath", testSrc, 49 "pkg"); 50 checkExit(Exit.OK); 51 52 checkOutput("pkg/AnnotationTypeField.html", true, 53 "<li>Summary: </li>\n" 54 + "<li><a href=\"#annotation.type." 55 + "field.summary\">Field</a> | </li>", 56 "<li>Detail: </li>\n" 57 + "<li><a href=\"#annotation.type." 58 + "field.detail\">Field</a> | </li>", 59 "<!-- =========== ANNOTATION TYPE FIELD SUMMARY =========== -->", 60 "<h2>Field Summary</h2>", 61 "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\"><a href=\"#DEFAULT_NAME\">DEFAULT_NAME</a></span>" 62 + "</code></th>", 63 "<!-- ============ ANNOTATION TYPE FIELD DETAIL =========== -->", 64 "<h3>DEFAULT_NAME</h3>\n" 65 + "<a id=\"DEFAULT_NAME\">\n" 66 + "<!-- -->\n" 67 + "</a>\n" 68 + "<pre>static final java." 69 + "lang.String DEFAULT_NAME</pre>"); 70 71 checkOutput("pkg/AnnotationType.html", true, 72 "<li>Summary: </li>\n" 73 + "<li>Field | </li>", 74 "<li>Detail: </li>\n" 75 + "<li>Field | </li>"); 76 77 checkOutput("pkg/AnnotationType.html", true, 78 "<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->", 79 "<ul class=\"blockList\">", 80 "<li class=\"blockList\">", 81 "<section class=\"memberDetails\">", 82 "<h2>Element Details</h2>", 83 "<a id=\"annotation.type.element.detail\">", 84 "<!-- -->", 85 "</a>", 86 "<ul class=\"blockList\">", 87 "<li class=\"blockListLast\">", 88 "<section class=\"detail\">", 89 "<h3>value</h3>", 90 "<a id=\"value()\">", 91 "<!-- -->", 92 "</a>", 93 "<pre>int value</pre>"); 94 95 checkOutput("pkg/AnnotationType.html", false, 96 "<HR>\n\n" 97 + "<P>\n\n" 98 + "<P>" 99 + "<!-- ========= END OF CLASS DATA ========= -->" + "<HR>"); 100 } 101 102 @Test 103 public void testLinkSource() { 104 javadoc("-d", "out-2", 105 "-linksource", 106 "-sourcepath", testSrc, 107 "pkg"); 108 checkExit(Exit.OK); 109 110 checkOutput("src-html/pkg/AnnotationType.html", true, 111 "<title>Source code</title>", 112 "@Documented public @interface AnnotationType {"); 113 114 checkOutput("src-html/pkg/AnnotationTypeField.html", true, 115 "<title>Source code</title>", 116 "@Documented public @interface AnnotationTypeField {"); 117 118 checkOutput("pkg/AnnotationType.html", true, 119 "public @interface <a href=\"../src-html/pkg/AnnotationType.html#line.34" 120 + "\">AnnotationType</a></pre>"); 121 122 checkOutput("pkg/AnnotationTypeField.html", true, 123 "public @interface <a href=\"../src-html/pkg/AnnotationTypeField.html#line.31" 124 + "\">AnnotationTypeField</a></pre>"); 125 } 126 } --- EOF ---