50 and Child<CE> 51 */ 52 53 import javadoc.tester.JavadocTester; 54 55 public class TestInterface extends JavadocTester { 56 57 public static void main(String... args) throws Exception { 58 TestInterface tester = new TestInterface(); 59 tester.runTests(); 60 } 61 62 @Test 63 public void test() { 64 javadoc("-d", "out", 65 "-sourcepath", testSrc, 66 "pkg"); 67 checkExit(Exit.OK); 68 69 checkOutput("pkg/Interface.html", true, 70 "<pre class=\"methodSignature\">int method()</pre>", 71 "<pre>static final int field</pre>", 72 // Make sure known implementing class list is correct and omits type parameters. 73 "<dl>\n" 74 + "<dt>All Known Implementing Classes:</dt>\n" 75 + "<dd><code><a href=\"Child.html\" title=\"class in pkg\">Child" 76 + "</a></code>, <code><a href=\"Parent.html\" title=\"class in pkg\">Parent" 77 + "</a></code></dd>\n" 78 + "</dl>"); 79 80 checkOutput("pkg/Child.html", true, 81 // Make sure "All Implemented Interfaces": has substituted type parameters 82 "<dl>\n" 83 + "<dt>All Implemented Interfaces:</dt>\n" 84 + "<dd><code><a href=\"Interface.html\" title=\"interface in pkg\">" 85 + "Interface</a><CE></code></dd>\n" 86 + "</dl>", 87 //Make sure Class Tree has substituted type parameters. 88 "<div class=\"inheritance\" title=\"Inheritance Tree\">java.lang.Object\n" 89 + "<div class=\"inheritance\"><a href=\"Parent.html\"" 90 + " title=\"class in pkg\">pkg.Parent</a><CE>\n" 91 + "<div class=\"inheritance\">pkg.Child<CE></div>\n" 92 + "</div>\n</div>", 93 //Make sure "Specified By" has substituted type parameters. 94 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n" 95 + "<dd><code><a href=\"Interface.html#method()\">method</a>" 96 + "</code> in interface <code>" 97 + "<a href=\"Interface.html\" title=\"interface in pkg\">" 98 + "Interface</a><<a href=\"Child.html\" title=\"type parameter in Child\">" 99 + "CE</a>></code></dd>", 100 //Make sure "Overrides" has substituted type parameters. 101 "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" 102 + "<dd><code><a href=\"Parent.html#method()\">method</a>" 103 + "</code> in class <code><a href=\"Parent.html\" " 104 + "title=\"class in pkg\">Parent</a><<a href=\"Child.html\" " 105 + "title=\"type parameter in Child\">CE</a>></code></dd>"); 106 107 checkOutput("pkg/Parent.html", true, 108 //Make sure "Direct Know Subclasses" omits type parameters 109 "<dl>\n" 110 + "<dt>Direct Known Subclasses:</dt>\n" 111 + "<dd><code><a href=\"Child.html\" title=\"class in pkg\">Child" 112 + "</a></code></dd>\n" 113 + "</dl>"); 114 115 checkOutput("pkg/Interface.html", false, 116 "public int method--", 117 "public static final int field"); 118 119 checkOutput("pkg/ClassWithStaticMembers.html", false, 120 //Make sure "Specified By" does not appear on class documentation when 121 //the method is a static method in the interface. 122 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"); 123 124 checkOutput("pkg/ClassWithStaticMembers.html", true, 125 "<h3>f</h3>\n" 126 + "<a id=\"f\">\n" 127 + "<!-- -->\n" 128 + "</a>\n" 129 + "<pre>public static int f</pre>\n" 130 + "<div class=\"block\">A hider field</div>", 131 132 "<td class=\"colFirst\"><code>static void</code></td>\n" 133 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" 134 + "<a href=\"#m()\">m</a></span>()</code></th>\n" 135 + "<td class=\"colLast\">\n" 136 + "<div class=\"block\">A hider method</div>\n" 137 + "</td>\n", 138 139 "<h3>staticMethod</h3>\n" 140 + "<a id=\"staticMethod()\">\n" 141 + "<!-- -->\n" 142 + "</a>\n" 143 + "<pre class=\"methodSignature\">public static void staticMethod()</pre>\n" 144 + "<div class=\"block\"><span class=\"descfrmTypeLabel\">" 145 + "Description copied from interface: <code>" 146 + "<a href=\"InterfaceWithStaticMembers.html#staticMethod()\">" 147 + "InterfaceWithStaticMembers</a></code></span></div>\n" 148 + "<div class=\"block\">A static method</div>\n"); 149 150 checkOutput("pkg/ClassWithStaticMembers.InnerClass.html", true, 151 "<pre>public static class <span class=\"typeNameLabel\">" 152 + "ClassWithStaticMembers.InnerClass</span>\n" 153 + "extends java.lang.Object</pre>\n" 154 + "<div class=\"block\">A hider inner class</div>"); 155 } 156 157 @Test 158 public void test1() { 159 javadoc("-d", "out-1", 160 "-sourcepath", testSrc, 161 "pkg1"); 162 checkExit(Exit.OK); 163 164 checkOutput("pkg1/Child.html", true, 165 // Ensure the correct Overrides in the inheritance hierarchy is reported 166 "<span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" + 167 "<dd><code><a href=\"GrandParent.html#method1()\">method1</a></code>" + 168 " in class " + 169 "<code><a href=\"GrandParent.html\" title=\"class in pkg1\">GrandParent</a>" + 170 "<<a href=\"Child.html\" title=\"type parameter in Child\">CE</a>></code>"); 171 } 172 173 @Test 174 public void test2() { 175 javadoc("-d", "out-2", 176 "-sourcepath", testSrc, 177 "pkg2"); 178 179 checkExit(Exit.OK); 180 181 checkOutput("pkg2/Spliterator.OfDouble.html", true, 182 // Ensure the correct type parameters are displayed correctly 183 "<h2>Nested classes/interfaces inherited from interface pkg2." 184 + "<a href=\"Spliterator.html\" title=\"interface in pkg2\">Spliterator</a></h2>\n" 185 + "<a id=\"nested.classes.inherited.from.class.pkg2.Spliterator\">\n" 186 + "<!-- -->\n" | 50 and Child<CE> 51 */ 52 53 import javadoc.tester.JavadocTester; 54 55 public class TestInterface extends JavadocTester { 56 57 public static void main(String... args) throws Exception { 58 TestInterface tester = new TestInterface(); 59 tester.runTests(); 60 } 61 62 @Test 63 public void test() { 64 javadoc("-d", "out", 65 "-sourcepath", testSrc, 66 "pkg"); 67 checkExit(Exit.OK); 68 69 checkOutput("pkg/Interface.html", true, 70 "<div class=\"memberSignature\"><span class=\"returnType\">int</span> " 71 + "<span class=\"memberName\">method</span>()</div>", 72 "<div class=\"memberSignature\"><span class=\"modifiers\">static final</span> " 73 + "<span class=\"returnType\">int</span> <span class=\"memberName\">field</span></div>", 74 // Make sure known implementing class list is correct and omits type parameters. 75 "<dl>\n" 76 + "<dt>All Known Implementing Classes:</dt>\n" 77 + "<dd><code><a href=\"Child.html\" title=\"class in pkg\">Child" 78 + "</a></code>, <code><a href=\"Parent.html\" title=\"class in pkg\">Parent" 79 + "</a></code></dd>\n" 80 + "</dl>"); 81 82 checkOutput("pkg/Child.html", true, 83 // Make sure "All Implemented Interfaces": has substituted type parameters 84 "<dl>\n" 85 + "<dt>All Implemented Interfaces:</dt>\n" 86 + "<dd><code><a href=\"Interface.html\" title=\"interface in pkg\">" 87 + "Interface</a><CE></code></dd>\n" 88 + "</dl>", 89 //Make sure Class Tree has substituted type parameters. 90 "<div class=\"inheritance\" title=\"Inheritance Tree\">java.lang.Object\n" 91 + "<div class=\"inheritance\"><a href=\"Parent.html\"" 92 + " title=\"class in pkg\">pkg.Parent</a><CE>\n" 93 + "<div class=\"inheritance\">pkg.Child<CE></div>\n" 94 + "</div>\n</div>", 95 //Make sure "Specified By" has substituted type parameters. 96 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n" 97 + "<dd><code><a href=\"Interface.html#method()\">method</a>" 98 + "</code> in interface <code>" 99 + "<a href=\"Interface.html\" title=\"interface in pkg\">" 100 + "Interface</a><<a href=\"Child.html\" title=\"type parameter in Child\">" 101 + "CE</a>></code></dd>", 102 //Make sure "Overrides" has substituted type parameters. 103 "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" 104 + "<dd><code><a href=\"Parent.html#method()\">method</a>" 105 + "</code> in class <code><a href=\"Parent.html\" " 106 + "title=\"class in pkg\">Parent</a><<a href=\"Child.html\" " 107 + "title=\"type parameter in Child\">CE</a>></code></dd>"); 108 109 checkOutput("pkg/Parent.html", true, 110 //Make sure "Direct Know Subclasses" omits type parameters 111 "<dl>\n" 112 + "<dt>Direct Known Subclasses:</dt>\n" 113 + "<dd><code><a href=\"Child.html\" title=\"class in pkg\">Child" 114 + "</a></code></dd>\n" 115 + "</dl>"); 116 117 checkOutput("pkg/Interface.html", false, 118 "public int method--", 119 "public static final int field"); 120 121 checkOutput("pkg/ClassWithStaticMembers.html", false, 122 //Make sure "Specified By" does not appear on class documentation when 123 //the method is a static method in the interface. 124 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"); 125 126 checkOutput("pkg/ClassWithStaticMembers.html", true, 127 "<h3>f</h3>\n" 128 + "<a id=\"f\">\n" 129 + "<!-- -->\n" 130 + "</a>\n" 131 + "<div class=\"memberSignature\"><span class=\"modifiers\">public static</span> " 132 + "<span class=\"returnType\">int</span> <span class=\"memberName\">f</span></div>\n" 133 + "<div class=\"block\">A hider field</div>", 134 135 "<td class=\"colFirst\"><code>static void</code></td>\n" 136 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" 137 + "<a href=\"#m()\">m</a></span>()</code></th>\n" 138 + "<td class=\"colLast\">\n" 139 + "<div class=\"block\">A hider method</div>\n" 140 + "</td>\n", 141 142 "<h3>staticMethod</h3>\n" 143 + "<a id=\"staticMethod()\">\n" 144 + "<!-- -->\n" 145 + "</a>\n" 146 + "<div class=\"memberSignature\"><span class=\"modifiers\">public static</span> " 147 + "<span class=\"returnType\">void</span> <span class=\"memberName\">staticMethod</span>()</div>\n" 148 + "<div class=\"block\"><span class=\"descfrmTypeLabel\">" 149 + "Description copied from interface: <code>" 150 + "<a href=\"InterfaceWithStaticMembers.html#staticMethod()\">" 151 + "InterfaceWithStaticMembers</a></code></span></div>\n" 152 + "<div class=\"block\">A static method</div>\n"); 153 154 checkOutput("pkg/ClassWithStaticMembers.InnerClass.html", true, 155 "<pre>public static class <span class=\"typeNameLabel\">" 156 + "ClassWithStaticMembers.InnerClass</span>\n" 157 + "extends java.lang.Object</pre>\n" 158 + "<div class=\"block\">A hider inner class</div>"); 159 } 160 161 @Test 162 public void test1() { 163 javadoc("-d", "out-1", 164 "-sourcepath", testSrc, 165 "pkg1"); 166 checkExit(Exit.OK); 167 168 checkOutput("pkg1/Child.html", true, 169 // Ensure the correct Overrides in the inheritance hierarchy is reported 170 "<span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" + 171 "<dd><code><a href=\"GrandParent.html#method1()\">method1</a></code>" + 172 " in class " + 173 "<code><a href=\"GrandParent.html\" title=\"class in pkg1\">GrandParent</a>" + 174 "<<a href=\"Child.html\" title=\"type parameter in Child\">CE</a>></code>"); 175 } 176 177 @Test 178 public void test2() { 179 javadoc("-d", "out-2", 180 "-sourcepath", testSrc, 181 "pkg2"); 182 183 checkExit(Exit.OK); 184 185 checkOutput("pkg2/Spliterator.OfDouble.html", true, 186 // Ensure the correct type parameters are displayed correctly 187 "<h2>Nested classes/interfaces inherited from interface pkg2." 188 + "<a href=\"Spliterator.html\" title=\"interface in pkg2\">Spliterator</a></h2>\n" 189 + "<a id=\"nested.classes.inherited.from.class.pkg2.Spliterator\">\n" 190 + "<!-- -->\n" |