Package org.drools.workbench.models.testscenarios.backend

Examples of org.drools.workbench.models.testscenarios.backend.Cheese


        factPopulator.add( new NewFactPopulator( populatedData, typeResolver, lst ) );

        factPopulator.populate();

        Cheesery listChesse = (Cheesery) populatedData.get( "listChesse" );
        Cheese f1 = (Cheese) populatedData.get( "f1" );
        Cheese f2 = (Cheese) populatedData.get( "f2" );
        Cheese f3 = (Cheese) populatedData.get( "f3" );

        assertEquals( 3, listChesse.getCheeses().size() );
        assertTrue( listChesse.getCheeses().contains( f1 ) );
        assertTrue( listChesse.getCheeses().contains( f2 ) );
        assertTrue( listChesse.getCheeses().contains( f3 ) );
View Full Code Here


    public void testVerifyAnonymousFacts() throws Exception {
        TypeResolver typeResolver = mock( TypeResolver.class );
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        FactVerifier factVerifier = new FactVerifier( new HashMap<String, Object>(), typeResolver, classLoader, ksession, new HashMap<String, Object>() );

        Cheese c = new Cheese();
        c.setPrice( 42 );
        c.setType( "stilton" );

        // configure the mock to return the value
        Set o = Collections.singleton( (Object) c );
        when( ksession.getObjects() ).thenReturn( o );
View Full Code Here

    @Test
    public void testVerifyFactsWithOperator() throws Exception {
        TypeResolver typeResolver = mock( TypeResolver.class );
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

        Cheese f1 = new Cheese( "cheddar",
                                42 );
        HashMap<String, Object> populatedData = new HashMap<String, Object>();
        populatedData.put( "f1", f1 );

        // configure the mock to return the value
View Full Code Here

    @Test
    public void testVerifyFactsWithExpression() throws Exception {
        TypeResolver typeResolver = mock( TypeResolver.class );
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

        Cheese f1 = new Cheese( "cheddar",
                                42 );
        f1.setPrice( 42 );

        HashMap<String, Object> populatedData = new HashMap<String, Object>();
        populatedData.put( "f1", f1 );

        // configure the mock to return the value
View Full Code Here

        assertTrue( vf.getFieldValues().get( 0 ).getSuccessResult() );
    }

    @Test
    public void testVerifyFactExplanation() throws Exception {
        Cheese f1 = new Cheese();
        f1.setType( null );

        TypeResolver typeResolver = mock( TypeResolver.class );
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

        HashMap<String, Object> populatedData = new HashMap<String, Object>();
View Full Code Here

    }

    @Test
    public void testVerifyFieldAndActualIsNull() throws Exception {
        Cheese f1 = new Cheese();
        f1.setType( null );

        TypeResolver typeResolver = mock( TypeResolver.class );
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

        HashMap<String, Object> populatedData = new HashMap<String, Object>();
View Full Code Here

        factPopulator.populate();

        assertTrue( populatedData.containsKey( "c1" ) );

        Cheese cheese = (Cheese) populatedData.get( "c1" );
        assertEquals( CheeseType.CHEDDAR, cheese.getCheeseType() );
    }
View Full Code Here

        assertTrue( populatedData.get( "c1" ) instanceof Cheese );
    }

    @Test
    public void testPopulatingExistingFact() throws Exception {
        Cheese cheese = new Cheese();
        cheese.setType( "whee" );
        cheese.setPrice( 1 );

        Map<String, Object> populatedData = new HashMap<String, Object>();
        populatedData.put(
                "x",
                cheese );

        factPopulator.add(
                new ExistingFactPopulator(
                        populatedData,
                        getTypeResolver(),
                        getClassLoader(),
                        new FactData(
                                "Cheese",
                                "x",
                                Arrays.<Field>asList(
                                        new FieldData(
                                                "type",
                                                null ),
                                        new FieldData(
                                                "price",
                                                "42" ) ),
                                false ) ) );

        factPopulator.populate();

        assertEquals( "whee", cheese.getType() );
        assertEquals( 42, cheese.getPrice() );
    }
View Full Code Here

        factPopulator.populate();

        assertTrue( populatedData.containsKey( "c1" ) );
        assertTrue( populatedData.containsKey( "p1" ) );

        Cheese c = (Cheese) populatedData.get( "c1" );
        assertNotNull( c.getUsedBy() );

    }
View Full Code Here

        factPopulator.populate();

        assertTrue( populatedData.containsKey( "c1" ) );
        assertTrue( populatedData.containsKey( "c2" ) );

        Cheese c = (Cheese) populatedData.get( "c1" );
        assertEquals( "cheddar", c.getType() );
        assertEquals( 42, c.getPrice() );

        Cheese c2 = (Cheese) populatedData.get( "c2" );
        assertEquals( c.getType(), c2.getType() );
    }
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.testscenarios.backend.Cheese

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.