/** * Adds the template object to the array * @param template template object */ public PactDslJsonArray template(DslPart template) { putObject(template); return this; }
/** * Adds the template object to the array * @param template template object */ public PactDslJsonArray template(DslPart template) { putObject(template); return this; }
/** * Root level array with maximum size where each item must match the provided matcher * @param maxSize maximum size * @param numberExamples Number of examples to generate */ public static PactDslJsonArray arrayMaxLike(int maxSize, int numberExamples, PactDslJsonRootValue value) { if (numberExamples > maxSize) { throw new IllegalArgumentException(String.format("Number of example %d is more than the maximum size of %d", numberExamples, maxSize)); } PactDslJsonArray parent = new PactDslJsonArray("", "", null, true); parent.setNumberExamples(numberExamples); parent.matchers.addRule("", parent.matchMax(maxSize)); parent.putObject(value); return parent; }
/** * Root level array with maximum size where each item must match the provided matcher * @param maxSize maximum size * @param numberExamples Number of examples to generate */ public static PactDslJsonArray arrayMaxLike(int maxSize, int numberExamples, PactDslJsonRootValue value) { if (numberExamples > maxSize) { throw new IllegalArgumentException(String.format("Number of example %d is more than the maximum size of %d", numberExamples, maxSize)); } PactDslJsonArray parent = new PactDslJsonArray("", "", null, true); parent.setNumberExamples(numberExamples); parent.matchers.addRule("", parent.matchMax(maxSize)); parent.putObject(value); return parent; }
/** * Root level array with minimum size where each item must match the provided matcher * @param minSize minimum size * @param numberExamples Number of examples to generate */ public static PactDslJsonArray arrayMinLike(int minSize, int numberExamples, PactDslJsonRootValue value) { if (numberExamples < minSize) { throw new IllegalArgumentException(String.format("Number of example %d is less than the minimum size of %d", numberExamples, minSize)); } PactDslJsonArray parent = new PactDslJsonArray("", "", null, true); parent.setNumberExamples(numberExamples); parent.matchers.addRule("", parent.matchMin(minSize)); parent.putObject(value); return parent; }
/** * Root level array with minimum size where each item must match the provided matcher * @param minSize minimum size * @param numberExamples Number of examples to generate */ public static PactDslJsonArray arrayMinLike(int minSize, int numberExamples, PactDslJsonRootValue value) { if (numberExamples < minSize) { throw new IllegalArgumentException(String.format("Number of example %d is less than the minimum size of %d", numberExamples, minSize)); } PactDslJsonArray parent = new PactDslJsonArray("", "", null, true); parent.setNumberExamples(numberExamples); parent.matchers.addRule("", parent.matchMin(minSize)); parent.putObject(value); return 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; }
/** * 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 of values with a minimum size that are not objects where each item must match the provided example * @param size minimum size of the array * @param value Value to use to match each item * @param numberExamples number of examples to generate */ public PactDslJsonArray minArrayLike(Integer size, PactDslJsonRootValue value, int numberExamples) { 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); parent.putObject(value); return (PactDslJsonArray) parent.closeArray(); }
/** * Array of values with a minimum size that are not objects where each item must match the provided example * @param size minimum size of the array * @param value Value to use to match each item * @param numberExamples number of examples to generate */ public PactDslJsonArray minArrayLike(Integer size, PactDslJsonRootValue value, int numberExamples) { 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); parent.putObject(value); return (PactDslJsonArray) parent.closeArray(); }
/** * Array of values with a maximum size that are not objects where each item must match the provided example * @param size maximum size of the array * @param value Value to use to match each item * @param numberExamples number of examples to generate */ public PactDslJsonArray maxArrayLike(Integer size, PactDslJsonRootValue value, int numberExamples) { 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); parent.putObject(value); return (PactDslJsonArray) parent.closeArray(); }
/** * Array of values with a maximum size that are not objects where each item must match the provided example * @param size maximum size of the array * @param value Value to use to match each item * @param numberExamples number of examples to generate */ public PactDslJsonArray maxArrayLike(Integer size, PactDslJsonRootValue value, int numberExamples) { 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); parent.putObject(value); return (PactDslJsonArray) parent.closeArray(); }
/** * Attribute that is an array of values with a minimum size that are not objects where each item must match the following example * @param name field name * @param size minimum size of the array * @param value Value to use to match each item * @param numberExamples number of examples to generate */ public PactDslJsonBody minArrayLike(String name, Integer size, PactDslJsonRootValue value, int numberExamples) { 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), "", this, true); parent.setNumberExamples(numberExamples); parent.putObject(value); return (PactDslJsonBody) parent.closeArray(); }
/** * Attribute that is an array of values with a minimum size that are not objects where each item must match the following example * @param name field name * @param size minimum size of the array * @param value Value to use to match each item * @param numberExamples number of examples to generate */ public PactDslJsonBody minArrayLike(String name, Integer size, PactDslJsonRootValue value, int numberExamples) { 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), "", this, true); parent.setNumberExamples(numberExamples); parent.putObject(value); return (PactDslJsonBody) parent.closeArray(); }
/** * Attribute that is an array of values with a maximum size that are not objects where each item must match the following example * @param name field name * @param size maximum size of the array * @param value Value to use to match each item * @param numberExamples number of examples to generate */ public PactDslJsonBody maxArrayLike(String name, Integer size, PactDslJsonRootValue value, int numberExamples) { 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), "", this, true); parent.setNumberExamples(numberExamples); parent.putObject(value); return (PactDslJsonBody) parent.closeArray(); }
/** * Array of values that are not objects where each item must match the provided example * @param value Value to use to match each item * @param numberExamples number of examples to generate */ public PactDslJsonArray eachLike(PactDslJsonRootValue value, int numberExamples) { if (numberExamples == 0) { throw new IllegalArgumentException("Testing Zero examples is unsafe. Please make sure to provide at least one " + "example in the Pact provider implementation. See https://github.com/DiUS/pact-jvm/issues/546"); } matchers.addRule(rootPath + appendArrayIndex(1), matchMin(0)); PactDslJsonArray parent = new PactDslJsonArray(rootPath, "", this, true); parent.setNumberExamples(numberExamples); parent.putObject(value); return (PactDslJsonArray) parent.closeArray(); }
/** * Array of values that are not objects where each item must match the provided example * @param value Value to use to match each item * @param numberExamples number of examples to generate */ public PactDslJsonArray eachLike(PactDslJsonRootValue value, int numberExamples) { if (numberExamples == 0) { throw new IllegalArgumentException("Testing Zero examples is unsafe. Please make sure to provide at least one " + "example in the Pact provider implementation. See https://github.com/DiUS/pact-jvm/issues/546"); } matchers.addRule(rootPath + appendArrayIndex(1), matchMin(0)); PactDslJsonArray parent = new PactDslJsonArray(rootPath, "", this, true); parent.setNumberExamples(numberExamples); parent.putObject(value); return (PactDslJsonArray) parent.closeArray(); }
/** * Attribute that is an array of values with a maximum size that are not objects where each item must match the following example * @param name field name * @param size maximum size of the array * @param value Value to use to match each item * @param numberExamples number of examples to generate */ public PactDslJsonBody maxArrayLike(String name, Integer size, PactDslJsonRootValue value, int numberExamples) { 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), "", this, true); parent.setNumberExamples(numberExamples); parent.putObject(value); return (PactDslJsonBody) parent.closeArray(); }
/** * Attribute that is an array of values that are not objects where each item must match the following example * @param name field name * @param value Value to use to match each item * @param numberExamples number of examples to generate */ public PactDslJsonBody eachLike(String name, PactDslJsonRootValue value, int numberExamples) { matchers.addRule(matcherKey(name), matchMin(0)); PactDslJsonArray parent = new PactDslJsonArray(matcherKey(name), "", this, true); parent.setNumberExamples(numberExamples); parent.putObject(value); return (PactDslJsonBody) parent.closeArray(); }
/** * Attribute that is an array of values that are not objects where each item must match the following example * @param name field name * @param value Value to use to match each item * @param numberExamples number of examples to generate */ public PactDslJsonBody eachLike(String name, PactDslJsonRootValue value, int numberExamples) { matchers.addRule(matcherKey(name), matchMin(0)); PactDslJsonArray parent = new PactDslJsonArray(matcherKey(name), "", this, true); parent.setNumberExamples(numberExamples); parent.putObject(value); return (PactDslJsonBody) parent.closeArray(); }