Search in sources :

Example 1 with MinMaxTypeMatcher

use of au.com.dius.pact.core.model.matchingrules.MinMaxTypeMatcher in project pact-jvm by DiUS.

the class LambdaDsl method newJsonArrayMinMaxLike.

/**
 * DSL function to simplify creating a {@link DslPart} generated from a {@link LambdaDslJsonArray} where a minimum and maximum base array size is specified
 */
public static LambdaDslJsonArray newJsonArrayMinMaxLike(Integer minSize, Integer maxSize, Consumer<LambdaDslJsonArray> array) {
    final PactDslJsonArray pactDslJsonArray = new PactDslJsonArray("", "", null, true);
    pactDslJsonArray.setNumberExamples(minSize);
    pactDslJsonArray.getMatchers().addRule(new MinMaxTypeMatcher(minSize, maxSize));
    final LambdaDslJsonArray dslArray = new LambdaDslJsonArray(pactDslJsonArray);
    array.accept(dslArray);
    return dslArray;
}
Also used : MinMaxTypeMatcher(au.com.dius.pact.core.model.matchingrules.MinMaxTypeMatcher)

Aggregations

MinMaxTypeMatcher (au.com.dius.pact.core.model.matchingrules.MinMaxTypeMatcher)1