TSK-1021 InstantTypeHandler Comments from Mustapha
This commit is contained in:
parent
8c8bb69b57
commit
bc18f69777
|
@ -235,8 +235,8 @@ public class TaskanaEngineImpl implements TaskanaEngine {
|
|||
}
|
||||
|
||||
// register type handlers
|
||||
configuration.getTypeHandlerRegistry().register(MapTypeHandler.class);
|
||||
configuration.getTypeHandlerRegistry().register(Instant.class, InstantTypeHandler.class);
|
||||
configuration.getTypeHandlerRegistry().register(new MapTypeHandler());
|
||||
configuration.getTypeHandlerRegistry().register(Instant.class, new InstantTypeHandler());
|
||||
// add mappers
|
||||
configuration.addMapper(TaskMapper.class);
|
||||
configuration.addMapper(TaskMonitorMapper.class);
|
||||
|
|
|
@ -4,6 +4,8 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||
import static pro.taskana.sampledata.SqlReplacer.DATE_TIME_FORMATTER;
|
||||
import static pro.taskana.sampledata.SqlReplacer.RELATIVE_DATE_PATTERN;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.regex.Matcher;
|
||||
import org.hamcrest.CoreMatchers;
|
||||
|
@ -15,7 +17,7 @@ class SqlReplacerTest {
|
|||
|
||||
@Test
|
||||
void replaceRelativeTimeFunctionSameDate() {
|
||||
ZonedDateTime now = ZonedDateTime.now();
|
||||
ZonedDateTime now = Instant.now().atZone(ZoneId.of("UTC"));
|
||||
String dateFormatted = now.format(DATE_TIME_FORMATTER);
|
||||
String sqlStringReplaced = SqlReplacer.replaceDatePlaceholder(now, "... RELATIVE_DATE(0) ...");
|
||||
assertThat(sqlStringReplaced, CoreMatchers.containsString(dateFormatted));
|
||||
|
@ -45,7 +47,7 @@ class SqlReplacerTest {
|
|||
|
||||
@Test
|
||||
void replaceRelativeTimeFunctionPosDate() {
|
||||
ZonedDateTime now = ZonedDateTime.now();
|
||||
ZonedDateTime now = Instant.now().atZone(ZoneId.of("UTC"));
|
||||
String dateFormatted = now.plusDays(5).format(DATE_TIME_FORMATTER);
|
||||
String sqlStringReplaced = SqlReplacer.replaceDatePlaceholder(now, "... RELATIVE_DATE(5) ...");
|
||||
assertThat(sqlStringReplaced, CoreMatchers.containsString(dateFormatted));
|
||||
|
@ -53,7 +55,7 @@ class SqlReplacerTest {
|
|||
|
||||
@Test
|
||||
void replaceRelativeTimeFunctionNegDate() {
|
||||
ZonedDateTime now = ZonedDateTime.now();
|
||||
ZonedDateTime now = Instant.now().atZone(ZoneId.of("UTC"));
|
||||
String dateFormatted = now.plusDays(-10).format(DATE_TIME_FORMATTER);
|
||||
String sqlStringReplaced =
|
||||
SqlReplacer.replaceDatePlaceholder(now, "... RELATIVE_DATE(-10) ...");
|
||||
|
|
Loading…
Reference in New Issue