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