Tuple t3 = TupleFactory.getInstance().newTuple(1);
t3.set(0, "2009-01-07T01:07:01.000+08:00");
DateTime dt3 = func2.exec(t3);
assertEquals(dt3, new DateTime("2009-01-07T01:07:01.000+08:00", DateTimeZone.forID("+08:00")));
ToDate2ARGS func3 = new ToDate2ARGS();
Tuple t4 = TupleFactory.getInstance().newTuple(2);
t4.set(0, "2009.01.07 AD at 01:07:01");
t4.set(1, "yyyy.MM.dd G 'at' HH:mm:ss");
DateTime dt4 = func3.exec(t4);
assertEquals(dt4, new DateTime("2009-01-07T01:07:01.000Z"));
Tuple t5 = TupleFactory.getInstance().newTuple(2);
t5.set(0, "2009.01.07 AD at 01:07:01 +0800");
t5.set(1, "yyyy.MM.dd G 'at' HH:mm:ss Z");
DateTime dt5 = func3.exec(t5);
assertEquals(dt5, new DateTime("2009-01-07T01:07:01.000+08:00"));
ToDate3ARGS func4 = new ToDate3ARGS();
Tuple t6 = TupleFactory.getInstance().newTuple(3);
t6.set(0, "2009.01.07 AD at 01:07:01");
t6.set(1, "yyyy.MM.dd G 'at' HH:mm:ss");
t6.set(2, "+00:00");
DateTime dt6 = func4.exec(t6);
assertEquals(dt6, new DateTime("2009-01-07T01:07:01.000Z", DateTimeZone.forID("+00:00")));
Tuple t7 = TupleFactory.getInstance().newTuple(3);
t7.set(0, "2009.01.07 AD at 01:07:01 +0800");
t7.set(1, "yyyy.MM.dd G 'at' HH:mm:ss Z");
t7.set(2, "Asia/Singapore");
DateTime dt7 = func4.exec(t7);
assertEquals(dt7, new DateTime("2009-01-07T01:07:01.000+08:00", DateTimeZone.forID("+08:00")));
ToUnixTime func5 = new ToUnixTime();
Tuple t8 = TupleFactory.getInstance().newTuple(1);
t8.set(0, new DateTime(1231290421000L));
Long ut1 = func5.exec(t8);
assertEquals(ut1.longValue(), 1231290421L);
ToString func6 = new ToString();
Tuple t9 = TupleFactory.getInstance().newTuple(1);
t9.set(0, new DateTime("2009-01-07T01:07:01.000Z"));
String dtStr1 = func6.exec(t9);
assertEquals(dtStr1, "2009-01-07T01:07:01.000Z");
Tuple t10 = TupleFactory.getInstance().newTuple(1);
t10.set(0, new DateTime("2009-01-07T09:07:01.000+08:00"));
String dtStr2 = func6.exec(t10);
assertEquals(dtStr2, "2009-01-07T01:07:01.000Z");
Tuple t11 = TupleFactory.getInstance().newTuple(2);
t11.set(0, new DateTime("2009-01-07T01:07:01.000Z"));
t11.set(1, "yyyy.MM.dd G 'at' HH:mm:ss");
String dtStr3 = func6.exec(t11);
assertEquals(dtStr3, "2009.01.07 AD at 01:07:01");
Tuple t12 = TupleFactory.getInstance().newTuple(2);
t12.set(0, new DateTime("2009-01-07T01:07:01.000+08:00", DateTimeZone.forID("+08:00")));
t12.set(1, "yyyy.MM.dd G 'at' HH:mm:ss Z");
String dtStr4 = func6.exec(t12);
assertEquals(dtStr4, "2009.01.07 AD at 01:07:01 +0800");
ToMilliSeconds func7 = new ToMilliSeconds();
Tuple t13 = TupleFactory.getInstance().newTuple(1);
t13.set(0, new DateTime(1231290421000L));
Long ut2 = func7.exec(t11);
assertEquals(ut2.longValue(), 1231290421000L);
// Null handling
t1.set(0, null);
assertEquals(func1.exec(t1), null);
assertEquals(func2.exec(t1), null);
assertEquals(func3.exec(t1), null);
assertEquals(func4.exec(t1), null);
assertEquals(func5.exec(t1), null);
assertEquals(func6.exec(t1), null);
assertEquals(func7.exec(t1), null);
}