}
}
public void testEvaluate() {
List<Value> dateValues =
Lists.newArrayList((Value) new DateValue(2008, 7, 13));
assertEquals(new NumberValue(2008), year.evaluate(dateValues));
assertEquals(new NumberValue(7), month.evaluate(dateValues));
assertEquals(new NumberValue(13), day.evaluate(dateValues));
List<Value> dateTimeValues =
Lists.newArrayList((Value) new DateTimeValue(
2001, 2, 3, 9, 12, 22, 333));
assertEquals(new NumberValue(2001), year.evaluate(dateTimeValues));
assertEquals(new NumberValue(2), month.evaluate(dateTimeValues));
assertEquals(new NumberValue(3), day.evaluate(dateTimeValues));
assertEquals(new NumberValue(9), hour.evaluate(dateTimeValues));
assertEquals(new NumberValue(12), minute.evaluate(dateTimeValues));
assertEquals(new NumberValue(22), second.evaluate(dateTimeValues));
assertEquals(new NumberValue(333), millisecond.evaluate(dateTimeValues));
List<Value> timeOfDayValues =
Lists.newArrayList((Value) new TimeOfDayValue(23, 22, 21, 20));
assertEquals(new NumberValue(23), hour.evaluate(timeOfDayValues));
assertEquals(new NumberValue(22), minute.evaluate(timeOfDayValues));
assertEquals(new NumberValue(21), second.evaluate(timeOfDayValues));
assertEquals(new NumberValue(20), millisecond.evaluate(timeOfDayValues));
timeOfDayValues = Lists.newArrayList((Value) new TimeOfDayValue(9, 12, 22));
// Tests that milliseconds return 0 when the the TimeOfDayValue is
// initialized without the milliseconds.
assertEquals(new NumberValue(0), millisecond.evaluate(timeOfDayValues));
List<Value> dateValues1 =
Lists.newArrayList((Value) new DateValue(2008, 1, 13));
List<Value> dateValues2 =
Lists.newArrayList((Value) new DateValue(2008, 4, 13));
List<Value> dateValues3 =
Lists.newArrayList((Value) new DateValue(2008, 8, 13));
List<Value> dateValues4 =
Lists.newArrayList((Value) new DateValue(2008, 11, 13));
List<Value> dateValues5 =
Lists.newArrayList((Value) new DateValue(2008, 5, 13));
assertEquals(new NumberValue(1), quarter.evaluate(dateValues1));
assertEquals(new NumberValue(2), quarter.evaluate(dateValues2));
assertEquals(new NumberValue(3), quarter.evaluate(dateValues3));
assertEquals(new NumberValue(4), quarter.evaluate(dateValues4));