有没有用于java.util.Optional的Hamcrest Matcher?
2022-09-02 04:04:07
我正在寻找一个Hamcrest Matcher来单元测试方法,返回java.util.Optional类型。像这样:
@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())));
}
是否有任何可用的实现抛出 Maven 存储库?