/** * Accepts any key, and each key is mapped to a list of items that must match the following object definition * Note: this needs the Java system property "pact.matching.wildcard" set to value "true" when the pact file is verified. * @param exampleKey Example key to use for generating bodies */ public PactDslJsonBody eachKeyMappedToAnArrayLike(String exampleKey) { if (FeatureToggles.isFeatureSet(Feature.UseMatchValuesMatcher)) { matchers.addRule(rootPath.endsWith(".") ? rootPath.substring(0, rootPath.length() - 1) : rootPath, ValuesMatcher.INSTANCE); } else { matchers.addRule(rootPath + "*", matchMin(0)); } PactDslJsonArray parent = new PactDslJsonArray(rootPath + "*", exampleKey, this, true); return new PactDslJsonBody(".", "", parent); }
/** * Accepts any key, and each key is mapped to a list of items that must match the following object definition * Note: this needs the Java system property "pact.matching.wildcard" set to value "true" when the pact file is verified. * @param exampleKey Example key to use for generating bodies */ public PactDslJsonBody eachKeyMappedToAnArrayLike(String exampleKey) { if (FeatureToggles.isFeatureSet(Feature.UseMatchValuesMatcher)) { matchers.addRule(rootPath.endsWith(".") ? rootPath.substring(0, rootPath.length() - 1) : rootPath, ValuesMatcher.INSTANCE); } else { matchers.addRule(rootPath + "*", matchMin(0)); } PactDslJsonArray parent = new PactDslJsonArray(rootPath + "*", exampleKey, this, true); return new PactDslJsonBody(".", "", 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 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); }
/** * Attribute that is an array with a minimum size where each item must match the following example * @param name field name * @param size minimum size of the array * @param numberExamples number of examples to generate */ @Override public PactDslJsonBody minArrayLike(String name, Integer size, 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); return new PactDslJsonBody(".", "", parent); }
/** * Attribute that is an array with a minimum size where each item must match the following example * @param name field name * @param size minimum size of the array * @param numberExamples number of examples to generate */ @Override public PactDslJsonBody minArrayLike(String name, Integer size, 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); return new PactDslJsonBody(".", "", parent); }
/** * 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 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 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); }
/** * 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 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); }
/** * 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(); }