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

com.vtence.molecule.lib.matchers.AllOf Maven / Gradle / Ivy

There is a newer version: 0.15.0
Show newest version
package com.vtence.molecule.lib.matchers;

import java.util.Arrays;

public class AllOf implements Matcher {

    private final Iterable> matchers;

    public AllOf(Iterable> matchers) {
        this.matchers = matchers;
    }

    public boolean matches(T actual) {
        for (Matcher matcher : matchers) {
            if (!matcher.matches(actual)) return false;
        }

        return true;
    }

    @SuppressWarnings("unchecked")
    public static  Matcher allOf(Matcher... matchers) {
        return new AllOf<>(Arrays.asList(matchers));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy