use of org.mule.runtime.core.internal.el.datetime.DateTime in project mule by mulesoft.
the class DateTimeTestCase method isAfter.
@Test
public void isAfter() {
Calendar cal = Calendar.getInstance();
cal.add(DATE, -1);
assertTrue(now.isAfter(new DateTime(cal)));
}
use of org.mule.runtime.core.internal.el.datetime.DateTime in project mule by mulesoft.
the class DateTimeExpressionLanguageFunctionTestCase method parseISO8601String.
@Test
public void parseISO8601String() throws Exception {
DateTime dateTime = (DateTime) dateTimeFunction.call(new Object[] { "2013-03-17T00:23:00Z" }, context);
assertNotNull(dateTime);
assertEquals(2013, dateTime.getYear());
assertEquals(3, dateTime.getMonth());
assertEquals(17, dateTime.getDayOfMonth());
assertEquals(0, dateTime.getHours());
assertEquals(23, dateTime.getMinutes());
assertEquals(0, dateTime.getSeconds());
assertEquals(0, dateTime.toCalendar().get(Calendar.ZONE_OFFSET));
}
use of org.mule.runtime.core.internal.el.datetime.DateTime in project mule by mulesoft.
the class DateTimeExpressionLanguageFunctionTestCase method parseISO8601StringWithTimeZome.
@Test
public void parseISO8601StringWithTimeZome() throws Exception {
DateTime dateTime = (DateTime) dateTimeFunction.call(new Object[] { "2013-03-17T00:23:00+07:00" }, context);
assertNotNull(dateTime);
assertEquals(2013, dateTime.getYear());
assertEquals(3, dateTime.getMonth());
assertEquals(17, dateTime.getDayOfMonth());
assertEquals(0, dateTime.getHours());
assertEquals(23, dateTime.getMinutes());
assertEquals(0, dateTime.getSeconds());
assertEquals(7 * 1000 * 60 * 60, dateTime.toCalendar().get(Calendar.ZONE_OFFSET));
}
use of org.mule.runtime.core.internal.el.datetime.DateTime in project mule by mulesoft.
the class ServerContextTestCase method dateTime.
@Test
public void dateTime() {
DateTime serverTime = (DateTime) evaluate("server.dateTime");
long diff = new Date().getTime() - serverTime.toDate().getTime();
assertThat("server.dateTime is not returning the current time", diff, lessThan(DEFAULT_TEST_TIMEOUT_SECS * 1000L));
assertThat(evaluate("server.dateTime"), instanceOf(DateTime.class));
}
Aggregations