Package org.eclipse.sapphire.modeling.el

Examples of org.eclipse.sapphire.modeling.el.FunctionContext


    @Test
   
    public void testFailSafeWithInteger()
    {
        final TestElement element = TestElement.TYPE.instantiate();
        final FunctionContext context = new ModelElementFunctionContext( element );
       
        element.setIntegerValue( "abc" );
        element.setIntegerValueWithDefault( "abc" );
       
        assertEquals( "abc", element.getIntegerValue().text() );
View Full Code Here


    @Test
   
    public void testFailSafeWithEnum()
    {
        final TestElement element = TestElement.TYPE.instantiate();
        final FunctionContext context = new ModelElementFunctionContext( element );
       
        element.setEnumValue( "abc" );
        element.setEnumValueWithDefault( "abc" );
       
        assertEquals( "abc", element.getEnumValue().text() );
View Full Code Here

   
    public void GlobalFunction()
    {
        Sapphire.global().remove( "Test" );
       
        final FunctionResult fr = ExpressionLanguageParser.parse( "${ Global.Test }" ).evaluate( new FunctionContext() );
       
        try
        {
            assertNull( fr.value() );
           
View Full Code Here

{
    @Test
   
    public void testListToString()
    {
        final FunctionContext context = new FunctionContext();
       
        testForExpectedValue( context, FailSafeFunction.create( Literal.create( list() ), Literal.create( String.class ) ), "" );
        testForExpectedValue( context, FailSafeFunction.create( Literal.create( list( "x" ) ), Literal.create( String.class ) ), "x" );
        testForExpectedValue( context, FailSafeFunction.create( Literal.create( list( "x", "y" ) ), Literal.create( String.class ) ), "x,y" );
        testForExpectedValue( context, FailSafeFunction.create( Literal.create( list( "x", "y", "z" ) ), Literal.create( String.class ) ), "x,y,z" );
View Full Code Here

   
    @Test

    public void testSetToString()
    {
        final FunctionContext context = new FunctionContext();
       
        testForExpectedValue( context, FailSafeFunction.create( Literal.create( set() ), Literal.create( String.class ) ), "" );
        testForExpectedValue( context, FailSafeFunction.create( Literal.create( set( "x" ) ), Literal.create( String.class ) ), "x" );
        testForExpectedValue( context, FailSafeFunction.create( Literal.create( set( "x", "y" ) ), Literal.create( String.class ) ), "x,y" );
        testForExpectedValue( context, FailSafeFunction.create( Literal.create( set( "x", "y", "z" ) ), Literal.create( String.class ) ), "x,y,z" );
View Full Code Here

   
    @Test

    public void testArrayToString()
    {
        final FunctionContext context = new FunctionContext();
       
        testForExpectedValue( context, FailSafeFunction.create( Literal.create( new String[] {} ), Literal.create( String.class ) ), "" );
        testForExpectedValue( context, FailSafeFunction.create( Literal.create( new String[] { "x" } ), Literal.create( String.class ) ), "x" );
        testForExpectedValue( context, FailSafeFunction.create( Literal.create( new String[] { "x", "y" } ), Literal.create( String.class ) ), "x,y" );
        testForExpectedValue( context, FailSafeFunction.create( Literal.create( new String[] { "x", "y", "z" } ), Literal.create( String.class ) ), "x,y,z" );
View Full Code Here

   
    @Test

    public void testStringToList()
    {
        final FunctionContext context = new FunctionContext();
       
        testForExpectedValue( context, FailSafeFunction.create( Literal.create( "" ), Literal.create( List.class ) ), list() );
        testForExpectedValue( context, FailSafeFunction.create( Literal.create( "x" ), Literal.create( List.class ) ), list( "x" ) );
        testForExpectedValue( context, FailSafeFunction.create( Literal.create( "x,y" ), Literal.create( List.class ) ), list( "x", "y" ) );
        testForExpectedValue( context, FailSafeFunction.create( Literal.create( "x,y,z" ), Literal.create( List.class ) ), list( "x", "y", "z" ) );
View Full Code Here

public final class MiscTests extends SapphireTestCase
{
    private void test( final String expr,
                       final Object expected )
    {
        test( expr, expected, new FunctionContext() );
    }
View Full Code Here

        child.setIntegerProp( 2 );
        child.setStringProp( "DEF" );
        grandchild.setIntegerProp( 3 );
        grandchild.setStringProp( "GHI" );
       
        final FunctionContext context = new ModelElementFunctionContext( root );
       
        test( expr, expected, context );
    }
View Full Code Here

public abstract class TestExpr extends SapphireTestCase
{
    protected static void testForExpectedValue( final String expr,
                                                final Object expected )
    {
        testForExpectedValue( new FunctionContext(), expr, expected );
    }
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.modeling.el.FunctionContext

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.