< prev index next >

test/jdk/tools/launcher/modules/basic/InitErrors.java

Print this page
rev 51638 : [mq]: 8210112


   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  * @library /lib/testlibrary
  27  * @build InitErrors jdk.testlibrary.*
  28  * @run testng InitErrors
  29  * @summary Basic test to ensure that module system initialization errors
  30  *          go the right stream and with the right level of verbosity
  31  */
  32 
  33 
  34 import java.util.Arrays;
  35 import jdk.testlibrary.ProcessTools;
  36 import jdk.testlibrary.OutputAnalyzer;
  37 import org.testng.annotations.Test;
  38 import static org.testng.Assert.*;
  39 
  40 public class InitErrors {
  41 
  42     // the option to cause module initialization to fail
  43     private static final String ADD_UNKNOWN_MODULE = "--add-modules=XXX";
  44 
  45     // the expected error message
  46     private static final String UNKNOWN_MODULE_NOT_FOUND= "Module XXX not found";
  47 
  48     // output expected in the stack trace when using -Xlog:init=debug
  49     private static final String STACK_FRAME = "java.base/java.lang.System.initPhase2";
  50 
  51 
  52     /**
  53      * Default behavior, send error message to stdout
  54      */
  55     @Test
  56     public void testDefaultOutput() throws Exception {




   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  * @library /test/lib
  27  * @build InitErrors
  28  * @run testng InitErrors
  29  * @summary Basic test to ensure that module system initialization errors
  30  *          go the right stream and with the right level of verbosity
  31  */
  32 
  33 
  34 import java.util.Arrays;
  35 import jdk.test.lib.process.ProcessTools;
  36 import jdk.test.lib.process.OutputAnalyzer;
  37 import org.testng.annotations.Test;
  38 import static org.testng.Assert.*;
  39 
  40 public class InitErrors {
  41 
  42     // the option to cause module initialization to fail
  43     private static final String ADD_UNKNOWN_MODULE = "--add-modules=XXX";
  44 
  45     // the expected error message
  46     private static final String UNKNOWN_MODULE_NOT_FOUND= "Module XXX not found";
  47 
  48     // output expected in the stack trace when using -Xlog:init=debug
  49     private static final String STACK_FRAME = "java.base/java.lang.System.initPhase2";
  50 
  51 
  52     /**
  53      * Default behavior, send error message to stdout
  54      */
  55     @Test
  56     public void testDefaultOutput() throws Exception {


< prev index next >