Package org.drools.workbench.models.testscenarios.shared

Examples of org.drools.workbench.models.testscenarios.shared.VerifyField


        when( ksession.getObjects() ).thenReturn( o );

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

        factVerifier.verify( vf );
        assertTrue( vf.wasSuccessful() );

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

        factVerifier.verify( vf );
        assertFalse( vf.wasSuccessful() );

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

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

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

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


        FactVerifier factVerifier = new FactVerifier( populatedData, typeResolver, classLoader, ksession, new HashMap<String, Object>() );

        // test all true
        VerifyFact vf = new VerifyFact();
        vf.setName( "f1" );
        vf.getFieldValues().add( new VerifyField( "type",
                                                  "cheddar",
                                                  "==" ) );
        vf.getFieldValues().add( new VerifyField( "price",
                                                  "4777",
                                                  "!=" ) );

        factVerifier.verify( vf );

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

        vf = new VerifyFact();
        vf.setName( "f1" );
        vf.getFieldValues().add( new VerifyField( "type",
                                                  "cheddar",
                                                  "!=" ) );
        factVerifier.verify( vf );
        assertFalse( vf.getFieldValues().get( 0 ).getSuccessResult() );
View Full Code Here

        FactVerifier factVerifier = new FactVerifier( populatedData, typeResolver, classLoader, ksession, new HashMap<String, Object>() );

        // test all true
        VerifyFact vf = new VerifyFact();
        vf.setName( "f1" );
        vf.getFieldValues().add( new VerifyField( "price",
                                                  "= 40 + 2",
                                                  "==" ) );
        factVerifier.verify( vf );

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

        FactVerifier factVerifier = new FactVerifier( populatedData, typeResolver, classLoader, ksession, new HashMap<String, Object>() );

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

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

    }
View Full Code Here

        FactVerifier factVerifier = new FactVerifier( populatedData, typeResolver, classLoader, ksession, new HashMap<String, Object>() );

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

        factVerifier.verify( vf );
        VerifyField vfl = vf.getFieldValues().get( 0 );

        assertEquals( "[f1] field [type] was [] expected [boo].",
                      vfl.getExplanation() );
        assertEquals( "boo",
                      vfl.getExpected() );
        assertEquals( "",
                      vfl.getActualResult() );

    }
View Full Code Here

                sqlDateWrapper,
                typeResolver,
                Thread.currentThread().getContextClassLoader());

        List<VerifyField> fieldValues = new ArrayList<VerifyField>();
        VerifyField verifyField = new VerifyField("sqlDate", "12-DEC-2012", "==");
        fieldValues.add(verifyField);

        verifier.checkFields(fieldValues);

        assertTrue(verifyField.getSuccessResult());
    }
View Full Code Here

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

        scenario.getFixtures().add(verifyCheddar);

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

        scenario.getFixtures().add(michaelVerifyFact);

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

        scenario.getFixtures().add(markVerifyFact);

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

        scenario.getFixtures().add(mark2VerifyFact);
View Full Code Here

        ScenarioRunner runner = new ScenarioRunner(ksession);

        VerifyFact vf = new VerifyFact();
        vf.setName("f1");
        VerifyField verifyField = new VerifyField(
                "cheeseType",
                "CheeseType.CHEDDAR",
                "==");
        verifyField.setNature(VerifyField.TYPE_ENUM);
        vf.setFieldValues(ls(verifyField));
        scenario.getFixtures().add(vf);

        runner.run(scenario);
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.getFixtures().addAll(Arrays.asList(assertions));
View Full Code Here

        sc.getFixtures().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

TOP

Related Classes of org.drools.workbench.models.testscenarios.shared.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.