1 /*
   2  * Copyright (c) 2002, 2019, 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 4504730 4526070 5077317 8162363
  27  * @summary Test the generation of constant-values.html.
  28  * @library ../../lib
  29  * @modules jdk.javadoc/jdk.javadoc.internal.tool
  30  * @build javadoc.tester.*
  31  * @run main TestConstantValuesDriver
  32  */
  33 import javadoc.tester.JavadocTester;
  34 
  35 public class TestConstantValuesDriver extends JavadocTester {
  36 
  37     public static void main(String... args) throws Exception {
  38         TestConstantValuesDriver tester = new TestConstantValuesDriver();
  39         tester.runTests();
  40     }
  41 
  42     @Test
  43     public void test() {
  44         javadoc("-d", "out",
  45                 testSrc("TestConstantValues.java"),
  46                 testSrc("TestConstantValues2.java"),
  47                 testSrc("A.java"));
  48         checkExit(Exit.OK);
  49 
  50         checkOutput("constant-values.html", true,
  51                 "TEST1PASSES",
  52                 "TEST2PASSES",
  53                 "TEST3PASSES",
  54                 "TEST4PASSES",
  55                 "<code>\"&lt;Hello World&gt;\"</code>",
  56                 "<code id=\"TestConstantValues.BYTE_MAX_VALUE\">public&nbsp;static&nbsp;final&nbsp;byte</code></td>\n" +
  57                     "<th class=\"colSecond\" scope=\"row\"><code><a href=\"TestConstantValues.html#BYTE_MAX_VALUE\">" +
  58                     "BYTE_MAX_VALUE</a></code></th>\n" +
  59                     "<td class=\"colLast\"><code>127</code></td>",
  60                 "<code id=\"TestConstantValues.BYTE_MIN_VALUE\">public&nbsp;static&nbsp;final&nbsp;byte</code></td>\n" +
  61                     "<th class=\"colSecond\" scope=\"row\"><code><a href=\"TestConstantValues.html#BYTE_MIN_VALUE\">" +
  62                     "BYTE_MIN_VALUE</a></code></th>\n" +
  63                     "<td class=\"colLast\"><code>-127</code></td>",
  64                 "<code id=\"TestConstantValues.CHAR_MAX_VALUE\">public&nbsp;static&nbsp;final&nbsp;char</code></td>\n" +
  65                     "<th class=\"colSecond\" scope=\"row\"><code><a href=\"TestConstantValues.html#CHAR_MAX_VALUE\">" +
  66                     "CHAR_MAX_VALUE</a></code></th>\n" +
  67                     "<td class=\"colLast\"><code>65535</code></td>",
  68                 "<code id=\"TestConstantValues.DOUBLE_MAX_VALUE\">public&nbsp;static&nbsp;final&nbsp;double</code></td>",
  69                     "<th class=\"colSecond\" scope=\"row\"><code><a href=\"TestConstantValues.html#DOUBLE_MAX_VALUE\">" +
  70                     "DOUBLE_MAX_VALUE</a></code></th>\n" +
  71                     "<td class=\"colLast\"><code>1.7976931348623157E308</code></td>",
  72                 "<code id=\"TestConstantValues.DOUBLE_MIN_VALUE\">public&nbsp;static&nbsp;final&nbsp;double</code></td>\n" +
  73                     "<th class=\"colSecond\" scope=\"row\"><code><a href=\"TestConstantValues.html#DOUBLE_MIN_VALUE\">" +
  74                     "DOUBLE_MIN_VALUE</a></code></th>",
  75                 "<code id=\"TestConstantValues.GOODBYE\">public&nbsp;static&nbsp;final&nbsp;boolean</code></td>\n" +
  76                     "<th class=\"colSecond\" scope=\"row\"><code><a href=\"TestConstantValues.html#GOODBYE\">" +
  77                     "GOODBYE</a></code></th>",
  78                 "<code id=\"TestConstantValues.HELLO\">public&nbsp;static&nbsp;final&nbsp;boolean</code></td>\n" +
  79                     "<th class=\"colSecond\" scope=\"row\"><code><a href=\"TestConstantValues.html#HELLO\">HELLO</a></code></th>\n" +
  80                     "<td class=\"colLast\"><code>true</code></td>"
  81         );
  82     }
  83 }