TimeZone tz = TimeZone.getTimeZone(offset);
dateFormatter.setTimeZone(tz);
Filter resultFilter = CompilerUtil.parseFilter(this.language,"ZONE_VALID_FROM BEFORE 2008-09-09T17:00:00+01:00");
Before comparation = (Before) resultFilter;
Expression expr2 = comparation.getExpression2();
Literal literalDate = (Literal) expr2;
Date actualDate = (Date) literalDate.getValue();
Date expectedDate = dateFormatter.parse("2008-09-09 17:00:00" + offset);
Assert.assertEquals(expectedDate, actualDate);
}
{
//JD: there was a bug in this test case with the date format, litte "z" has to
// specified as a named timezone, not an offset, so it was just being ignored
// plus the offset was wrong
// test offset GMT-01:00
//final DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssz");
// final String offset = "GMT+01:00";
final DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
final String offset = "GMT-01:00";
TimeZone tz = TimeZone.getTimeZone(offset);
dateFormatter.setTimeZone(tz);
Filter resultFilter = CompilerUtil.parseFilter(this.language, "ZONE_VALID_FROM BEFORE 2008-09-09T17:00:00-01:00");
Before comparation = (Before) resultFilter;
Expression expr2 = comparation.getExpression2();
Literal literalDate = (Literal) expr2;
Date actualDate = (Date) literalDate.getValue();
//Date expectedDate = dateFormatter.parse("2008-09-09 17:00:00 " + offset);
Date expectedDate = dateFormatter.parse("2008-09-09 17:00:00");