31 * @run main TestPackageDeprecation |
31 * @run main TestPackageDeprecation |
32 */ |
32 */ |
33 |
33 |
34 public class TestPackageDeprecation extends JavadocTester { |
34 public class TestPackageDeprecation extends JavadocTester { |
35 |
35 |
36 //Javadoc arguments. |
36 public static void main(String... args) throws Exception { |
37 private static final String[] ARGS1 = new String[]{ |
37 TestPackageDeprecation tester = new TestPackageDeprecation(); |
38 "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "-use", "pkg", "pkg1", |
38 tester.runTests(); |
39 SRC_DIR + "/C2.java", SRC_DIR + "/FooDepr.java" |
39 } |
40 }; |
|
41 private static final String[] ARGS2 = new String[]{ |
|
42 "-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR, "-use", "-nodeprecated", |
|
43 "pkg", "pkg1", SRC_DIR + "/C2.java", SRC_DIR + "/FooDepr.java" |
|
44 }; |
|
45 |
40 |
46 //Input for string search tests. |
41 @Test |
47 private static final String[][] TEST1 = { |
42 void testDefault() { |
48 { "pkg1/package-summary.html", |
43 javadoc("-d", "out-default", |
|
44 "-sourcepath", testSrc, |
|
45 "-use", |
|
46 "pkg", "pkg1", testSrc("C2.java"), testSrc("FooDepr.java")); |
|
47 checkExit(Exit.OK); |
|
48 |
|
49 checkOutput("pkg1/package-summary.html", true, |
49 "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span>\n" + |
50 "<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span>\n" + |
50 "<div class=\"block\"><span class=\"deprecationComment\">This package is Deprecated." + |
51 "<div class=\"block\"><span class=\"deprecationComment\">This package is Deprecated." + |
51 "</span></div>" |
52 "</span></div>" |
52 }, |
53 ); |
53 { "deprecated-list.html", |
54 |
|
55 checkOutput("deprecated-list.html", true, |
54 "<li><a href=\"#package\">Deprecated Packages</a></li>" |
56 "<li><a href=\"#package\">Deprecated Packages</a></li>" |
55 } |
57 ); |
56 }; |
58 } |
57 private static final String[][] NEGATED_TEST2 = { |
|
58 { "overview-summary.html", "pkg1"}, |
|
59 { "allclasses-frame.html", "FooDepr"} |
|
60 }; |
|
61 |
59 |
62 /** |
60 @Test |
63 * The entry point of the test. |
61 void testNoDeprecated() { |
64 * @param args the array of command line arguments. |
62 javadoc("-d", "out-nodepr", |
65 */ |
63 "-sourcepath", testSrc, |
66 public static void main(String[] args) { |
64 "-use", |
67 TestPackageDeprecation tester = new TestPackageDeprecation(); |
65 "-nodeprecated", |
68 tester.run(ARGS1, TEST1, NO_TEST); |
66 "pkg", "pkg1", testSrc("C2.java"), testSrc("FooDepr.java")); |
69 tester.run(ARGS2, NO_TEST, NEGATED_TEST2); |
67 checkExit(Exit.OK); |
70 if ((new java.io.File(OUTPUT_DIR + "-2/pkg1/" + |
68 |
71 "package-summary.html")).exists()) { |
69 checkOutput("overview-summary.html", false, |
72 throw new Error("Test Fails: packages summary should not be" + |
70 "pkg1"); |
73 "generated for deprecated package."); |
71 checkOutput("allclasses-frame.html", false, |
74 } else { |
72 "FooDepr"); |
75 System.out.println("Test passes: package-summary.html not found."); |
73 |
76 } |
74 checkFiles(false, |
77 if ((new java.io.File(OUTPUT_DIR + "-2/FooDepr.html")).exists()) { |
75 "pkg1/package-summary.html", |
78 throw new Error("Test Fails: FooDepr should not be" + |
76 "FooDepr.html"); |
79 "generated as it is deprecated."); |
|
80 } else { |
|
81 System.out.println("Test passes: FooDepr.html not found."); |
|
82 } |
|
83 tester.printSummary(); |
|
84 } |
77 } |
85 } |
78 } |