" return the empty sequence",
Sequence.EMPTY,
unionFunction.invoke(expressionContextMock, new Value[] {
Sequence.EMPTY, Sequence.EMPTY
}));
final Sequence firstSequence =
expressionContextMock.getFactory().createSequence(
new Item[] {
expressionContextMock.getFactory()
.createStringValue("value1"),
expressionContextMock.getFactory()
.createStringValue("value2"),
expressionContextMock.getFactory()
.createStringValue("value2"),
expressionContextMock.getFactory()
.createBooleanValue(true)});
final Sequence secondSequence =
expressionContextMock.getFactory().createSequence(
new Item[] {
expressionContextMock.getFactory()
.createStringValue("value0"),
expressionContextMock.getFactory()
.createStringValue("value0"),
expressionContextMock.getFactory()
.createStringValue("value1"),
expressionContextMock.getFactory()
.createBooleanValue(false)});
final Sequence result = (Sequence) unionFunction.invoke(
expressionContextMock, new Value[] {firstSequence,
secondSequence});
assertEquals("number of elements in returned sequence is incorrect",
5, result.getLength());
assertEquals("incorrect element in returned sequence",
"value1", result.getItem(1).stringValue().asJavaString());
assertEquals("incorrect element in returned sequence",
"value2", result.getItem(2).stringValue().asJavaString());
assertEquals("incorrect element in returned sequence",
"true", result.getItem(3).stringValue().asJavaString());
assertEquals("incorrect element in returned sequence",
"value0", result.getItem(4).stringValue().asJavaString());
assertEquals("incorrect element in returned sequence",
"false", result.getItem(5).stringValue().asJavaString());
}