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

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


        wm.facts.add( c );

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

        runner.verify( vf );

        assertTrue( vf.wasSuccessful() );

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

        runner.verify( vf );

        assertFalse( vf.wasSuccessful() );

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

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

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

        runner.verify( vf );
        assertFalse( vf.wasSuccessful() );
View Full Code Here


                                  f1 );

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

        vf = new VerifyFact();
        vf.name = "f1";
        vf.fieldValues = ls( new VerifyField( "type",
                                              "cheddar",
                                              "!=" ) );
        runner.verify( vf );
        assertFalse( ((VerifyField) vf.fieldValues.get( 0 )).successResult );
View Full Code Here

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

        assertTrue( ((VerifyField) vf.fieldValues.get( 0 )).successResult );
View Full Code Here

        runner.populatedData.put( "f1",
                                  f1 );

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

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

    }
View Full Code Here

        runner.populatedData.put( "f1",
                                  f1 );

        VerifyFact vf = new VerifyFact();
        vf.name = "f1";
        vf.fieldValues.add( new VerifyField( "type",
                                             "boo",
                                             "==" ) );

        runner.verify( vf );
        VerifyField vfl = (VerifyField) vf.fieldValues.get( 0 );

        assertEquals( "[f1] field [type] was [] expected [boo].",
                      vfl.explanation );
        assertEquals( "boo",
                      vfl.expected );
View Full Code Here

                                                            new FieldData( "price",
                                                                           "42" ) ),
                                                        false )};

        VerifyFact[] assertions = new VerifyFact[]{new VerifyFact( "c1",
                                                                   ls( new VerifyField( "type",
                                                                                        "cheddar",
                                                                                        "==" ),
                                                                       new VerifyField( "price",
                                                                                        "42",
                                                                                        "==" ) ) )};

        sc.fixtures.addAll( Arrays.asList( facts ) );
        sc.fixtures.addAll( Arrays.asList( assertions ) );
View Full Code Here

                                      false ) );

        Expectation[] assertions = new Expectation[2];

        assertions[0] = new VerifyFact( "testList",
                                        ls( new VerifyField( "empty",
                                                             "true",
                                                             "==" ) ) );
        assertions[1] = new VerifyFact( "testList",
                                        ls( new VerifyField( "size",
                                                             "0",
                                                             "==" ) ) );

        sc.fixtures.addAll( Arrays.asList( assertions ) );
View Full Code Here

        sc.fixtures.add( executionTrace );

        Expectation[] assertions = new Expectation[5];

        assertions[0] = new VerifyFact( "c1",
                                        ls( new VerifyField( "type",
                                                             "cheddar",
                                                             "==" )

                                        ) );

        assertions[1] = new VerifyFact( "p",
                                        ls( new VerifyField( "name",
                                                             "rule1",
                                                             "==" ),
                                            new VerifyField( "status",
                                                             "rule2",
                                                             "==" ) )

        );
View Full Code Here

        sc.fixtures.add( executionTrace );

        Expectation[] assertions = new Expectation[5];

        assertions[0] = new VerifyFact( "c1",
                                        ls( new VerifyField( "type",
                                                             "cheddar",
                                                             "==" )

                                        ) );

        assertions[1] = new VerifyFact( "p",
                                        ls( new VerifyField( "name",
                                                             "rule1",
                                                             "==" ),
                                            new VerifyField( "status",
                                                             "rule2",
                                                             "==" ) )

        );
View Full Code Here

        sc.fixtures.add( executionTrace );

        Expectation[] assertions = new Expectation[2];

        assertions[0] = new VerifyFact( "c",
                                        ls( new VerifyField( "num",
                                                             "42",
                                                             "==" )

                                        ) );
View Full Code Here

TOP

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

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.