User user = new User(“anna@gmail.com”, “1234”);
user.setPosition(“Developer”);
String position = Optional.ofNullable(user)
.flatMap(u -> u.getPosition()).orElse(“default”);assertEquals(position, user.getPosition().get());