I am looking for a Hamcrest Matcher to unit test methods that return a java.util.Optional type. Something like:
@Test
public void get__Null(){
Optional<Element> element = Element.get(null);
assertThat( sasi , isEmptyOptional());
}
@Test
public void get__GetCode(){
Optional<Element> element = Element.get(MI_CODE);
assertThat( sasi , isOptionalThatMatches(allOf(hasproperty("code", MI_CODE),
hasProperty("id", notNullValue())));
}
Is there any implementation available throw the Maven Repository?
equalTo(...)
? – Sherris