< prev index next >

test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java

Print this page




  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&nbsp;method()</pre>",
  71                 "<pre>static final&nbsp;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>&lt;CE&gt;</code></dd>\n"
  86                 + "</dl>",
  87                 //Make sure Class Tree has substituted type parameters.
  88                 "<ul class=\"inheritance\">\n"
  89                 + "<li>java.lang.Object</li>\n"
  90                 + "<li>\n"
  91                 + "<ul class=\"inheritance\">\n"
  92                 + "<li><a href=\"Parent.html\" title=\"class in pkg\">"
  93                 + "pkg.Parent</a>&lt;CE&gt;</li>\n"
  94                 + "<li>\n"
  95                 + "<ul class=\"inheritance\">\n"
  96                 + "<li>pkg.Child&lt;CE&gt;</li>\n"
  97                 + "</ul>\n"
  98                 + "</li>\n"
  99                 + "</ul>\n"
 100                 + "</li>\n"
 101                 + "</ul>",
 102                 //Make sure "Specified By" has substituted type parameters.
 103                 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
 104                 + "<dd><code><a href=\"Interface.html#method()\">method</a>"
 105                 + "</code>&nbsp;in interface&nbsp;<code>"
 106                 + "<a href=\"Interface.html\" title=\"interface in pkg\">"
 107                 + "Interface</a>&lt;<a href=\"Child.html\" title=\"type parameter in Child\">"
 108                 + "CE</a>&gt;</code></dd>",
 109                 //Make sure "Overrides" has substituted type parameters.
 110                 "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
 111                 + "<dd><code><a href=\"Parent.html#method()\">method</a>"
 112                 + "</code>&nbsp;in class&nbsp;<code><a href=\"Parent.html\" "
 113                 + "title=\"class in pkg\">Parent</a>&lt;<a href=\"Child.html\" "
 114                 + "title=\"type parameter in Child\">CE</a>&gt;</code></dd>");
 115 
 116         checkOutput("pkg/Parent.html", true,
 117                 //Make sure "Direct Know Subclasses" omits type parameters
 118                 "<dl>\n"
 119                 + "<dt>Direct Known Subclasses:</dt>\n"
 120                 + "<dd><code><a href=\"Child.html\" title=\"class in pkg\">Child"
 121                 + "</a></code></dd>\n"
 122                 + "</dl>");
 123 
 124         checkOutput("pkg/Interface.html", false,
 125                 "public int&nbsp;method--",
 126                 "public static final&nbsp;int field");
 127 
 128         checkOutput("pkg/ClassWithStaticMembers.html", false,
 129                 //Make sure "Specified By" does not appear on class documentation when
 130                 //the method is a static method in the interface.
 131                 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n");
 132 
 133         checkOutput("pkg/ClassWithStaticMembers.html", true,
 134                 "<h3>f</h3>\n"
 135                 + "<pre>public static&nbsp;int f</pre>\n"
 136                 + "<div class=\"block\">A hider field</div>",
 137 
 138                 "<td class=\"colFirst\"><code>static void</code></td>\n"
 139                 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
 140                 + "<a href=\"#m()\">m</a></span>()</code></th>\n"
 141                 + "<td class=\"colLast\">\n"
 142                 + "<div class=\"block\">A hider method</div>\n"
 143                 + "</td>\n",
 144 
 145                 "<h3>staticMethod</h3>\n"
 146                 + "<pre class=\"methodSignature\">public static&nbsp;void&nbsp;staticMethod()</pre>\n"
 147                 + "<div class=\"block\"><span class=\"descfrmTypeLabel\">"
 148                 + "Description copied from interface:&nbsp;<code>"
 149                 + "<a href=\"InterfaceWithStaticMembers.html#staticMethod()\">"
 150                 + "InterfaceWithStaticMembers</a></code></span></div>\n"
 151                 + "<div class=\"block\">A static method</div>\n");
 152 
 153         checkOutput("pkg/ClassWithStaticMembers.InnerClass.html", true,
 154                 "<pre>public static class <span class=\"typeNameLabel\">"
 155                 + "ClassWithStaticMembers.InnerClass</span>\n"
 156                 + "extends java.lang.Object</pre>\n"
 157                 + "<div class=\"block\">A hider inner class</div>");
 158     }
 159 
 160     @Test
 161     public void test1() {
 162         javadoc("-d", "out-1",
 163                 "-sourcepath", testSrc,
 164                 "pkg1");
 165         checkExit(Exit.OK);
 166 
 167         checkOutput("pkg1/Child.html", true,
 168             // Ensure the correct Overrides in the inheritance hierarchy is reported
 169             "<span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
 170             "<dd><code><a href=\"GrandParent.html#method1()\">method1</a></code>" +
 171             "&nbsp;in class&nbsp;" +
 172             "<code><a href=\"GrandParent.html\" title=\"class in pkg1\">GrandParent</a>" +
 173             "&lt;<a href=\"Child.html\" title=\"type parameter in Child\">CE</a>&gt;</code>");
 174     }
 175 
 176     @Test
 177     public void test2() {
 178         javadoc("-d", "out-2",
 179                 "-sourcepath", testSrc,
 180                 "pkg2");
 181 
 182         checkExit(Exit.OK);
 183 
 184         checkOutput("pkg2/Spliterator.OfDouble.html", true,
 185             // Ensure the correct type parameters are displayed correctly
 186             "<h2>Nested classes/interfaces inherited from interface&nbsp;pkg2."
 187             + "<a href=\"Spliterator.html\" title=\"interface in pkg2\">Spliterator</a></h2>\n"
 188             + "<code><a href=\"Spliterator.OfDouble.html\" title=\"interface in pkg2\">"
 189             + "Spliterator.OfDouble</a>, <a href=\"Spliterator.OfInt.html\" "


  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>int&nbsp;method()</pre>",
  71                 "<pre>static final&nbsp;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>&lt;CE&gt;</code></dd>\n"
  86                 + "</dl>",
  87                 //Make sure Class Tree has substituted type parameters.
  88                 "<ul class=\"inheritance\">\n"
  89                 + "<li>java.lang.Object</li>\n"
  90                 + "<li>\n"
  91                 + "<ul class=\"inheritance\">\n"
  92                 + "<li><a href=\"Parent.html\" title=\"class in pkg\">"
  93                 + "pkg.Parent</a>&lt;CE&gt;</li>\n"
  94                 + "<li>\n"
  95                 + "<ul class=\"inheritance\">\n"
  96                 + "<li>pkg.Child&lt;CE&gt;</li>\n"
  97                 + "</ul>\n"
  98                 + "</li>\n"
  99                 + "</ul>\n"
 100                 + "</li>\n"
 101                 + "</ul>",
 102                 //Make sure "Specified By" has substituted type parameters.
 103                 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
 104                 + "<dd><code><a href=\"Interface.html#method()\">method</a>"
 105                 + "</code>&nbsp;in interface&nbsp;<code>"
 106                 + "<a href=\"Interface.html\" title=\"interface in pkg\">"
 107                 + "Interface</a>&lt;<a href=\"Child.html\" title=\"type parameter in Child\">"
 108                 + "CE</a>&gt;</code></dd>",
 109                 //Make sure "Overrides" has substituted type parameters.
 110                 "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
 111                 + "<dd><code><a href=\"Parent.html#method()\">method</a>"
 112                 + "</code>&nbsp;in class&nbsp;<code><a href=\"Parent.html\" "
 113                 + "title=\"class in pkg\">Parent</a>&lt;<a href=\"Child.html\" "
 114                 + "title=\"type parameter in Child\">CE</a>&gt;</code></dd>");
 115 
 116         checkOutput("pkg/Parent.html", true,
 117                 //Make sure "Direct Know Subclasses" omits type parameters
 118                 "<dl>\n"
 119                 + "<dt>Direct Known Subclasses:</dt>\n"
 120                 + "<dd><code><a href=\"Child.html\" title=\"class in pkg\">Child"
 121                 + "</a></code></dd>\n"
 122                 + "</dl>");
 123 
 124         checkOutput("pkg/Interface.html", false,
 125                 "public int&nbsp;method--",
 126                 "public static final&nbsp;int field");
 127 
 128         checkOutput("pkg/ClassWithStaticMembers.html", false,
 129                 //Make sure "Specified By" does not appear on class documentation when
 130                 //the method is a static method in the interface.
 131                 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n");
 132 
 133         checkOutput("pkg/ClassWithStaticMembers.html", true,
 134                 "<h3>f</h3>\n"
 135                 + "<pre>public static&nbsp;int f</pre>\n"
 136                 + "<div class=\"block\">A hider field</div>",
 137 
 138                 "<td class=\"colFirst\"><code>static void</code></td>\n"
 139                 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">"
 140                 + "<a href=\"#m()\">m</a></span>()</code></th>\n"
 141                 + "<td class=\"colLast\">\n"
 142                 + "<div class=\"block\">A hider method</div>\n"
 143                 + "</td>\n",
 144 
 145                 "<h3>staticMethod</h3>\n"
 146                 + "<pre>public static&nbsp;void&nbsp;staticMethod()</pre>\n"
 147                 + "<div class=\"block\"><span class=\"descfrmTypeLabel\">"
 148                 + "Description copied from interface:&nbsp;<code>"
 149                 + "<a href=\"InterfaceWithStaticMembers.html#staticMethod()\">"
 150                 + "InterfaceWithStaticMembers</a></code></span></div>\n"
 151                 + "<div class=\"block\">A static method</div>\n");
 152 
 153         checkOutput("pkg/ClassWithStaticMembers.InnerClass.html", true,
 154                 "<pre>public static class <span class=\"typeNameLabel\">"
 155                 + "ClassWithStaticMembers.InnerClass</span>\n"
 156                 + "extends java.lang.Object</pre>\n"
 157                 + "<div class=\"block\">A hider inner class</div>");
 158     }
 159 
 160     @Test
 161     public void test1() {
 162         javadoc("-d", "out-1",
 163                 "-sourcepath", testSrc,
 164                 "pkg1");
 165         checkExit(Exit.OK);
 166 
 167         checkOutput("pkg1/Child.html", true,
 168             // Ensure the correct Overrides in the inheritance hierarchy is reported
 169             "<span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
 170             "<dd><code><a href=\"GrandParent.html#method1()\">method1</a></code>" +
 171             "&nbsp;in class&nbsp;" +
 172             "<code><a href=\"GrandParent.html\" title=\"class in pkg1\">GrandParent</a>" +
 173             "&lt;<a href=\"Child.html\" title=\"type parameter in Child\">CE</a>&gt;</code>");
 174     }
 175 
 176     @Test
 177     public void test2() {
 178         javadoc("-d", "out-2",
 179                 "-sourcepath", testSrc,
 180                 "pkg2");
 181 
 182         checkExit(Exit.OK);
 183 
 184         checkOutput("pkg2/Spliterator.OfDouble.html", true,
 185             // Ensure the correct type parameters are displayed correctly
 186             "<h2>Nested classes/interfaces inherited from interface&nbsp;pkg2."
 187             + "<a href=\"Spliterator.html\" title=\"interface in pkg2\">Spliterator</a></h2>\n"
 188             + "<code><a href=\"Spliterator.OfDouble.html\" title=\"interface in pkg2\">"
 189             + "Spliterator.OfDouble</a>, <a href=\"Spliterator.OfInt.html\" "
< prev index next >