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