langtools/test/com/sun/javadoc/testGroupOption/TestGroupOption.java
changeset 24399 af1a0220d0fa
parent 24217 25b12d4d4192
child 30730 d3ce7619db2c
equal deleted inserted replaced
24398:601a611d0aee 24399:af1a0220d0fa
    25  * @test
    25  * @test
    26  * @bug      4924383
    26  * @bug      4924383
    27  * @summary  Test to make sure the -group option does not cause a bad warning
    27  * @summary  Test to make sure the -group option does not cause a bad warning
    28  *           to be printed.
    28  *           to be printed.
    29  * @author   jamieh
    29  * @author   jamieh
    30  * @library  ../lib/
    30  * @library  ../lib
    31  * @build    JavadocTester
    31  * @build    JavadocTester
    32  * @build    TestGroupOption
       
    33  * @run main TestGroupOption
    32  * @run main TestGroupOption
    34  */
    33  */
    35 
    34 
    36 public class TestGroupOption extends JavadocTester {
    35 public class TestGroupOption extends JavadocTester {
    37 
    36 
    38     //Javadoc arguments.
    37     public static void main(String... args) throws Exception {
    39     private static final String[] ARGS1 = new String[] {
    38         TestGroupOption tester = new TestGroupOption();
    40         "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
    39         tester.runTests();
    41         "-group", "Package One", "pkg1",
    40     }
    42         "-group", "Package Two", "pkg2",
       
    43         "-group", "Package Three", "pkg3",
       
    44         "pkg1", "pkg2", "pkg3"
       
    45     };
       
    46 
    41 
    47     private static final String[] ARGS2 = new String[] {
    42     @Test
    48         "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR,
    43     void test1() {
    49         "-group", "Package One", "pkg1",
    44         //Make sure the warning is not printed when -group is used correctly.
    50         "-group", "Package One", "pkg2",
    45         javadoc("-d", "out-1",
    51         "-group", "Package One", "pkg3",
    46                 "-sourcepath", testSrc,
    52         "pkg1", "pkg2", "pkg3"
    47                 "-group", "Package One", "pkg1",
    53     };
    48                 "-group", "Package Two", "pkg2",
       
    49                 "-group", "Package Three", "pkg3",
       
    50                 "pkg1", "pkg2", "pkg3");
       
    51         checkExit(Exit.OK);
    54 
    52 
    55     //Input for string search tests.
    53         checkOutput(Output.WARNING, false,
    56     private static final String[][] NEGATED_TEST1 = {{WARNING_OUTPUT, "-group"}};
    54                 "-group");
       
    55     }
    57 
    56 
    58     private static final String[][] TEST2 = {{WARNING_OUTPUT, "-group"}};
    57     @Test
       
    58     void test2() {
       
    59         //Make sure the warning is printed when -group is not used correctly.
       
    60         javadoc("-d", "out-2",
       
    61                 "-sourcepath", testSrc,
       
    62                 "-group", "Package One", "pkg1",
       
    63                 "-group", "Package One", "pkg2",
       
    64                 "-group", "Package One", "pkg3",
       
    65                 "pkg1", "pkg2", "pkg3");
       
    66         checkExit(Exit.OK);
    59 
    67 
    60     /**
    68         checkOutput(Output.WARNING, true,
    61      * The entry point of the test.
    69                 "-group");
    62      * @param args the array of command line arguments.
       
    63      */
       
    64     public static void main(String[] args) {
       
    65         //Make sure the warning is not printed when -group is used correctly.
       
    66         TestGroupOption tester = new TestGroupOption();
       
    67         tester.run(ARGS1, NO_TEST, NEGATED_TEST1);
       
    68         tester.printSummary();
       
    69 
    70 
    70         //Make sure the warning is printed when -group is not used correctly.
       
    71         tester = new TestGroupOption();
       
    72         tester.run(ARGS2, TEST2, NO_TEST);
       
    73         tester.printSummary();
       
    74     }
    71     }
    75 }
    72 }