langtools/test/tools/javac/api/6421756/T6421756.java
changeset 27321 c8eceba990bf
parent 17556 eced45696767
child 30730 d3ce7619db2c
equal deleted inserted replaced
27320:f0739350a62d 27321:c8eceba990bf
     1 /*
     1 /*
     2  * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2006, 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.
    30  * @build ToolTester
    30  * @build ToolTester
    31  * @compile T6421756.java
    31  * @compile T6421756.java
    32  * @run main T6421756
    32  * @run main T6421756
    33  */
    33  */
    34 
    34 
       
    35 import java.io.IOException;
    35 import java.util.Collections;
    36 import java.util.Collections;
    36 
    37 
    37 public class T6421756 extends ToolTester {
    38 public class T6421756 extends ToolTester {
    38     void test(String... args) {
    39     void test(String... args) {
    39         Iterable<String> options = Collections.singleton("-verbose");
    40         Iterable<String> options = Collections.singleton("-verbose");
    42             throw new AssertionError("Expected IllegalArgumentException!");
    43             throw new AssertionError("Expected IllegalArgumentException!");
    43         } catch (IllegalArgumentException e) {
    44         } catch (IllegalArgumentException e) {
    44             System.out.println("OK: got expected error " + e.getLocalizedMessage());
    45             System.out.println("OK: got expected error " + e.getLocalizedMessage());
    45         }
    46         }
    46     }
    47     }
    47     public static void main(String... args) {
    48     public static void main(String... args) throws IOException {
    48         new T6421756().test(args);
    49         try (T6421756 t = new T6421756()) {
       
    50             t.test(args);
       
    51         }
    49     }
    52     }
    50 }
    53 }