/** * Value that must match the given time format * @param format time format to match * @param example example time to use for generated bodies */ public static PactDslJsonRootValue time(String format, Date example) { FastDateFormat instance = FastDateFormat.getInstance(format); PactDslJsonRootValue value = new PactDslJsonRootValue(); value.setValue(instance.format(example)); value.setMatcher(value.matchTime(format)); return value; }
/** * Value that must match the given time format * @param format time format to match * @param example example time to use for generated bodies */ public static PactDslJsonRootValue time(String format, Date example) { FastDateFormat instance = FastDateFormat.getInstance(format); PactDslJsonRootValue value = new PactDslJsonRootValue(); value.setValue(instance.format(example)); value.setMatcher(value.matchTime(format)); return value; }
/** * Value that must match the given time format * @param format time format to match */ public static PactDslJsonRootValue time(String format) { FastDateFormat instance = FastDateFormat.getInstance(format); PactDslJsonRootValue value = new PactDslJsonRootValue(); value.generators.addGenerator(Category.BODY, "", new TimeGenerator(format)); value.setValue(instance.format(new Date(DATE_2000))); value.setMatcher(value.matchTime(format)); return value; }
/** * Value that must match the given time format * @param format time format to match */ public static PactDslJsonRootValue time(String format) { FastDateFormat instance = FastDateFormat.getInstance(format); PactDslJsonRootValue value = new PactDslJsonRootValue(); value.generators.addGenerator(Category.BODY, "", new TimeGenerator(format)); value.setValue(instance.format(new Date(DATE_2000))); value.setMatcher(value.matchTime(format)); return value; }