langtools/test/jdk/javadoc/doclet/testWarnings/TestWarnings.java
changeset 35426 374342e56a56
parent 30730 d3ce7619db2c
child 36045 9643bffe2105
equal deleted inserted replaced
35425:dc2b3ff15f13 35426:374342e56a56
       
     1 /*
       
     2  * Copyright (c) 2004, 2015, 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      4515705 4804296 4702454 4697036 8025633
       
    27  * @summary  Make sure that first sentence warning only appears once.
       
    28  *           Make sure that only warnings/errors are printed when quiet is used.
       
    29  *           Make sure that links to private/unincluded methods do not cause
       
    30  *           a "link unresolved" warning.
       
    31  *           Make sure error message starts with "error -".
       
    32  * @author   jamieh
       
    33  * @library  ../lib
       
    34  * @modules jdk.javadoc
       
    35  * @build    JavadocTester
       
    36  * @run main TestWarnings
       
    37  */
       
    38 
       
    39 public class TestWarnings extends JavadocTester {
       
    40     public static void main(String... args) throws Exception  {
       
    41         TestWarnings tester = new TestWarnings();
       
    42         tester.runTests();
       
    43     }
       
    44 
       
    45     @Test
       
    46     void testDefault() {
       
    47         javadoc("-d", "out-default",
       
    48                 "-sourcepath", testSrc,
       
    49                 "pkg");
       
    50         checkExit(Exit.FAILED);
       
    51 
       
    52         checkOutput(Output.OUT, true,
       
    53                 "X.java:23: error: self-closing element not allowed");
       
    54 
       
    55         checkOutput(Output.OUT, true,
       
    56                 "X.java:24: error: self-closing element not allowed");
       
    57 
       
    58         checkOutput(Output.OUT, true,
       
    59                 "X.java:25: error: self-closing element not allowed");
       
    60 
       
    61         checkOutput(Output.OUT, true,
       
    62                 "X.java:26: error: self-closing element not allowed");
       
    63 
       
    64         /* DCErroneous
       
    65         checkOutput(Output.OUT, true,
       
    66                 "package.html: error - Body tag missing from HTML");
       
    67         */
       
    68 
       
    69         checkOutput("pkg/X.html", false,
       
    70                 "can't find m()");
       
    71         checkOutput("pkg/X.html", false,
       
    72                 "can't find X()");
       
    73         checkOutput("pkg/X.html", false,
       
    74                 "can't find f");
       
    75     }
       
    76 
       
    77     @Test
       
    78     void testPrivate() {
       
    79         javadoc("-d", "out-private",
       
    80                 "-private",
       
    81                 "-sourcepath", testSrc,
       
    82                 "pkg");
       
    83         checkExit(Exit.FAILED);
       
    84 
       
    85         checkOutput("pkg/X.html", true,
       
    86             "<a href=\"../pkg/X.html#m--\"><code>m()</code></a><br/>",
       
    87             "<a href=\"../pkg/X.html#X--\"><code>X()</code></a><br/>",
       
    88             "<a href=\"../pkg/X.html#f\"><code>f</code></a><br/>");
       
    89     }
       
    90 }