TestAnnotationTypes.java revision 3300:d52219fa3026
1/* 2 * Copyright (c) 2004, 2016, 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 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 JavadocTester 33 * @run main TestAnnotationTypes 34 */ 35 36public class TestAnnotationTypes extends JavadocTester { 37 38 public static void main(String... args) throws Exception { 39 TestAnnotationTypes tester = new TestAnnotationTypes(); 40 tester.runTests(); 41 } 42 43 @Test 44 void test() { 45 javadoc("-d", "out-1", 46 "-sourcepath", testSrc, 47 "pkg"); 48 checkExit(Exit.OK); 49 50 checkOutput("pkg/AnnotationTypeField.html", true, 51 "<li>Summary: </li>\n" 52 + "<li><a href=\"#annotation.type." 53 + "field.summary\">Field</a> | </li>", 54 "<li>Detail: </li>\n" 55 + "<li><a href=\"#annotation.type." 56 + "field.detail\">Field</a> | </li>", 57 "<!-- =========== ANNOTATION TYPE FIELD SUMMARY =========== -->", 58 "<h3>Field Summary</h3>", 59 "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../" 60 + "pkg/AnnotationTypeField.html#DEFAULT_NAME\">DEFAULT_NAME</a></span>" 61 + "</code> </td>", 62 "<!-- ============ ANNOTATION TYPE FIELD DETAIL =========== -->", 63 "<h4>DEFAULT_NAME</h4>\n" 64 + "<pre>static final java." 65 + "lang.String DEFAULT_NAME</pre>"); 66 67 checkOutput("pkg/AnnotationType.html", true, 68 "<li>Summary: </li>\n" 69 + "<li>Field | </li>", 70 "<li>Detail: </li>\n" 71 + "<li>Field | </li>"); 72 73 checkOutput("pkg/AnnotationType.html", true, 74 "<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->", 75 "<ul class=\"blockList\">", 76 "<li class=\"blockList\"><a name=\"annotation.type.element.detail\">", 77 "<!-- -->", 78 "</a>", 79 "<h3>Element Detail</h3>", 80 "<a name=\"value--\">", 81 "<!-- -->", 82 "</a>", 83 "<ul class=\"blockListLast\">", 84 "<li class=\"blockList\">", 85 "<h4>value</h4>", 86 "<pre>int value</pre>" ); 87 88 checkOutput("pkg/AnnotationType.html", false, 89 "<HR>\n\n" 90 + "<P>\n\n" 91 + "<P>" 92 + "<!-- ========= END OF CLASS DATA ========= -->" + "<HR>"); 93 94 javadoc("-d", "out-2", 95 "-linksource", 96 "-sourcepath", testSrc, 97 "pkg"); 98 checkExit(Exit.OK); 99 100 checkOutput("src-html/pkg/AnnotationType.html", true, 101 "<title>Source code</title>", 102 "@Documented public @interface AnnotationType {"); 103 104 checkOutput("src-html/pkg/AnnotationTypeField.html", true, 105 "<title>Source code</title>", 106 "@Documented public @interface AnnotationTypeField {"); 107 108 checkOutput("pkg/AnnotationType.html", true, 109 "public @interface <a href=\"../src-html/pkg/AnnotationType.html#line.34" 110 + "\">AnnotationType</a></pre>"); 111 112 checkOutput("pkg/AnnotationTypeField.html", true, 113 "public @interface <a href=\"../src-html/pkg/AnnotationTypeField.html#line.31" 114 + "\">AnnotationTypeField</a></pre>"); 115 } 116} 117