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

net.thucydides.core.matchers.BeanMatchers Maven / Gradle / Ivy

There is a newer version: 4.1.20
Show newest version
package net.thucydides.core.matchers;

import org.hamcrest.Matcher;

import java.math.BigDecimal;

public class BeanMatchers {

    public static BeanMatcher the(final String fieldName, final Matcher matcher) {
        return new BeanPropertyMatcher(fieldName, matcher);
    }

    public static BeanMatcher the_count(Matcher countMatcher) {
        return new BeanCountMatcher(countMatcher);
    }

    public static BeanConstraint each(final String fieldName) {
        return new BeanConstraint(fieldName);
    }

    public static BeanMatcher max(String fieldName, Matcher valueMatcher) {
        return new MaxFieldValueMatcher(fieldName, valueMatcher);
    }

    public static BeanMatcher min(String fieldName, Matcher valueMatcher) {
        return new MinFieldValueMatcher(fieldName, valueMatcher);
    }

    public static SimpleValueMatcher checkThat(final String value, final Matcher matcher) {
        return new SimpleValueMatcher(value, matcher);
    }

    public static SimpleValueMatcher checkThat(final Boolean value, final Matcher matcher) {
        return new SimpleValueMatcher(value, matcher);
    }

    public static BigDecimalValueMatcher checkThat(final BigDecimal value, final Matcher matcher) {
        return new BigDecimalValueMatcher(value, matcher);
    }

    public static class BeanConstraint {
        private final String fieldName;

        public BeanConstraint(String fieldName) {
            this.fieldName = fieldName;
        }
        
        public BeanMatcher isDifferent() {
            return new BeanUniquenessMatcher(fieldName);
        }
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy