@Test public void givenNull_whenCreatesNullable_thenCorrect() { String name = null; Optional<String> opt = Optional.ofNullable(name); assertFalse(opt.isPresent()); }
String o = getOptional().orElse(null); if (o == null) { return; }