* Test for xs:years-from-duration() function.
*
* @throws Exception thrown by tested function
*/
public void testYearsFromDuration() throws Exception {
final Function function = new YearsFromDurationFunction();
DurationValue duration;
Value result;
duration =
factory.createDurationValue(true, 20, 15, 0, 0, 0, 0, 0);
result = function.invoke(
expressionContextMock,
new Value[] { duration });
assertEquals(result, factory.createIntValue(21));
duration =
factory.createDurationValue(false, 0, 15, 0, 0, 0, 0, 0);
result = function.invoke(
expressionContextMock,
new Value[] { duration });
assertEquals(result, factory.createIntValue(-1));
duration =
factory.createDurationValue(false, 0, 0, 2, 15, 0, 0, 0);
result = function.invoke(
expressionContextMock,
new Value[] { duration });
assertEquals(result, factory.createIntValue(0));
}