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