/** * Element that is a JSON array */ public PactDslJsonArray array() { return new PactDslJsonArray("", "", this); }
/** * Element that is a JSON array */ public PactDslJsonArray array() { return new PactDslJsonArray("", "", this); }
/** * Attribute that is an array * @param name field name */ public PactDslJsonArray array(String name) { return new PactDslJsonArray(matcherKey(name), name, this); }
/** * Attribute that is an array * @param name field name */ public PactDslJsonArray array(String name) { return new PactDslJsonArray(matcherKey(name), name, this); }
@Override public PactDslJsonArray eachArrayWithMaxLike(int numberExamples, Integer size) { if (numberExamples > size) { throw new IllegalArgumentException(String.format("Number of example %d is more than the maximum size of %d", numberExamples, size)); } matchers.addRule(rootPath + appendArrayIndex(1), matchMax(size)); PactDslJsonArray parent = new PactDslJsonArray(rootPath, "", this, true); parent.setNumberExamples(numberExamples); return new PactDslJsonArray("", "", parent); }
@Override public PactDslJsonArray eachArrayWithMinLike(int numberExamples, Integer size) { if (numberExamples < size) { throw new IllegalArgumentException(String.format("Number of example %d is less than the minimum size of %d", numberExamples, size)); } matchers.addRule(rootPath + appendArrayIndex(1), matchMin(size)); PactDslJsonArray parent = new PactDslJsonArray(rootPath, "", this, true); parent.setNumberExamples(numberExamples); return new PactDslJsonArray("", "", parent); }
@Override public PactDslJsonArray eachArrayWithMaxLike(String name, int numberExamples, Integer size) { if (numberExamples > size) { throw new IllegalArgumentException(String.format("Number of example %d is more than the maximum size of %d", numberExamples, size)); } matchers.addRule(matcherKey(name), matchMax(size)); PactDslJsonArray parent = new PactDslJsonArray(matcherKey(name), name, this, true); parent.setNumberExamples(numberExamples); return new PactDslJsonArray("", "", parent); }
@Override public PactDslJsonArray eachArrayWithMinLike(String name, int numberExamples, Integer size) { if (numberExamples < size) { throw new IllegalArgumentException(String.format("Number of example %d is less than the minimum size of %d", numberExamples, size)); } matchers.addRule(matcherKey(name), matchMin(size)); PactDslJsonArray parent = new PactDslJsonArray(matcherKey(name), name, this, true); parent.setNumberExamples(numberExamples); return new PactDslJsonArray("", "", parent); }
@Override public PactDslJsonArray eachArrayLike(String name, int numberExamples) { matchers.addRule(matcherKey(name), matchMin(0)); PactDslJsonArray parent = new PactDslJsonArray(matcherKey(name), name, this, true); parent.setNumberExamples(numberExamples); return new PactDslJsonArray("", "", parent); }
@Override public PactDslJsonArray eachArrayWithMinMaxLike(String name, int numberExamples, Integer minSize, Integer maxSize) { validateMinAndMaxAndExamples(minSize, maxSize, numberExamples); matchers.addRule(matcherKey(name), matchMinMax(minSize, maxSize)); PactDslJsonArray parent = new PactDslJsonArray(matcherKey(name), name, this, true); parent.setNumberExamples(numberExamples); return new PactDslJsonArray("", "", parent); }
@Override public PactDslJsonArray eachArrayWithMinMaxLike(String name, int numberExamples, Integer minSize, Integer maxSize) { validateMinAndMaxAndExamples(minSize, maxSize, numberExamples); matchers.addRule(matcherKey(name), matchMinMax(minSize, maxSize)); PactDslJsonArray parent = new PactDslJsonArray(matcherKey(name), name, this, true); parent.setNumberExamples(numberExamples); return new PactDslJsonArray("", "", parent); }
public static LambdaDslJsonArray newJsonArrayMinLike(Integer size, Consumer<LambdaDslJsonArray> array) { final PactDslJsonArray pactDslJsonArray = new PactDslJsonArray("", "", null, true); pactDslJsonArray.setNumberExamples(size); pactDslJsonArray.getMatchers().addRule(new MinTypeMatcher(size)); final LambdaDslJsonArray dslArray = new LambdaDslJsonArray(pactDslJsonArray); array.accept(dslArray); return dslArray; }
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; }
/** * Array where each item must match the following example * @param numberExamples Number of examples to generate */ public static PactDslJsonBody arrayEachLike(Integer numberExamples) { PactDslJsonArray parent = new PactDslJsonArray("", "", null, true); parent.setNumberExamples(numberExamples); parent.matchers.addRule("", parent.matchMin(0)); return new PactDslJsonBody(".", "", parent); }
/** * Root level array where each item must match the provided matcher * @param numberExamples Number of examples to generate */ public static PactDslJsonArray arrayEachLike(Integer numberExamples, PactDslJsonRootValue value) { PactDslJsonArray parent = new PactDslJsonArray("", "", null, true); parent.setNumberExamples(numberExamples); parent.matchers.addRule("", parent.matchMin(0)); parent.putObject(value); return parent; }
/** * Array where each item must match the following example * @param numberExamples Number of examples to generate */ public static PactDslJsonBody arrayEachLike(Integer numberExamples) { PactDslJsonArray parent = new PactDslJsonArray("", "", null, true); parent.setNumberExamples(numberExamples); parent.matchers.addRule("", parent.matchMin(0)); return new PactDslJsonBody(".", "", parent); }
/** * Element that is an array where each item must match the following example * @param numberExamples Number of examples to generate */ @Override public PactDslJsonBody eachLike(int numberExamples) { matchers.addRule(rootPath + appendArrayIndex(1), matchMin(0)); PactDslJsonArray parent = new PactDslJsonArray(rootPath, "", this, true); parent.setNumberExamples(numberExamples); return new PactDslJsonBody(".", "", parent); }
/** * Attribute that is an array where each item must match the following example * @param name field name * @param numberExamples number of examples to generate */ @Override public PactDslJsonBody eachLike(String name, int numberExamples) { matchers.addRule(matcherKey(name), matchMin(0)); PactDslJsonArray parent = new PactDslJsonArray(matcherKey(name), "", this, true); parent.setNumberExamples(numberExamples); return new PactDslJsonBody(".", ".", parent); }
@Override public PactDslJsonBody minMaxArrayLike(String name, Integer minSize, Integer maxSize, int numberExamples) { validateMinAndMaxAndExamples(minSize, maxSize, numberExamples); matchers.addRule(matcherKey(name), matchMinMax(minSize, maxSize)); PactDslJsonArray parent = new PactDslJsonArray(matcherKey(name), "", this, true); parent.setNumberExamples(numberExamples); return new PactDslJsonBody(".", "", parent); }
@Override public PactDslJsonBody minMaxArrayLike(String name, Integer minSize, Integer maxSize, int numberExamples) { validateMinAndMaxAndExamples(minSize, maxSize, numberExamples); matchers.addRule(matcherKey(name), matchMinMax(minSize, maxSize)); PactDslJsonArray parent = new PactDslJsonArray(matcherKey(name), "", this, true); parent.setNumberExamples(numberExamples); return new PactDslJsonBody(".", "", parent); }