use of com.questdb.printer.converter.DateConverter in project questdb by bluestreak01.
the class PrinterTest method testDateConversion.
@Test
public void testDateConversion() throws Exception {
long millis = DateFormatUtils.parseDateTime("2013-10-11T10:00:00.000Z");
Quote position1 = new Quote().setBidSize(10).setTimestamp(millis);
Quote position2 = new Quote().setTimestamp(millis);
try (JournalPrinter printer = new JournalPrinter()) {
printer.types(Quote.class, int.class);
printer.setAppender(testAppender);
printer.f("timestamp").i(0).h("TimeStamp").c(new DateConverter(printer)).f("bidSize").f("askSize").v(1).h("test");
printer.header();
printer.out(position1, 0);
printer.out(position2, 1);
testAppender.assertLine("TimeStamp\tbidSize\taskSize\ttest", 0);
testAppender.assertLine("2013-10-11T10:00:00.000Z\t10\t0\t0", 1);
testAppender.assertLine("2013-10-11T10:00:00.000Z\t0\t0\t1", 2);
}
}
Aggregations