/* * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 8157000 * @summary test the behavior of --override-methods option * @library ../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool * @build JavadocTester * @run main TestOverrideMethods */ public class TestOverrideMethods extends JavadocTester { public static void main(String... args) throws Exception { TestOverrideMethods tester = new TestOverrideMethods(); tester.runTests(); } @Test void testInvalidOption() { // Make sure an invalid argument fails javadoc("-d", "out-bad-option", "-sourcepath", testSrc, "-javafx", "--override-methods=nonsense", "pkg5"); checkExit(Exit.CMDERR); } @Test void testDetail() { // Make sure the option works javadoc("-d", "out-detail", "-sourcepath", testSrc, "-javafx", "--override-methods=detail", "pkg5"); checkExit(Exit.OK); } @Test void testSummary() { javadoc("-d", "out-summary", "-sourcepath", testSrc, "-javafx", "--override-methods=summary", "pkg5"); checkExit(Exit.OK); checkOutput("pkg5/Classes.C.html", true, // Check properties "
rate",
// Check nested classes
"Nested classes/interfaces declared in class pkg5."
+ "Classes.P
\n"
+ ""
+ "Classes.P.PN<K,"
+ ""
+ "V>
\n",
// Check fields
"Fields declared in class pkg5.Classes.P
\n"
+ "field0
\n",
// Check method summary
"void
\n"
+ ""
+ "m1()
\n"
+ "\n"
+ "A modified method\n",
" void
\n"
+ ""
+ "m4"
+ "(java.lang.String k,\n"
+ " java.lang.String v)
\n",
// Check footnotes
"Methods declared in class pkg5.Classes.GP
\n"
+ "m0",
// Check method details for override
"Overrides: \n"
+ "m7"
+ "
in class Classes.GP
\n"
);
// Check footnotes 2
checkOrder("pkg5/Classes.C.html",
"Methods declared in class pkg5.",
"getRate, ",
"m2, ",
"m3, ",
"m4, ",
"rateProperty, ",
"setRate"
);
// Check @link
checkOrder("pkg5/Classes.C.html",
"A test of links to the methods in this class. \n",
"Classes.GP.m0()
",
"m1()
",
"Classes.P.m2()
",
"Classes.P.m3()
",
"m4(java.lang.String,java.lang.String)
",
"Classes.P.m5()
",
"m6()
",
"m7()
",
"End of links"
);
// Check @see
checkOrder("pkg5/Classes.C.html",
"See Also:",
"Classes.GP.m0()
",
"m1()
",
"Classes.P.m2()
",
"Classes.P.m3()
",
""
+ "m4(String k, String v)
",
"Classes.P.m5()
",
"m6()
",
"m7()
"
);
checkOutput("pkg5/Interfaces.D.html", true,
// Check properties
"
Properties declared in interface pkg5.Interfaces.A",
// Check nested classes
"Nested classes/interfaces declared in interface pkg5."
+ ""
+ "Interfaces.A
\n"
+ "Interfaces.A.AA",
// Check fields
"Fields declared in interface pkg5.Interfaces.A
\n"
+ "f",
// Check method summary
"void
\n"
+ ""
+ "m()
\n"
+ "\n"
+ "m in D\n",
" void
\n"
+ ""
+ "n()
\n"
+ "\n"
+ "n in D\n",
// Check footnote
"Methods declared in interface pkg5.Interfaces.A
\n"
+ "getRate, "
+ "rateProperty, "
+ "setRate",
"Methods declared in interface pkg5.Interfaces.B
\n"
+ "m1, "
+ "m3",
"Methods declared in interface pkg5.Interfaces.C
\n"
+ "o"
);
checkOrder("pkg5/Interfaces.D.html",
"Start of links ",
"Interfaces.A.m0()
",
"Interfaces.A.m1()
",
"Interfaces.A.m2()
",
"Interfaces.A.m3()
",
"m()
",
"n()
",
"Interfaces.C.o()
",
"End of links");
checkOrder("pkg5/Interfaces.D.html",
"See Also:",
"Interfaces.A.m0()
",
"Interfaces.A.m1()
",
"Interfaces.A.m2()
",
"Interfaces.A.m3()
",
"m()
",
"n()
",
"Interfaces.C.o()
");
// Test synthetic values and valuesof of an enum.
checkOrder("index-all.html",
"
M
",
"m()",
"m()",
"m0()",
"m0()",
"m1()",
"m1()",
"m1()",
"m1()",
"m2()",
"m2()",
"m3()",
"m3()",
"m3()",
"m4(String, String)",
"m4(K, V)",
"m5()",
"m6()",
"m6()",
"m7()",
"m7()",
"Returns the enum constant of this type with the specified name.",
"Returns an array containing the constants of this enum type, in\n" +
"the order they are declared."
);
}
}