* Test for xs:hours-from-duration() function.
*
* @throws Exception thrown by tested function
*/
public void testHoursFromDuration() throws Exception {
final Function function = new HoursFromDurationFunction();
DurationValue duration;
Value result;
duration =
factory.createDurationValue(true, 0, 0, 3, 10, 0, 0, 0);
result = function.invoke(
expressionContextMock,
new Value[] { duration });
assertEquals(result, factory.createIntValue(10));
duration =
factory.createDurationValue(true, 0, 0, 3, 12, 32, 12, 0);
result = function.invoke(
expressionContextMock,
new Value[] { duration });
assertEquals(result, factory.createIntValue(12));
duration =
factory.createDurationValue(true, 0, 0, 0, 123, 0, 0, 0);
result = function.invoke(
expressionContextMock,
new Value[] { duration });
assertEquals(result, factory.createIntValue(3));
duration =
factory.createDurationValue(false, 0, 0, 3, 10, 0, 0, 0);
result = function.invoke(
expressionContextMock,
new Value[] { duration });
assertEquals(result, factory.createIntValue(-10));
}