Package org.drools.guvnor.client.modeldriven.testing

Examples of org.drools.guvnor.client.modeldriven.testing.VerifyField


        sc.fixtures.add( executionTrace );

        Expectation[] assertions = new Expectation[2];

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

                                        ) );
View Full Code Here


                                       "c2",
                                       ls( new FieldData( "price",
                                                          "2" ) ),
                                       false ) );
        sc.fixtures.add( new VerifyFact( "c1",
                                         ls( new VerifyField( "type",
                                                              "rule1",
                                                              "==" ) ) ) );
        ex = new ExecutionTrace();
        sc.fixtures.add( ex );
        sc.fixtures.add( new VerifyFact( "c1",
                                         ls( new VerifyField( "type",
                                                              "rule2",
                                                              "==" ) ) ) );

        TypeResolver resolver = new ClassTypeResolver( new HashSet<String>(),
                                                       Thread.currentThread().getContextClassLoader() );
View Full Code Here

                                       false ) );

        sc.fixtures.add( new ExecutionTrace() );

        sc.fixtures.add( new VerifyFact( "c1",
                                         ls( new VerifyField( "type",
                                                              "rule1",
                                                              "==" ) ) ) );

        sc.fixtures.add( new FactData( "Cheese",
                                       "c1",
                                       ls( new FieldData( "price",
                                                          "42" ) ),
                                       true ) );
        sc.fixtures.add( new ExecutionTrace() );

        sc.fixtures.add( new VerifyFact( "c1",
                                         ls( new VerifyField( "type",
                                                              "rule3",
                                                              "==" ) ) ) );

        TypeResolver resolver = new ClassTypeResolver( new HashSet<String>(),
                                                       Thread.currentThread().getContextClassLoader() );
View Full Code Here

                                                          "42" ) ),
                                       false ) );
        sc.fixtures.add( new ExecutionTrace() );

        sc.fixtures.add( new VerifyFact( "c1",
                                         ls( new VerifyField( "type",
                                                              "XXX",
                                                              "==" ) ) ) );

        sc.fixtures.add( new RetractFact( "c2" ) );
        sc.fixtures.add( new ExecutionTrace() );

        sc.fixtures.add( new VerifyFact( "c1",
                                         ls( new VerifyField( "type",
                                                              "rule4",
                                                              "==" ) ) ) );

        TypeResolver resolver = new ClassTypeResolver( new HashSet<String>(),
                                                       Thread.currentThread().getContextClassLoader() );
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",
                                                             "XXX",
                                                             "==" ),
                                            new VerifyField( "status",
                                                             "rule2",
                                                             "==" )

                                        ) );
View Full Code Here

        sc.rules.add("rule2");

        sc.fixtures.add(new ExecutionTrace());

        List fields = new ArrayList();
        VerifyField vfl = new VerifyField("age", "42", "==");
        vfl.actualResult = "43";
        vfl.successResult = new Boolean(false);
        vfl.explanation = "Not cool jimmy.";

        fields.add(vfl);

        vfl = new VerifyField("name", "michael", "!=");
        vfl.actualResult = "bob";
        vfl.successResult = new Boolean(true);
        vfl.explanation = "Yeah !";
        fields.add(vfl);
View Full Code Here

                                  f2 );

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

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

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

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

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

        runner.verify( vf );
        assertFalse( ((VerifyField) vf.fieldValues.get( 0 )).successResult );
        assertTrue( ((VerifyField) vf.fieldValues.get( 1 )).successResult );

        assertEquals( "michael",
                      ((VerifyField) vf.fieldValues.get( 0 )).actualResult );
        assertEquals( "mark",
                      ((VerifyField) vf.fieldValues.get( 0 )).expected );

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

        runner.verify( vf );
        assertFalse( ((VerifyField) vf.fieldValues.get( 0 )).successResult );
View Full Code Here

        c.setType("stilton");

        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());
        assertEquals(Boolean.FALSE, ((VerifyField)vf.fieldValues.get(0)).successResult);
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

TOP

Related Classes of org.drools.guvnor.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.