# HG changeset patch # User smarks # Date 1522275893 25200 # Node ID 44f4a81c3b962896b99e29dfe7704706d03aa3c1 # Parent 6d9744c780019a093cc420da614d72099c3bf68f restore Optional.or tests; add asserts for Optional.toString diff -r 6d9744c78001 -r 44f4a81c3b96 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.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() {