com.github.tomakehurst.wiremock.extension.responsetemplating.helpers.HandlebarsCurrentDateHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wiremock-standalone Show documentation
Show all versions of wiremock-standalone Show documentation
A web service test double for all occasions
package com.github.tomakehurst.wiremock.extension.responsetemplating.helpers;
import com.github.jknack.handlebars.Options;
import java.io.IOException;
import java.util.Date;
public class HandlebarsCurrentDateHelper extends HandlebarsHelper {
@Override
public Object apply(Date context, Options options) throws IOException {
String format = options.hash("format", null);
String offset = options.hash("offset", null);
Date date = context != null ? context : new Date();
if (offset != null) {
date = new DateOffset(offset).shift(date);
}
return new RenderableDate(date, format);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy