@@ -0,0 +1,1230 @@
+package de.retest.recheck.util;%0A%0Aimport static org.assertj.core.api.Assertions.assertThat;%0A%0Aimport java.util.Optional;%0Aimport java.util.function.Supplier;%0A%0Aimport org.junit.jupiter.api.Test;%0A%0Aclass OptionalUtilTest %7B%0A%0A%09@Test%0A%09void stream_should_contain_value_if_present() %7B%0A%09%09final Object obj = new Object();%0A%09%09final Optional%3CObject%3E present = Optional.of( obj );%0A%09%09assertThat( OptionalUtil.stream( present ) ).containsExactly( obj );%0A%09%7D%0A%0A%09@Test%0A%09void stream_should_be_empty_if_absent() throws Exception %7B%0A%09%09final Optional%3CObject%3E absent = Optional.empty();%0A%09%09assertThat( OptionalUtil.stream( absent ) ).isEmpty();%0A%09%7D%0A%0A%09@Test%0A%09void or_should_return_given_optional_if_present() throws Exception %7B%0A%09%09final Optional%3CObject%3E opt = Optional.of( new Object() );%0A%09%09final Supplier%3COptional%3CObject%3E%3E supplier = () -%3E Optional.empty();%0A%09%09assertThat( OptionalUtil.or%E2%80%8B( opt, supplier ) ).isEqualTo( opt );%0A%09%7D%0A%0A%09@Test%0A%09void or_should_return_use_supplier_if_absent() throws Exception %7B%0A%09%09final Optional%3CObject%3E absent = Optional.empty();%0A%09%09final Optional%3CObject%3E present = Optional.of( new Object() );%0A%09%09final Supplier%3COptional%3CObject%3E%3E supplier = () -%3E present;%0A%09%09assertThat( OptionalUtil.or%E2%80%8B( absent, supplier ) ).isEqualTo( present );%0A%09%7D%0A%0A%7D%0A

Add tests