org.exparity.hamcrest.beans.comparators.Matches Maven / Gradle / Ivy
package org.exparity.hamcrest.beans.comparators;
import org.exparity.hamcrest.beans.TheSameAs.PropertyComparator;
import org.hamcrest.Matcher;
/**
* Implementation of a PropertyComparator which uses a hamcrest Matcher to test each value
*
* @author Stewart Bissett
*/
public class Matches implements PropertyComparator {
private final Matcher matcher;
public Matches(final Matcher matcher) {
this.matcher = matcher;
}
@Override
public boolean matches(final T lhs, final T rhs) {
return matcher.matches(lhs) && matcher.matches(rhs);
}
}