All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.olib963.javatest.matchers.OptionalMatchers Maven / Gradle / Ivy

There is a newer version: 0.2.0
Show newest version
package io.github.olib963.javatest.matchers;

import io.github.olib963.javatest.matchers.internal.OptionalMatcher;
import io.github.olib963.javatest.matchers.internal.PredicateMatcher;

import java.util.Optional;

public class OptionalMatchers {

    private OptionalMatchers() {}

    public static  Matcher> isEmptyOptional() {
        return PredicateMatcher.of(Optional::isEmpty, "be an empty Optional");
    }

    public static  Matcher> isOptionalOf(T value) {
        return isOptionalThat(PredicateMatcher.isEqualTo(value));
    }

    public static  Matcher> isOptionalThat(Matcher matcher) {
        return new OptionalMatcher<>(matcher);
    }

}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy