Package org.drools.factconstraints.client

Examples of org.drools.factconstraints.client.ValidationResult


    }

    @Test
    public void testValidConstraint(){
     
        ValidationResult result = cons.validate(new Object(), conf);
        assertTrue(result.isSuccess());

        result = cons.validate("", conf);
        assertTrue(result.isSuccess());

        result = cons.validate("ABC", conf);
        assertTrue(result.isSuccess());

        result = cons.validate(new Long("12"), conf);
        assertTrue(result.isSuccess());

        result = cons.validate(12L, conf);
        assertTrue(result.isSuccess());

        result = cons.validate(12.8, conf);
        assertTrue(result.isSuccess());
    }
View Full Code Here


    }

    @Test
    public void testInvalidConstraint(){

        ValidationResult result = cons.validate(null, conf);
        assertFalse(result.isSuccess());
        System.out.println("Message: "+result.getMessage());

    }
View Full Code Here

    }

    @Test @Ignore
    public void testValidConstraint(){
     
        ValidationResult result = cons.validate("Bart", conf);
        Assert.assertTrue(result.isSuccess());

        result = cons.validate("", conf);
        Assert.assertFalse(result.isSuccess());

        result = cons.validate("bart", conf);
        Assert.assertFalse(result.isSuccess());

        result = cons.validate(new Long("12"), conf);
        Assert.assertFalse(result.isSuccess());

        result = cons.validate(12L, conf);
        Assert.assertFalse(result.isSuccess());

        result = cons.validate(12.8, conf);
        Assert.assertFalse(result.isSuccess());
    }
View Full Code Here

    }

    @Test @Ignore
    public void testInvalidConstraint(){

        ValidationResult result = cons.validate(null, conf);
        Assert.assertFalse(result.isSuccess());
        System.out.println("Message: "+result.getMessage());

    }
View Full Code Here

    @Test
    public void testValidConstraint() {
      Constraint cons = new IntegerConstraint();
     
        ValidationResult result = cons.validate(12, conf);
        Assert.assertTrue(result.isSuccess());

        result = cons.validate(new Integer("12"), conf);
        Assert.assertTrue(result.isSuccess());

        result = cons.validate("12", conf);
        Assert.assertTrue(result.isSuccess());

    }
View Full Code Here

    @Test
    public void testInvalidConstraint() {
      Constraint cons = new IntegerConstraint();
     
        ValidationResult result = cons.validate(new Object(), conf);
        Assert.assertFalse(result.isSuccess());
        System.out.println("Message: " + result.getMessage());

        result = cons.validate("", conf);
        Assert.assertFalse(result.isSuccess());
        System.out.println("Message: " + result.getMessage());

        result = cons.validate("ABC", conf);
        Assert.assertFalse(result.isSuccess());
        System.out.println("Message: " + result.getMessage());

        result = cons.validate(null, conf);
        Assert.assertFalse(result.isSuccess());
        System.out.println("Message: " + result.getMessage());

        result = cons.validate(new Long("12"), conf);
        Assert.assertFalse(result.isSuccess());
        System.out.println("Message: " + result.getMessage());

        result = cons.validate(12L, conf);
        Assert.assertFalse(result.isSuccess());
        System.out.println("Message: " + result.getMessage());

        result = cons.validate(12.8, conf);
        Assert.assertFalse(result.isSuccess());
        System.out.println("Message: " + result.getMessage());
    }
View Full Code Here

    public void testValidConstraint() {

        conf.setArgumentValue(RangeConstraint.RANGE_CONSTRAINT_MIN, "-0.5");
        conf.setArgumentValue(RangeConstraint.RANGE_CONSTRAINT_MAX, "100");

        ValidationResult result = cons.validate(12, conf);
        Assert.assertTrue(result.isSuccess());

        result = cons.validate(new Integer("12"), conf);
        Assert.assertTrue(result.isSuccess());

        result = cons.validate("12", conf);
        Assert.assertTrue(result.isSuccess());

        result = cons.validate(0.6, conf);
        Assert.assertTrue(result.isSuccess());

        result = cons.validate(new Float("-0.3"), conf);
        Assert.assertTrue(result.isSuccess());

        result = cons.validate("90.76", conf);
        Assert.assertTrue(result.isSuccess());

    }
View Full Code Here

    public void testInvalidConstraint() {

        conf.setArgumentValue(RangeConstraint.RANGE_CONSTRAINT_MIN, "-0.5");
        conf.setArgumentValue(RangeConstraint.RANGE_CONSTRAINT_MAX, "100");

        ValidationResult result = cons.validate(new Object(), conf);
        Assert.assertFalse(result.isSuccess());
        System.out.println("Message: " + result.getMessage());

        result = cons.validate(null, conf);
        Assert.assertFalse(result.isSuccess());
        System.out.println("Message: " + result.getMessage());

        result = cons.validate("", conf);
        Assert.assertFalse(result.isSuccess());
        System.out.println("Message: " + result.getMessage());

        result = cons.validate("ABC", conf);
        Assert.assertFalse(result.isSuccess());
        System.out.println("Message: " + result.getMessage());

        result = cons.validate(new Long("-100"), conf);
        Assert.assertFalse(result.isSuccess());
        System.out.println("Message: " + result.getMessage());

        result = cons.validate(-0.5, conf);
        Assert.assertFalse(result.isSuccess());
        System.out.println("Message: " + result.getMessage());

        result = cons.validate(100, conf);
        Assert.assertFalse(result.isSuccess());
        System.out.println("Message: " + result.getMessage());


    }
View Full Code Here

    }

    @Test
    public void testValidConstraint(){
     
        ValidationResult result = cons.validate(new Object(), conf);
        Assert.assertTrue(result.isSuccess());

        result = cons.validate("", conf);
        Assert.assertTrue(result.isSuccess());

        result = cons.validate("ABC", conf);
        Assert.assertTrue(result.isSuccess());

        result = cons.validate(new Long("12"), conf);
        Assert.assertTrue(result.isSuccess());

        result = cons.validate(12L, conf);
        Assert.assertTrue(result.isSuccess());

        result = cons.validate(12.8, conf);
        Assert.assertTrue(result.isSuccess());
    }
View Full Code Here

    }

    @Test
    public void testInvalidConstraint(){

        ValidationResult result = cons.validate(null, conf);
        Assert.assertFalse(result.isSuccess());
        System.out.println("Message: "+result.getMessage());

    }
View Full Code Here

TOP

Related Classes of org.drools.factconstraints.client.ValidationResult

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.