restore Optional.or tests; add asserts for Optional.toString JDK-8195649-branch
authorsmarks
Wed, 28 Mar 2018 15:24:53 -0700
branchJDK-8195649-branch
changeset 56360 44f4a81c3b96
parent 56359 6d9744c78001
child 56364 ed0bfd119607
restore Optional.or tests; add asserts for Optional.toString
test/jdk/java/util/Optional/Basic.java
--- a/test/jdk/java/util/Optional/Basic.java	Wed Mar 28 11:06:28 2018 -0700
+++ b/test/jdk/java/util/Optional/Basic.java	Wed Mar 28 15:24:53 2018 -0700
@@ -82,6 +82,8 @@
         empty.ifPresentOrElse(s -> b1.set(true), () -> b2.set(true));
         assertFalse(b1.get());
         assertTrue(b2.get());
+
+        assertEquals(empty.toString(), "Optional.empty");
     }
 
     /**
@@ -113,6 +115,8 @@
         opt.ifPresentOrElse(s -> b1.set(true), () -> b2.set(true));
         assertTrue(b1.get());
         assertFalse(b2.get());
+
+        assertEquals(opt.toString(), "Optional[" + expected + "]");
     }
 
     @Test
@@ -183,7 +187,6 @@
                      "plugh");
     }
 
-/*
     @Test
     public void testOrEmptyEmpty() {
         checkEmpty(Optional.<String>empty().or(() -> Optional.empty()));
@@ -198,7 +201,6 @@
     public void testOrPresentDontCare() {
         checkPresent(Optional.of("xyzzy").or(() -> { fail(); return Optional.of("plugh"); }), "xyzzy");
     }
-*/
 
     @Test
     public void testStreamEmpty() {