/** * Array with a maximum size where each item must match the following example * @param maxSize maximum size * @param numberExamples Number of examples to generate */ public static PactDslJsonBody arrayMaxLike(int maxSize, int numberExamples) { 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)); return new PactDslJsonBody(".", "", parent); }
/** * Array with a maximum size where each item must match the following example * @param maxSize maximum size * @param numberExamples Number of examples to generate */ public static PactDslJsonBody arrayMaxLike(int maxSize, int numberExamples) { 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)); return new PactDslJsonBody(".", "", 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 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; }
@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 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); }
/** * Element that is an array with a maximum size where each item must match the following example * @param size maximum size of the array * @param numberExamples number of examples to generate */ @Override public PactDslJsonBody maxArrayLike(Integer size, 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("", "", this, true); parent.setNumberExamples(numberExamples); return new PactDslJsonBody(".", "", parent); }
/** * Element that is an array with a maximum size where each item must match the following example * @param size maximum size of the array * @param numberExamples number of examples to generate */ @Override public PactDslJsonBody maxArrayLike(Integer size, 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("", "", this, true); parent.setNumberExamples(numberExamples); return new PactDslJsonBody(".", "", parent); }
/** * 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(); }