Package com.volantis.xml.expression

Examples of com.volantis.xml.expression.Function


     * Test that a range that overlaps the end works.
     */
    public void testOverlappingEndRange() throws Exception {

        Sequence sequence = factory.createSequence(flintstoneAndRubbleItems);
        Function function = new SubsequenceFunction();

        Value result;

        result = invokeSubsequence(function, sequence, 2, 6);
        Sequence subsequence = result.getSequence();
View Full Code Here


     * Test that a range that overlaps the whole sequence works.
     */
    public void testOverlappingRange() throws Exception {

        Sequence sequence = factory.createSequence(flintstoneAndRubbleItems);
        Function function = new SubsequenceFunction();

        Value result;

        result = invokeSubsequence(function, sequence, -2, 60);
        Sequence subsequence = result.getSequence();
View Full Code Here

    /**
     * Tests if {@link ExpressionException} is thrown when max is called without
     * arguments
     */
    public void testNoArguments() {
        final Function function = new MaxFunction();
        try {
            function.invoke(expressionContextMock, new Value[]{});
            fail("Exception wasn't thrown when max was invoked with 0 arguments");
        } catch (ExpressionException e) {
            //do nothing, expected situation
        }
    }
View Full Code Here

    /**
     * Tests if {@link ExpressionException} is thrown when max is called with
     * two arguments
     */
    public void testTwoArguments() {
        final Function function = new MaxFunction();
        try {
            function.invoke(expressionContextMock, new Value[]{
                    factory.createSequence(new Item[]{}),
                    factory.createDoubleValue(20.0)});
            fail("Exception wasn't thrown when max was invoked with 2 arguments");
        } catch (ExpressionException e) {
            //do nothing, expected situation
View Full Code Here

   
    /**
     * Tests if empty sequence is returned for empty sequence
     */
    public void testEmptySequence() throws ExpressionException {
        final Function function = new MaxFunction();
        Value result = function.invoke(expressionContextMock,
                new Value[]{factory.createSequence(new Item[]{})});
        assertTrue(result instanceof Sequence);
        assertEquals(0, result.getSequence().getLength());
    }
View Full Code Here

   
    /**
     * Tests max on sequence of integers and doubles
     */
    public void testSequenceOfNumbers() throws ExpressionException {
        final Function function = new MaxFunction();
        Value result = function.invoke(expressionContextMock, new Value[]{
                factory.createSequence(new Item[]{
                      factory.createIntValue(6),
                      factory.createIntValue(3),
                      factory.createDoubleValue(4.3)
                })});
View Full Code Here

    /**
     * Tests on sequence of strings. Values should be compared using
     * Unicode code point collation (http://www.w3.org/2005/xpath-functions/collation/codepoint).
     */
    public void testSequenceOfStrings() throws ExpressionException {
        final Function function = new MaxFunction();
        Value result = function.invoke(expressionContextMock, new Value[]{
                factory.createSequence(new Item[]{
                      factory.createStringValue("qwe"),
                      factory.createStringValue("rty"),
                      factory.createStringValue("asd")
                })});
View Full Code Here

    /**
     * Tests on sequence of strings and numbers. {@link ExpressionException}
     * should be thrown.
     */
    public void testSequenceOfStringsAndNumbers() throws ExpressionException {
        final Function function = new MaxFunction();
        try {
            function.invoke(expressionContextMock, new Value[]{
                    factory.createSequence(new Item[]{
                            factory.createIntValue(6),
                            factory.createIntValue(3),
                            factory.createStringValue("qwe"),
                            factory.createStringValue("rty"),
View Full Code Here

   
    /**
     * Tests on sequence of dates. Latest date should be returned.
     */
    public void testSequenceOfDates() throws ExpressionException {
        final Function function = new MaxFunction();
        Value result = function.invoke(expressionContextMock, new Value[]{
                factory.createSequence(new Item[]{
                      factory.createDateValue("2008-03-11"),
                      factory.createDateValue("2006-04-16"),
                      factory.createDateValue("2009-01-02")
                })});
View Full Code Here

   
    /**
     * Tests on sequence of datetimes. Latest datetime should be returned.
     */
    public void testSequenceOfDatetimes() throws ExpressionException {
        final Function function = new MaxFunction();
        Value result = function.invoke(expressionContextMock, new Value[]{
                factory.createSequence(new Item[]{
                      factory.createDateTimeValue("2004-03-11T07:56:16+00:00"),
                      factory.createDateTimeValue("2006-04-16T12:30:16+00:00"),
                      factory.createDateTimeValue("2006-04-16T06:56:16+00:00"),
                      factory.createDateTimeValue("2005-01-02T02:56:16+00:00")
View Full Code Here

TOP

Related Classes of com.volantis.xml.expression.Function

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.