TestUnnamedPackage.java revision 3294:9adfb22ff08f
1235426Sdelphij/*
2190225Srpaulo * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
3190225Srpaulo * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4190225Srpaulo *
5190225Srpaulo * This code is free software; you can redistribute it and/or modify it
6190225Srpaulo * under the terms of the GNU General Public License version 2 only, as
7190225Srpaulo * published by the Free Software Foundation.
8190225Srpaulo *
9190225Srpaulo * This code is distributed in the hope that it will be useful, but WITHOUT
10190225Srpaulo * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11190225Srpaulo * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12190225Srpaulo * version 2 for more details (a copy is included in the LICENSE file that
13190225Srpaulo * accompanied this code).
14190225Srpaulo *
15190225Srpaulo * You should have received a copy of the GNU General Public License version
16190225Srpaulo * 2 along with this work; if not, write to the Free Software Foundation,
17190225Srpaulo * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18190225Srpaulo *
19190225Srpaulo * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20190225Srpaulo * or visit www.oracle.com if you need additional information or have any
21190225Srpaulo * questions.
22235426Sdelphij */
23190225Srpaulo
24235426Sdelphij/*
25235426Sdelphij * @test
26190225Srpaulo * @bug      4904075 4774450 5015144 8043698
27190225Srpaulo * @summary  Reference unnamed package as "Unnamed", not empty string.
28190225Srpaulo *           Generate a package summary for the unnamed package.
29190225Srpaulo * @author   jamieh
30190225Srpaulo * @library  ../lib
31190225Srpaulo * @modules jdk.javadoc/jdk.javadoc.internal.tool
32190225Srpaulo * @build    JavadocTester
33190225Srpaulo * @run main TestUnnamedPackage
34235426Sdelphij */
35190225Srpaulo
36190225Srpaulopublic class TestUnnamedPackage extends JavadocTester {
37190225Srpaulo
38190225Srpaulo    public static void main(String... args) throws Exception {
39235426Sdelphij        TestUnnamedPackage tester = new TestUnnamedPackage();
40235426Sdelphij        tester.runTests();
41190225Srpaulo    }
42190225Srpaulo
43235426Sdelphij    @Test
44235426Sdelphij    void test() {
45235426Sdelphij        javadoc("-d", "out",
46190225Srpaulo                "-sourcepath", testSrc,
47235426Sdelphij                testSrc("C.java"));
48235426Sdelphij        checkExit(Exit.OK);
49235426Sdelphij
50190225Srpaulo        checkOutput("package-summary.html", true,
51190225Srpaulo                "<h1 title=\"Package\" class=\"title\">Package&nbsp;&lt;Unnamed&gt;</h1>",
52235426Sdelphij                "This is a package comment for the unnamed package.",
53235426Sdelphij                "This is a class in the unnamed package.");
54190225Srpaulo
55190225Srpaulo        checkOutput("package-summary.html", true,
56190225Srpaulo                "<title>&lt;Unnamed&gt;</title>");
57190225Srpaulo
58190225Srpaulo        checkOutput("package-tree.html", true,
59190225Srpaulo                "<h1 class=\"title\">Hierarchy For Package &lt;Unnamed&gt;</h1>");
60190225Srpaulo
61190225Srpaulo        checkOutput("index-all.html", true,
62235426Sdelphij                "title=\"class in &lt;Unnamed&gt;\"");
63235426Sdelphij
64190225Srpaulo        checkOutput("C.html", true,
65                "<a href=\"package-summary.html\">");
66
67        checkOutput(Output.OUT, false,
68                "BadSource");
69    }
70}
71