Package com.volantis.xml.expression

Examples of com.volantis.xml.expression.Function.invoke()


     * 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

    /**
     * Tests on sequence of times. Latest time should be returned.
     */
    public void testSequenceOfTimeValues() throws ExpressionException {
        final Function function = new MaxFunction();
        Value result = function.invoke(expressionContextMock, new Value[]{
                factory.createSequence(new Item[]{
                      factory.createTimeValue("07:56:16+00:00"),
                      factory.createTimeValue("12:30:16+00:00"),
                      factory.createTimeValue("22:55:21+00:00"),
                      factory.createTimeValue("22:56:16+00:00")
View Full Code Here

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

     * with one argument
     */
    public void testOneArgument() {
        final Function function = new SubstringFunction();
        try {
            function.invoke(expressionContextMock, new Value[]{factory.createStringValue("abc")});
            fail("Exception wasn't thrown when substring was invoked with 1 arguments");
        } catch (ExpressionException e) {
            //do nothing, expected situation
        }
    }
View Full Code Here

     * with four arguments
     */
    public void testFourArgument() {
        final Function function = new SubstringFunction();
        try {
            function.invoke(expressionContextMock, new Value[]{
                    factory.createStringValue("arg1"),
                    factory.createStringValue("arg2"),
                    factory.createStringValue("arg3"),
                    factory.createStringValue("arg4")});
            fail("Exception wasn't thrown when substring was invoked with 4 arguments");
View Full Code Here

    /**
     * Tests if function works with two arguments
     */
    public void testTwoArguments() throws ExpressionException {
        final Function function = new SubstringFunction();
        Value result = function.invoke(expressionContextMock,
                new Value[]{factory.createStringValue("123456"), factory.createIntValue(3)});
        assertTrue(result instanceof StringValue);
        assertEquals("3456", ((StringValue) result).asJavaString());
    }
   
View Full Code Here

    /**
     * Tests if function works correctly when substring start is negative
     */
    public void testTwoArgumentsStartNegative() throws ExpressionException {
        final Function function = new SubstringFunction();
        Value result = function.invoke(expressionContextMock,
                new Value[]{factory.createStringValue("123456"), factory.createIntValue(-3)});
        assertTrue(result instanceof StringValue);
        assertEquals("123456", ((StringValue) result).asJavaString());
    }
   
View Full Code Here

     * Tests if function works correctly when substring start is greater
     * than original string's length
     */
    public void testTwoArgumentsStartGreaterThanLength() throws ExpressionException {
        final Function function = new SubstringFunction();
        Value result = function.invoke(expressionContextMock,
                new Value[]{factory.createStringValue("123456"), factory.createIntValue(10)});
        assertTrue(result instanceof StringValue);
        assertEquals("", ((StringValue) result).asJavaString());
    }
   
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.