langtools/test/tools/javac/MissingInclude/MissingIncludeTest.java
changeset 26100 bb7dd001d190
parent 16304 475504933a2d
child 30730 d3ce7619db2c
equal deleted inserted replaced
26099:c425126bfadf 26100:bb7dd001d190
     1 /*
     1 /*
     2  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 4509051 4785453
    26  * @bug 4509051 4785453
    27  * @summary javac <AT>sourcefiles should catch Exception, when sourcefiles
    27  * @summary javac <AT>sourcefiles should catch Exception, when sourcefiles
    28  * doesn't exist.
    28  * doesn't exist.
    29  * @library /tools/javac/lib
    29  * @library /tools/lib
    30  * @build ToolBox
    30  * @build ToolBox
    31  * @run main MissingIncludeTest
    31  * @run main MissingIncludeTest
    32  */
    32  */
    33 
    33 
    34 //original test: test/tools/javac/MissingInclude.sh
    34 // Original test: test/tools/javac/MissingInclude.sh
    35 public class MissingIncludeTest {
    35 public class MissingIncludeTest {
    36 
    36 
    37     private static final String MissingIncludeSrc =
    37     private static final String MissingIncludeFile = "MissingInclude.java";
    38         "class MissingInclude {}";
    38     private static final String MissingIncludeSrc = "class MissingInclude {}";
    39 
    39 
    40     public static void main(String[] args) throws Exception {
    40     public static void main(String[] args) throws Exception {
    41         ToolBox.createJavaFileFromSource(MissingIncludeSrc);
    41         ToolBox tb = new ToolBox();
    42 
    42 
    43 //        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} @/nonexistent_file MissingInclude.java 2> ${TMP1}
    43         tb.writeFile(MissingIncludeFile, MissingIncludeSrc);
    44         ToolBox.JavaToolArgs params =
    44 
    45                 new ToolBox.JavaToolArgs(ToolBox.Expect.FAIL)
    45         tb.new JavacTask(ToolBox.Mode.CMDLINE)
    46                 .setAllArgs("@/nonexistent_file", "MissingInclude.java");
    46                 .options("@/nonexistent_file")
    47         ToolBox.javac(params);
    47                 .files(MissingIncludeFile)
       
    48                 .run(ToolBox.Expect.FAIL);
    48     }
    49     }
    49 
    50 
    50 }
    51 }