Package com.volantis.xml.expression

Examples of com.volantis.xml.expression.Expression


     * Test the boolean function with an invalid String value argument.
     * @throws Exception if an error occurs
     */
    public void testBooleanStringInvalidString() throws Exception {
        try {
            Expression exp = compileExpression("boolean(\"hello\")");
            exp.evaluate(context);
            fail("boolean(\"hello\") should throw an exception");
        } catch (ExpressionException e) {
            // expected condition
        }
    }
View Full Code Here


    /**
     * Test the boolean function with a numeric argument.
     * @throws Exception if an error occurs
     */
    public void testBooleanNumericArg() throws Exception {
        Expression exp = compileExpression("boolean(0.0)");

        Value result = exp.evaluate(context);

        assertTrue("fn:boolean should result in a boolean value",
                   result instanceof BooleanValue);

        assertFalse("fn:boolean expression result should be false",
View Full Code Here

    /**
     * Test the number function with a numeric argument.
     * @throws Exception if an error occurs
     */
    public void testNumberNumericArg() throws Exception {
        Expression exp = compileExpression("number(0.0)");

        Value result = exp.evaluate(context);

        assertTrue("fn:number should result in a double value",
                   result instanceof DoubleValue);

        assertEquals("fn:number expression result should be 0.0",
View Full Code Here

    /**
     * Test the number function with a String argument.
     * @throws Exception if an error occurs
     */
    public void testNumberStringArg() throws Exception {
        Expression exp = compileExpression("number('99.9')");

        Value result = exp.evaluate(context);

        assertTrue("fn:number should result in a double value",
                   result instanceof DoubleValue);

        assertEquals("fn:number expression result should be 99.9",
View Full Code Here

    /**
     * Test the number function with a Boolean argument.
     * @throws Exception if an error occurs
     */
    public void testNumberBooleanArg() throws Exception {
        Expression exp = compileExpression("number(true())");

        Value result = exp.evaluate(context);

        assertTrue("fn:number should result in a double value",
                   result instanceof DoubleValue);

        assertEquals("fn:number expression result should be 1.0",
View Full Code Here

    /**
     * Test the number function with an invalid argument.
     * @throws Exception if an error occurs
     */
    public void testNumberInvalidArg() throws Exception {
        Expression exp = compileExpression("number('one')");

        Value result = exp.evaluate(context);

        assertTrue("fn:number should result in a Double value",
                   result instanceof DoubleValue);

        assertTrue("fn:number expression result should be NaN",
View Full Code Here

    /**
     * Test the concat function with two string args
     * @throws Exception if an error occurs
     */
    public void testConcatTwoStringArgs() throws Exception {
        Expression exp = compileExpression("concat('con', 'cat')");

        Value result = exp.evaluate(context);

        assertTrue("fn:concat should result in a String value",
                   result instanceof StringValue);

        assertEquals("fn:concat expression result should be concat",
View Full Code Here

    /**
     * Test the concat function with five string args
     * @throws Exception if an error occurs
     */
    public void testConcatFiveStringArgs() throws Exception {
        Expression exp = compileExpression("concat('ex','pres','s','ion','s')");

        Value result = exp.evaluate(context);

        assertTrue("fn:concat should result in a String value",
                   result instanceof StringValue);

        assertEquals("fn:concat expression result should be expressions",
View Full Code Here

        context.getCurrentScope().declareVariable(
                        new ImmutableExpandedName("", "singleSeq"),
                        factory.createSequence(new Item[]
                        {factory.createStringValue("one")}));

        Expression exp = compileExpression(
                "concat(true(), 25.9, $emptySeq, $myVar, $singleSeq)");

        Value result = exp.evaluate(context);

        assertTrue("fn:concat should result in a String value",
                   result instanceof StringValue);

        assertEquals("fn:concat expression result should be 'true25.91one'",
View Full Code Here

    /**
     * Test the concat function with a single argument
     * @throws Exception if an error occurs
     */
    public void testConcatOneArg() throws Exception {
        Expression exp = compileExpression("concat('con')");

        try {
            exp.evaluate(context);
            fail("calling concat with a single argument should result " +
                 "in an ExpressionException");
        } catch (ExpressionException e) {
            // expected condition
        }
View Full Code Here

TOP

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

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.