use of org.apache.commons.lang3.time.FastDateFormat in project pact-jvm by DiUS.
the class PactDslJsonBody method time.
/**
* Attribute that must match the given time format
* @param name attribute name
* @param format time format to match
* @param example example time to use for generated bodies
*/
public PactDslJsonBody time(String name, String format, Date example) {
FastDateFormat instance = FastDateFormat.getInstance(format);
body.put(name, instance.format(example));
matchers.put(matcherKey(name), matchTime(format));
return this;
}
use of org.apache.commons.lang3.time.FastDateFormat in project pact-jvm by DiUS.
the class PactDslJsonBody method timestamp.
/**
* Attribute that must match the given timestamp format
* @param name attribute name
* @param format timestamp format
* @param example example date and time to use for generated bodies
*/
public PactDslJsonBody timestamp(String name, String format, Date example) {
FastDateFormat instance = FastDateFormat.getInstance(format);
body.put(name, instance.format(example));
matchers.put(matcherKey(name), matchTimestamp(format));
return this;
}
Aggregations