test/jdk/java/util/Optional/BasicInt.java
branchJDK-8195649-branch
changeset 56375 e0530ee8af48
parent 48328 7acf5700d542
child 56376 718b9df3e302
equal deleted inserted replaced
56364:ed0bfd119607 56375:e0530ee8af48
     1 /*
     1 /*
     2  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2013, 2018, 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.
    22  */
    22  */
    23 
    23 
    24 /* @test
    24 /* @test
    25  * @summary Basic functional test of OptionalInt
    25  * @summary Basic functional test of OptionalInt
    26  * @author Mike Duigou
    26  * @author Mike Duigou
       
    27  * @build ObscureException
    27  * @run testng BasicInt
    28  * @run testng BasicInt
    28  */
    29  */
    29 
    30 
    30 import java.util.NoSuchElementException;
    31 import java.util.NoSuchElementException;
    31 import java.util.OptionalInt;
    32 import java.util.OptionalInt;
   199             int[] es = OptionalInt.of(42).stream().toArray();
   200             int[] es = OptionalInt.of(42).stream().toArray();
   200             assertEquals(es.length, 1);
   201             assertEquals(es.length, 1);
   201             assertEquals(es[0], 42);
   202             assertEquals(es[0], 42);
   202         }
   203         }
   203     }
   204     }
   204 
       
   205     private static class ObscureException extends RuntimeException {
       
   206 
       
   207     }
       
   208 }
   205 }