@@ -0,0 +1,1695 @@
+package com.github.mproberts.rxtools.types;%0A%0Aimport io.reactivex.functions.Function;%0Aimport org.junit.Test;%0A%0Aimport static org.junit.Assert.*;%0A%0Apublic class OptionalTest%0A%7B%0A    @Test%0A    public void testPresentValue()%0A    %7B%0A        Optional%3CString%3E emptyOptional = Optional.ofNullable(null);%0A        Optional%3CString%3E fullOptional = Optional.of(%22test%22);%0A        Optional%3CString%3E altFullOptional = Optional.ofNullable(%22test2%22);%0A%0A        assertFalse(Optional.empty().isPresent());%0A        assertFalse(emptyOptional.isPresent());%0A%0A        assertTrue(fullOptional.isPresent());%0A        assertTrue(altFullOptional.isPresent());%0A    %7D%0A%0A    @Test%0A    public void testOrElse()%0A    %7B%0A        Optional%3CString%3E emptyOptional = Optional.ofNullable(null);%0A        Optional%3CString%3E stringOptional = Optional.of(%22test%22);%0A%0A        assertEquals(%22foo%22, emptyOptional.orElse(%22foo%22));%0A        assertEquals(%22test%22, stringOptional.orElse(%22foo%22));%0A    %7D%0A%0A    @Test%0A    public void testMap()%0A    %7B%0A        Optional%3CInteger%3E intOptional = Optional.of(2);%0A%0A        assertEquals(%226%22, intOptional.map(new Function%3CInteger, String%3E() %7B%0A            @Override%0A            public String apply(Integer integer) throws Exception %7B%0A                return integer * 3 + %22%22;%0A            %7D%0A        %7D).get());%0A    %7D%0A%0A    @Test(expected = RuntimeException.class)%0A    public void testMapException()%0A    %7B%0A        Optional%3CInteger%3E intOptional = Optional.of(2);%0A%0A        assertEquals(%226%22, intOptional.map(new Function%3CInteger, String%3E() %7B%0A            @Override%0A            public String apply(Integer integer) throws Exception %7B%0A                throw new IllegalStateException(%22Well that was expected%22);%0A            %7D%0A        %7D));%0A    %7D%0A%7D%0A

Add test coverage for Optional