Package org.drools.ide.common.client.modeldriven.testing

Examples of org.drools.ide.common.client.modeldriven.testing.VerifyFact


            }

            @Override
            public Fixture getFixture() {
                String factName = valueWidget.getItemText( valueWidget.getSelectedIndex() );
                return new VerifyFact( factName,
                                       new ArrayList<VerifyField>(),
                                       true );
            }
View Full Code Here


            }

            @Override
            public Fixture getFixture() {
                String factName = valueWidget.getItemText( valueWidget.getSelectedIndex() );
                return new VerifyFact( factName,
                                       new ArrayList<VerifyField>() );
            }
View Full Code Here

        SuggestionCompletionEngine suggestionCompletionEngine = scenarioWidget.suggestionCompletionEngine;

        for ( Fixture fixture : verifyFacts ) {
            if ( fixture instanceof VerifyFact ) {
                VerifyFact verifyFact = (VerifyFact) fixture;

                HorizontalPanel column = new HorizontalPanel();
                column.add( new VerifyFactWidget( verifyFact,
                                                  scenario,
                                                  suggestionCompletionEngine,
View Full Code Here

                }
                panel.add( new SmallLabel( verifyRuleFired.getExplanation() ) );
                resultsDetail.add( panel );
                total++;
            } else if ( fixture instanceof VerifyFact ) {
                VerifyFact verifyFact = (VerifyFact) fixture;
                for ( Iterator<VerifyField> fieldIterator = verifyFact.getFieldValues().iterator(); fieldIterator.hasNext(); ) {
                    total++;
                    VerifyField verifyField = fieldIterator.next();
                    HorizontalPanel panel = new HorizontalPanel();
                    if ( !verifyField.getSuccessResult().booleanValue() ) {
                        panel.add( GuvnorImages.INSTANCE.WarningAlt() );
View Full Code Here

                                33 );
        runner.getPopulatedData().put( "f2",
                                       f2 );

        // test all true
        VerifyFact vf = new VerifyFact();
        vf.setName("f1");
        vf.setFieldValues( ls( new VerifyField( "type",
                                                "cheddar",
                                                "==" ),
                               new VerifyField( "price",
                                                "42",
                                                "==" ) ) );

        runner.verify( vf );
        for ( int i = 0; i < vf.getFieldValues().size(); i++ ) {
            assertTrue( ((VerifyField) vf.getFieldValues().get( i )).getSuccessResult() );
        }

        vf = new VerifyFact();
        vf.setName("f2");
        vf.setFieldValues( ls( new VerifyField( "name",
                                                "michael",
                                                "==" ),
                               new VerifyField( "age",
                                                "33",
                                                "==" ) ) );

        runner.verify( vf );
        for ( int i = 0; i < vf.getFieldValues().size(); i++ ) {
            assertTrue( ((VerifyField) vf.getFieldValues().get( i )).getSuccessResult() );
        }

        // test one false
        vf = new VerifyFact();
        vf.setName("f2");
        vf.setFieldValues( ls( new VerifyField( "name",
                                                "mark",
                                                "==" ),
                               new VerifyField( "age",
                                                "33",
                                                "==" ) ) );

        runner.verify( vf );
        assertFalse( ((VerifyField) vf.getFieldValues().get( 0 )).getSuccessResult() );
        assertTrue( ((VerifyField) vf.getFieldValues().get( 1 )).getSuccessResult() );

        assertEquals( "michael",
                      ((VerifyField) vf.getFieldValues().get( 0 )).getActualResult() );
        assertEquals( "mark",
                      ((VerifyField) vf.getFieldValues().get( 0 )).getExpected() );

        // test 2 false
        vf = new VerifyFact();
        vf.setName("f2");
        vf.setFieldValues( ls( new VerifyField( "name",
                                                "mark",
                                                "==" ),
                               new VerifyField( "age",
                                                "32",
                                                "==" ) ) );

        runner.verify( vf );
        assertFalse( ((VerifyField) vf.getFieldValues().get( 0 )).getSuccessResult() );
        assertFalse( ((VerifyField) vf.getFieldValues().get( 1 )).getSuccessResult() );

        assertEquals( "michael",
                      ((VerifyField) vf.getFieldValues().get( 0 )).getActualResult() );
        assertEquals( "mark",
                      ((VerifyField) vf.getFieldValues().get( 0 )).getExpected() );

        assertEquals( "33",
                      ((VerifyField) vf.getFieldValues().get( 1 )).getActualResult() );
        assertEquals( "32",
                      ((VerifyField) vf.getFieldValues().get( 1 )).getExpected() );

    }
View Full Code Here

                                42 );
        f1.setCheeseType( CheeseType.CHEDDAR );
        runner.getPopulatedData().put( "f1",
                                       f1 );

        VerifyFact vf = new VerifyFact();
        vf.setName("f1");
        VerifyField verifyField = new VerifyField( "cheeseType",
                                                   "CheeseType.CHEDDAR",
                                                   "==" );
        verifyField.setNature( VerifyField.TYPE_ENUM );
        vf.setFieldValues( ls( verifyField ) );
        runner.verify( vf );
        for ( int i = 0; i < vf.getFieldValues().size(); i++ ) {
            assertTrue( ((VerifyField) vf.getFieldValues().get( i )).getSuccessResult() );
        }
    }
View Full Code Here

        c.setPrice( 42 );
        c.setType( "stilton" );

        wm.facts.add( c );

        VerifyFact vf = new VerifyFact( "Cheese",
                                        new ArrayList(),
                                        true );
        vf.getFieldValues().add( new VerifyField( "price",
                                                  "42",
                                                  "==" ) );
        vf.getFieldValues().add( new VerifyField( "type",
                                                  "stilton",
                                                  "==" ) );

        runner.verify( vf );

        assertTrue( vf.wasSuccessful() );

        vf = new VerifyFact( "Person",
                             new ArrayList(),
                             true );
        vf.getFieldValues().add( new VerifyField( "age",
                                                  "42",
                                                  "==" ) );

        runner.verify( vf );

        assertFalse( vf.wasSuccessful() );

        vf = new VerifyFact( "Cheese",
                             new ArrayList(),
                             true );
        vf.getFieldValues().add( new VerifyField( "price",
                                                  "43",
                                                  "==" ) );
        vf.getFieldValues().add( new VerifyField( "type",
                                                  "stilton",
                                                  "==" ) );

        runner.verify( vf );
        assertFalse( vf.wasSuccessful() );
        assertEquals( Boolean.FALSE,
                      ((VerifyField) vf.getFieldValues().get( 0 )).getSuccessResult() );

        vf = new VerifyFact( "Cell",
                             new ArrayList(),
                             true );
        vf.getFieldValues().add( new VerifyField( "value",
                                                  "43",
                                                  "==" ) );

        runner.verify( vf );
        assertFalse( vf.wasSuccessful() );
        assertEquals( Boolean.FALSE,
                      ((VerifyField) vf.getFieldValues().get( 0 )).getSuccessResult() );

    }
View Full Code Here

                                42 );
        runner.getPopulatedData().put( "f1",
                                       f1 );

        // test all true
        VerifyFact vf = new VerifyFact();
        vf.setName("f1");
        vf.setFieldValues( ls( new VerifyField( "type",
                                                "cheddar",
                                                "==" ),
                               new VerifyField( "price",
                                                "4777",
                                                "!=" ) ) );
        runner.verify( vf );
        for ( int i = 0; i < vf.getFieldValues().size(); i++ ) {
            assertTrue( ((VerifyField) vf.getFieldValues().get( i )).getSuccessResult() );
        }

        vf = new VerifyFact();
        vf.setName("f1");
        vf.setFieldValues( ls( new VerifyField( "type",
                                                "cheddar",
                                                "!=" ) ) );
        runner.verify( vf );
        assertFalse( ((VerifyField) vf.getFieldValues().get( 0 )).getSuccessResult() );

    }
View Full Code Here

                                42 );
        runner.getPopulatedData().put( "f1",
                                       f1 );
        f1.setPrice( 42 );
        // test all true
        VerifyFact vf = new VerifyFact();
        vf.setName("f1");
        vf.setFieldValues( ls( new VerifyField( "price",
                                                "= 40 + 2",
                                                "==" ) ) );
        runner.verify( vf );

        assertTrue( ((VerifyField) vf.getFieldValues().get( 0 )).getSuccessResult() );
    }
View Full Code Here

        Cheese f1 = new Cheese();
        f1.setType( null );
        runner.getPopulatedData().put( "f1",
                                       f1 );

        VerifyFact vf = new VerifyFact();
        vf.setName("f1");
        vf.getFieldValues().add( new VerifyField( "type",
                                                  "boo",
                                                  "!=" ) );

        runner.verify( vf );
        VerifyField vfl = (VerifyField) vf.getFieldValues().get( 0 );
        assertEquals( "[f1] field [type] was not [boo].",
                      vfl.getExplanation() );

    }
View Full Code Here

TOP

Related Classes of org.drools.ide.common.client.modeldriven.testing.VerifyFact

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.