Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/langtools/jdk/javadoc/doclet/testAuthor/TestAuthor.java
40971 views
1
/*
2
* Copyright (c) 2018, 2020, 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 8202947 8239804
27
* @summary test the at-author tag, and corresponding option
28
* @library /tools/lib ../../lib
29
* @modules jdk.javadoc/jdk.javadoc.internal.tool
30
* @build toolbox.ToolBox javadoc.tester.*
31
* @run main TestAuthor
32
*/
33
34
import java.nio.file.Files;
35
import java.nio.file.Path;
36
import java.nio.file.Paths;
37
38
import javadoc.tester.JavadocTester;
39
import toolbox.ToolBox;
40
41
public class TestAuthor extends JavadocTester {
42
43
public static void main(String... args) throws Exception {
44
TestAuthor tester = new TestAuthor();
45
tester.runTests();
46
}
47
48
ToolBox tb = new ToolBox();
49
Path src;
50
51
TestAuthor() throws Exception {
52
src = Files.createDirectories(Paths.get("src"));
53
tb.writeJavaFiles(src,
54
"""
55
package pkg;
56
/** Introduction.\s
57
* @author anonymous
58
*/
59
public class Test { }
60
""");
61
}
62
63
@Test
64
public void testAuthor() {
65
javadoc("-d", "out-author",
66
"-sourcepath", src.toString(),
67
"-author",
68
"pkg");
69
checkExit(Exit.OK);
70
71
checkAuthor(true);
72
}
73
74
@Test
75
public void testNoAuthor() {
76
javadoc("-d", "out-noauthor",
77
"-sourcepath", src.toString(),
78
"pkg");
79
checkExit(Exit.OK);
80
81
checkAuthor(false);
82
}
83
84
void checkAuthor(boolean on) {
85
checkOutput("pkg/Test.html", on,
86
"""
87
<dl class="notes">
88
<dt>Author:</dt>
89
<dd>anonymous</dd>
90
</dl>""");
91
}
92
}
93
94