Package com.volantis.xml.expression

Examples of com.volantis.xml.expression.Value


    /**
     * Tests if function works correctly for 0.0
     */
    public void testZero() throws ExpressionException {
        final Function function = new CeilingFunction();
        Value result = function.invoke(expressionContextMock, new Value[]{
                factory.createDoubleValue(0)});
        assertTrue(result instanceof DoubleValue);
        assertTrue(0.0 == ((DoubleValue) result).asJavaDouble());
    }
View Full Code Here


    /**
     * Tests if function works correctly for integers
     */
    public void testInt() throws ExpressionException {
        final Function function = new CeilingFunction();
        Value result = function.invoke(expressionContextMock, new Value[]{
                factory.createIntValue(4)});
        assertTrue(result instanceof IntValue);
        assertEquals(4, ((IntValue) result).asJavaInt());
    }
View Full Code Here

    /**
     * Tests if function works correctly for not a number
     */
    public void testNotANumber() throws ExpressionException {
        final Function function = new CeilingFunction();
        Value result = function.invoke(expressionContextMock, new Value[]{
                DoubleValue.NOT_A_NUMBER});
        assertTrue(result instanceof DoubleValue);
        assertTrue(Double.isNaN(((DoubleValue) result).asJavaDouble()));
    }
View Full Code Here

    /**
     * Tests if function works correctly for positive infinity
     */
    public void testPositiveInfinity() throws ExpressionException {
        final Function function = new CeilingFunction();
        Value result = function.invoke(expressionContextMock, new Value[]{
                DoubleValue.POSITIVE_INFINITY});
        assertTrue(result instanceof DoubleValue);
        assertTrue(Double.POSITIVE_INFINITY == (((DoubleValue) result).asJavaDouble()));
    }
View Full Code Here

    /**
     * Tests if function works correctly for negative infinity
     */
    public void testNegativeInfinity() throws ExpressionException {
        final Function function = new CeilingFunction();
        Value result = function.invoke(expressionContextMock, new Value[]{
                DoubleValue.NEGATIVE_INFINITY});
        assertTrue(result instanceof DoubleValue);
        assertTrue(Double.NEGATIVE_INFINITY == (((DoubleValue) result).asJavaDouble()));
    }
View Full Code Here

    public void testEmpty() throws Exception {

        Sequence sequence = factory.createSequence(new Item[0]);
        Function function = new SubsequenceFunction();

        Value result;

        result = invokeSubsequence(function, sequence, 1);
        assertSame(sequence, result);

        result = invokeSubsequence(function, sequence, -2);
View Full Code Here

    public void testMiddleRange() throws Exception {

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

        Value result;

        result = invokeSubsequence(function, sequence, 2, 2);
        Sequence subsequence = result.getSequence();
        assertEquals(subsequence.getLength(), 2);
        assertSame(flintstoneAndRubbleItems[1], subsequence.getItem(1));
        assertSame(flintstoneAndRubbleItems[2], subsequence.getItem(2));
    }
View Full Code Here

    public void testOverlappingStartRange() throws Exception {

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

        Value result;

        result = invokeSubsequence(function, sequence, -2, 6);
        Sequence subsequence = result.getSequence();
        assertEquals(subsequence.getLength(), 3);
        assertSame(flintstoneAndRubbleItems[0], subsequence.getItem(1));
        assertSame(flintstoneAndRubbleItems[1], subsequence.getItem(2));
        assertSame(flintstoneAndRubbleItems[2], subsequence.getItem(3));
    }
View Full Code Here

    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();
        assertEquals(subsequence.getLength(), 3);
        assertSame(flintstoneAndRubbleItems[1], subsequence.getItem(1));
        assertSame(flintstoneAndRubbleItems[2], subsequence.getItem(2));
        assertSame(flintstoneAndRubbleItems[3], subsequence.getItem(3));
    }
View Full Code Here

    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();
        assertSame(sequence, subsequence);
    }
View Full Code Here

TOP

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

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.