1 /*
   2  * Copyright (c) 2003, 2013, 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      4927552 8026567
  27  * @summary  <DESC>
  28  * @author   jamieh
  29  * @library  ../lib/
  30  * @build    JavadocTester TestDeprecatedDocs
  31  * @run main TestDeprecatedDocs
  32  */
  33 
  34 public class TestDeprecatedDocs extends JavadocTester {
  35 
  36     //Test information.
  37     private static final String BUG_ID = "4927552";
  38 
  39     //Javadoc arguments.
  40     private static final String[] ARGS = new String[] {
  41         "-d", BUG_ID, "-source", "1.5", "-sourcepath", SRC_DIR, "pkg"
  42     };
  43 
  44     private static final String TARGET_FILE  =
  45         BUG_ID + FS + "deprecated-list.html";
  46 
  47     private static final String TARGET_FILE2  =
  48         BUG_ID + FS + "pkg" + FS + "DeprecatedClassByAnnotation.html";
  49 
  50     //Input for string search tests.
  51     private static final String[][] TEST = {
  52         {TARGET_FILE, "annotation_test1 passes"},
  53         {TARGET_FILE, "annotation_test2 passes"},
  54         {TARGET_FILE, "annotation_test3 passes"},
  55         {TARGET_FILE, "class_test1 passes"},
  56         {TARGET_FILE, "class_test2 passes"},
  57         {TARGET_FILE, "class_test3 passes"},
  58         {TARGET_FILE, "class_test4 passes"},
  59         {TARGET_FILE, "enum_test1 passes"},
  60         {TARGET_FILE, "enum_test2 passes"},
  61         {TARGET_FILE, "error_test1 passes"},
  62         {TARGET_FILE, "error_test2 passes"},
  63         {TARGET_FILE, "error_test3 passes"},
  64         {TARGET_FILE, "error_test4 passes"},
  65         {TARGET_FILE, "exception_test1 passes"},
  66         {TARGET_FILE, "exception_test2 passes"},
  67         {TARGET_FILE, "exception_test3 passes"},
  68         {TARGET_FILE, "exception_test4 passes"},
  69         {TARGET_FILE, "interface_test1 passes"},
  70         {TARGET_FILE, "interface_test2 passes"},
  71         {TARGET_FILE, "interface_test3 passes"},
  72         {TARGET_FILE, "interface_test4 passes"},
  73         {TARGET_FILE, "pkg.DeprecatedClassByAnnotation"},
  74         {TARGET_FILE, "pkg.DeprecatedClassByAnnotation()"},
  75         {TARGET_FILE, "pkg.DeprecatedClassByAnnotation.method()"},
  76         {TARGET_FILE, "pkg.DeprecatedClassByAnnotation.field"},
  77 
  78         {TARGET_FILE2, "<pre>@Deprecated" + NL +
  79                  "public class <span class=\"typeNameLabel\">DeprecatedClassByAnnotation</span>" + NL +
  80                  "extends java.lang.Object</pre>"},
  81 
  82         {TARGET_FILE2, "<pre>@Deprecated" + NL +
  83                  "public&nbsp;int field</pre>" + NL +
  84                  "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;</div>"},
  85 
  86         {TARGET_FILE2, "<pre>@Deprecated" + NL +
  87                  "public&nbsp;DeprecatedClassByAnnotation()</pre>" + NL +
  88                  "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;</div>"},
  89 
  90         {TARGET_FILE2, "<pre>@Deprecated" + NL +
  91                  "public&nbsp;void&nbsp;method()</pre>" + NL +
  92                  "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;</div>"},
  93     };
  94 
  95     private static final String[][] NEGATED_TEST = NO_TEST;
  96 
  97     /**
  98      * The entry point of the test.
  99      * @param args the array of command line arguments.
 100      */
 101     public static void main(String[] args) {
 102         TestDeprecatedDocs tester = new TestDeprecatedDocs();
 103         run(tester, ARGS, TEST, NEGATED_TEST);
 104         tester.printSummary();
 105     }
 106 
 107     /**
 108      * {@inheritDoc}
 109      */
 110     public String getBugId() {
 111         return BUG_ID;
 112     }
 113 
 114     /**
 115      * {@inheritDoc}
 116      */
 117     public String getBugName() {
 118         return getClass().getName();
 119     }
 120 }