< prev index next >

test/langtools/jdk/javadoc/doclet/testPrivateClasses/TestPrivateClasses.java

Print this page




  53 
  54     @Test
  55     public void testDefault() {
  56         javadoc("-d", "out-default",
  57                 "-sourcepath", testSrc,
  58                 "pkg", "pkg2");
  59         checkExit(Exit.OK);
  60 
  61         checkOutput("pkg/PublicChild.html", true,
  62                 // Field inheritence from non-public superclass.
  63                 "<a href=\"#fieldInheritedFromParent\">"
  64                 + "fieldInheritedFromParent</a>",
  65                 // Method inheritance from non-public superclass.
  66                 "<a href=\"#methodInheritedFromParent(int)\">"
  67                 + "methodInheritedFromParent</a>",
  68                 // private class does not show up in tree
  69                 "<div class=\"inheritance\" title=\"Inheritance Tree\">java.lang.Object\n"
  70                 + "<div class=\"inheritance\">pkg.PublicChild</div>\n"
  71                 + "</div>",
  72                 // Method is documented as though it is declared in the inheriting method.
  73                 "<pre class=\"methodSignature\">public&nbsp;void&nbsp;methodInheritedFromParent​(int&nbsp;p1)",



  74                 "<dl>\n"
  75                 + "<dt>All Implemented Interfaces:</dt>\n"
  76                 + "<dd><code><a href=\"PublicInterface.html\" title=\"interface in pkg\">"
  77                 + "PublicInterface</a></code></dd>\n"
  78                 + "</dl>");
  79 
  80         checkOutput("pkg/PublicChild.html", false,
  81                 // Should not document that a method overrides method from private class.
  82                 "<span class=\"overrideSpecifyLabel\">Overrides:</span>",
  83                 // Should not document that a method specified by private interface.
  84                 "<span class=\"overrideSpecifyLabel\">Specified by:</span>",
  85                 // Should not mention that any documentation was copied.
  86                 "Description copied from",
  87                 // Don't extend private classes or interfaces
  88                 "PrivateParent",
  89                 "PrivateInterface");
  90 
  91         checkOutput("pkg/PublicChild.html", false,
  92                 // Should not document comments from private inherited interfaces
  93                 "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
  94                 + "<a href=\"#methodInterface(int)\">"
  95                 + "methodInterface</a></span>​(int&nbsp;p1)</code>\n"
  96                 + "<div class=\"block\">Comment from interface.</div>\n</td>",
  97                 // and similarly one more
  98                 "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
  99                 + "<a href=\"#methodInterface2(int)\">"
 100                 + "methodInterface2</a></span>​(int&nbsp;p1)</code>\n"
 101                 + "<div class=\"block\">Comment from interface.</div>\n</td>"
 102         );
 103 
 104         checkOutput("pkg/PublicInterface.html", true,
 105                 // Field inheritance from non-public superinterface.
 106                 "<a href=\"#fieldInheritedFromInterface\">"
 107                 + "fieldInheritedFromInterface</a>",
 108                 // Method inheritance from non-public superinterface.
 109                 "<a href=\"#methodInterface(int)\">"
 110                 + "methodInterface</a>",
 111                 //Make sure implemented interfaces from private superclass are inherited
 112                 "<dl>\n"
 113                 + "<dt>All Known Implementing Classes:</dt>\n"
 114                 + "<dd><code><a href=\"PublicChild.html\" title=\"class in pkg\">"
 115                 + "PublicChild</a></code></dd>\n"
 116                 + "</dl>");
 117 
 118         checkOutput("pkg/PublicInterface.html", false,
 119                 "<span class=\"overrideSpecifyLabel\">Specified by:</span>",
 120                 "Description copied from",
 121                 "PrivateInterface",
 122                 "All Superinterfaces");
 123 
 124         checkOutput("pkg2/C.html", false,
 125                 //Generic interface method test.
 126                 "This comment should get copied to the implementing class");
 127 
 128         checkOutput("pkg2/C.html", false,
 129                 //Do not inherit private interface method with generic parameters.
 130                 //This method has been implemented.
 131                 "<span class=\"memberNameLink\"><a href=\"I.html#hello(T)\">hello</a></span>");
 132 
 133         checkOutput("constant-values.html", false,
 134                 // Make inherited constant are documented correctly.
 135                 "PrivateInterface");
 136     }
 137 
 138     @Test
 139     public void testPrivate() {
 140         javadoc("-d", "out-private",
 141                 "-sourcepath", testSrc,
 142                 "-private",
 143                 "pkg", "pkg2");
 144         checkExit(Exit.OK);
 145 
 146         checkOutput("pkg/PublicChild.html", true,
 147                 // Field inheritence from non-public superclass.
 148                 "Fields inherited from class&nbsp;pkg."
 149                 + "<a href=\"PrivateParent.html\" title=\"class in pkg\">"
 150                 + "PrivateParent</a>",
 151                 "<a href=\"PrivateParent.html#fieldInheritedFromParent\">"
 152                 + "fieldInheritedFromParent</a>",
 153                 // Method inheritence from non-public superclass.
 154                 "Methods inherited from class&nbsp;pkg."
 155                 + "<a href=\"PrivateParent.html\" title=\"class in pkg\">"
 156                 + "PrivateParent</a>",
 157                 "<a href=\"PrivateParent.html#methodInheritedFromParent(int)\">"
 158                 + "methodInheritedFromParent</a>",
 159                 // Should document that a method overrides method from private class.
 160                 "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
 161                 + "<dd><code><a href=\"PrivateParent.html#methodOverridenFromParent(char%5B%5D,int,T,V,java.util.List)\">"
 162                 + "methodOverridenFromParent</a></code>&nbsp;in class&nbsp;<code>"
 163                 + "<a href=\"PrivateParent.html\" title=\"class in pkg\">"
 164                 + "PrivateParent</a></code></dd>",
 165                 // Should document that a method is specified by private interface.
 166                 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
 167                 + "<dd><code><a href=\"PrivateInterface.html#methodInterface(int)\">"
 168                 + "methodInterface</a></code>&nbsp;in interface&nbsp;<code>"
 169                 + "<a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
 170                 + "PrivateInterface</a></code></dd>",
 171                 // Should mention that any documentation was copied.
 172                 "Description copied from",
 173                 // Extend documented private classes or interfaces
 174                 "extends",
 175                 "<dl>\n"
 176                 + "<dt>All Implemented Interfaces:</dt>\n"
 177                 + "<dd><code><a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
 178                 + "PrivateInterface</a></code>, "
 179                 + "<code><a href=\"PublicInterface.html\" title=\"interface in pkg\">"
 180                 + "PublicInterface</a></code></dd>\n"
 181                 + "</dl>",
 182                 "<pre>public class <span class=\"typeNameLabel\">PublicChild</span>");
 183 
 184         checkOutput("pkg/PublicInterface.html", true,
 185                 // Field inheritence from non-public superinterface.
 186                 "Fields inherited from interface&nbsp;pkg."
 187                 + "<a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
 188                 + "PrivateInterface</a>",
 189                 "<a href=\"PrivateInterface.html#fieldInheritedFromInterface\">"
 190                 + "fieldInheritedFromInterface</a>",
 191                 // Method inheritance from non-public superinterface.
 192                 "Methods inherited from interface&nbsp;pkg."
 193                 + "<a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
 194                 + "PrivateInterface</a>",
 195                 // Extend documented private classes or interfaces
 196                 "extends",
 197                 "All Superinterfaces",
 198                 //Make sure implemented interfaces from private superclass are inherited
 199                 "<dl>\n"
 200                 + "<dt>All Known Implementing Classes:</dt>\n"
 201                 + "<dd><code><a href=\"PrivateParent.html\" title=\"class in pkg\">"
 202                 + "PrivateParent</a></code>, "
 203                 + "<code><a href=\"PublicChild.html\" title=\"class in pkg\">PublicChild"
 204                 + "</a></code></dd>\n"
 205                 + "</dl>");
 206 
 207         checkOutput("pkg/PrivateInterface.html", true,
 208                 "<a href=\"#methodInterface(int)\">"
 209                 + "methodInterface</a>"
 210         );
 211 
 212         checkOutput("pkg2/C.html", true,
 213                 //Since private flag is used, we can document that private interface method
 214                 //with generic parameters has been implemented.
 215                 "<span class=\"descfrmTypeLabel\">Description copied from interface:&nbsp;<code>"
 216                 + "<a href=\"I.html#hello(T)\">I</a></code></span>",
 217                 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
 218                 + "<dd><code><a href=\"I.html#hello(T)\">hello</a></code>"
 219                 + "&nbsp;in interface&nbsp;<code>"
 220                 + "<a href=\"I.html\" title=\"interface in pkg2\">I</a>"
 221                 + "&lt;java.lang.String&gt;</code></dd>");
 222 
 223         checkOutput("pkg/PrivateParent.html", true,
 224                 //Make sure when no modifier appear in the class signature, the
 225                 //signature is displayed correctly without extra space at the beginning.
 226                 "<pre>class <span class=\"typeNameLabel\">PrivateParent</span>");
 227 
 228         checkOutput("pkg/PrivateParent.html", false,
 229                 "<pre> class <span class=\"typeNameLabel\">PrivateParent</span>");
 230     }
 231 }


  53 
  54     @Test
  55     public void testDefault() {
  56         javadoc("-d", "out-default",
  57                 "-sourcepath", testSrc,
  58                 "pkg", "pkg2");
  59         checkExit(Exit.OK);
  60 
  61         checkOutput("pkg/PublicChild.html", true,
  62                 // Field inheritence from non-public superclass.
  63                 "<a href=\"#fieldInheritedFromParent\">"
  64                 + "fieldInheritedFromParent</a>",
  65                 // Method inheritance from non-public superclass.
  66                 "<a href=\"#methodInheritedFromParent(int)\">"
  67                 + "methodInheritedFromParent</a>",
  68                 // private class does not show up in tree
  69                 "<div class=\"inheritance\" title=\"Inheritance Tree\">java.lang.Object\n"
  70                 + "<div class=\"inheritance\">pkg.PublicChild</div>\n"
  71                 + "</div>",
  72                 // Method is documented as though it is declared in the inheriting method.
  73                 "<div class=\"memberSignature\"><span class=\"modifiers\">public</span>&nbsp;"
  74                 + "<span class=\"returnType\">void</span>&nbsp;<span class=\"memberName\">"
  75                 + "methodInheritedFromParent</span>​(<span class=\"arguments\">int&nbsp;p1)</span>\n"
  76                 + "                               throws <span class=\"exceptions\">java.lang.Exception</span></div>",
  77                 "<dl>\n"
  78                 + "<dt>All Implemented Interfaces:</dt>\n"
  79                 + "<dd><code><a href=\"PublicInterface.html\" title=\"interface in pkg\">"
  80                 + "PublicInterface</a></code></dd>\n"
  81                 + "</dl>");
  82 
  83         checkOutput("pkg/PublicChild.html", false,
  84                 // Should not document that a method overrides method from private class.
  85                 "<span class=\"overrideSpecifyLabel\">Overrides:</span>",
  86                 // Should not document that a method specified by private interface.
  87                 "<span class=\"overrideSpecifyLabel\">Specified by:</span>",
  88                 // Should not mention that any documentation was copied.
  89                 "Description copied from",
  90                 // Don't extend private classes or interfaces
  91                 "PrivateParent",
  92                 "PrivateInterface");
  93 
  94         checkOutput("pkg/PublicChild.html", false,
  95                 // Should not document comments from private inherited interfaces
  96                 "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
  97                 + "<a href=\"#methodInterface(int)\">"
  98                 + "methodInterface</a></span>​(int&nbsp;p1)</code>\n"
  99                 + "<div class=\"block\">Comment from interface.</div>\n</td>",
 100                 // and similarly one more
 101                 "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
 102                 + "<a href=\"#methodInterface2(int)\">"
 103                 + "methodInterface2</a></span>​(int&nbsp;p1)</code>\n"
 104                 + "<div class=\"block\">Comment from interface.</div>\n</td>"
 105         );
 106 
 107         checkOutput("pkg/PublicInterface.html", true,
 108                 // Field inheritance from non-public superinterface.
 109                 "<a href=\"#fieldInheritedFromInterface\">"
 110                 + "fieldInheritedFromInterface</a>",
 111                 // Method inheritance from non-public superinterface.
 112                 "<a href=\"#methodInterface(int)\">"
 113                 + "methodInterface</a>",
 114                 //Make sure implemented interfaces from private superclass are inherited
 115                 "<dl>\n"
 116                 + "<dt>All Known Implementing Classes:</dt>\n"
 117                 + "<dd><code><a href=\"PublicChild.html\" title=\"class in pkg\">"
 118                 + "PublicChild</a></code></dd>\n"
 119                 + "</dl>");
 120 
 121         checkOutput("pkg/PublicInterface.html", false,
 122                 "<span class=\"overrideSpecifyLabel\">Specified by:</span>",
 123                 "Description copied from",
 124                 "PrivateInterface",
 125                 "All Superinterfaces");
 126 
 127         checkOutput("pkg2/C.html", false,
 128                 //Generic interface method test.
 129                 "This comment should get copied to the implementing class");
 130 
 131         checkOutput("pkg2/C.html", false,
 132                 //Do not inherit private interface method with generic parameters.
 133                 //This method has been implemented.
 134                 "<span class=\"memberNameLink\"><a href=\"I.html#hello(T)\">hello</a></span>");
 135 
 136         checkOutput("constant-values.html", false,
 137                 // Make inherited constant are documented correctly.
 138                 "PrivateInterface");
 139     }
 140 
 141     @Test
 142     public void testPrivate() {
 143         javadoc("-d", "out-private",
 144                 "-sourcepath", testSrc,
 145                 "-private",
 146                 "pkg", "pkg2");
 147         checkExit(Exit.OK);
 148 
 149         checkOutput("pkg/PublicChild.html", true,
 150                 // Field inheritence from non-public superclass.
 151                 "Fields inherited from class&nbsp;pkg."
 152                 + "<a href=\"PrivateParent.html\" title=\"class in pkg\">"
 153                 + "PrivateParent</a>",
 154                 "<a href=\"PrivateParent.html#fieldInheritedFromParent\">"
 155                 + "fieldInheritedFromParent</a>",
 156                 // Method inheritence from non-public superclass.
 157                 "Methods inherited from class&nbsp;pkg."
 158                 + "<a href=\"PrivateParent.html\" title=\"class in pkg\">"
 159                 + "PrivateParent</a>",
 160                 "<a href=\"PrivateParent.html#methodInheritedFromParent(int)\">"
 161                 + "methodInheritedFromParent</a>",
 162                 // Should document that a method overrides method from private class.
 163                 "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
 164                 + "<dd><code><a href=\"PrivateParent.html#methodOverridenFromParent(char%5B%5D,int,T,V,java.util.List)\">"
 165                 + "methodOverridenFromParent</a></code>&nbsp;in class&nbsp;<code>"
 166                 + "<a href=\"PrivateParent.html\" title=\"class in pkg\">"
 167                 + "PrivateParent</a></code></dd>",
 168                 // Should document that a method is specified by private interface.
 169                 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
 170                 + "<dd><code><a href=\"PrivateInterface.html#methodInterface(int)\">"
 171                 + "methodInterface</a></code>&nbsp;in interface&nbsp;<code>"
 172                 + "<a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
 173                 + "PrivateInterface</a></code></dd>",
 174                 // Should mention that any documentation was copied.
 175                 "Description copied from",
 176                 // Extend documented private classes or interfaces
 177                 "extends",
 178                 "<dl>\n"
 179                 + "<dt>All Implemented Interfaces:</dt>\n"
 180                 + "<dd><code><a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
 181                 + "PrivateInterface</a></code>, "
 182                 + "<code><a href=\"PublicInterface.html\" title=\"interface in pkg\">"
 183                 + "PublicInterface</a></code></dd>\n"
 184                 + "</dl>",
 185                 "<pre>public class <span class=\"typeNameLabel\">PublicChild</span>");
 186 
 187         checkOutput("pkg/PublicInterface.html", true,
 188                 // Field inheritence from non-public superinterface.
 189                 "Fields inherited from interface&nbsp;pkg."
 190                 + "<a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
 191                 + "PrivateInterface</a>",
 192                 "<a href=\"PrivateInterface.html#fieldInheritedFromInterface\">"
 193                 + "fieldInheritedFromInterface</a>",
 194                 // Method inheritance from non-public superinterface.
 195                 "Methods inherited from interface&nbsp;pkg."
 196                 + "<a href=\"PrivateInterface.html\" title=\"interface in pkg\">"
 197                 + "PrivateInterface</a>",
 198                 // Extend documented private classes or interfaces
 199                 "extends",
 200                 "All Superinterfaces",
 201                 //Make sure implemented interfaces from private superclass are inherited
 202                 "<dl>\n"
 203                 + "<dt>All Known Implementing Classes:</dt>\n"
 204                 + "<dd><code><a href=\"PrivateParent.html\" title=\"class in pkg\">"
 205                 + "PrivateParent</a></code>, "
 206                 + "<code><a href=\"PublicChild.html\" title=\"class in pkg\">PublicChild"
 207                 + "</a></code></dd>\n"
 208                 + "</dl>");
 209 
 210         checkOutput("pkg/PrivateInterface.html", true,
 211                 "<a href=\"#methodInterface(int)\">"
 212                 + "methodInterface</a>"
 213         );
 214 
 215         checkOutput("pkg2/C.html", true,
 216                 //Since private flag is used, we can document that private interface method
 217                 //with generic parameters has been implemented.
 218                 "<span class=\"descfrmTypeLabel\">Description copied from interface:&nbsp;<code>"
 219                 + "<a href=\"I.html#hello(T)\">I</a></code></span>",
 220                 "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
 221                 + "<dd><code><a href=\"I.html#hello(T)\">hello</a></code>"
 222                 + "&nbsp;in interface&nbsp;<code>"
 223                 + "<a href=\"I.html\" title=\"interface in pkg2\">I</a>"
 224                 + "&lt;java.lang.String&gt;</code></dd>");
 225 
 226         checkOutput("pkg/PrivateParent.html", true,
 227                 //Make sure when no modifier appear in the class signature, the
 228                 //signature is displayed correctly without extra space at the beginning.
 229                 "<pre>class <span class=\"typeNameLabel\">PrivateParent</span>");
 230 
 231         checkOutput("pkg/PrivateParent.html", false,
 232                 "<pre> class <span class=\"typeNameLabel\">PrivateParent</span>");
 233     }
 234 }
< prev index next >