use of org.drools.compiler.lang.descr.ConstraintConnectiveDescr in project drools by kiegroup.
the class MVELDumperTest method testDumpExcludes2.
@Test
public void testDumpExcludes2() throws Exception {
String input = "list not excludes \"b\"";
String expected = "list contains \"b\"";
ConstraintConnectiveDescr descr = parse(input);
String result = dumper.dump(descr);
assertEquals(expected, result);
}
use of org.drools.compiler.lang.descr.ConstraintConnectiveDescr in project drools by kiegroup.
the class MVELDumperTest method testDumpContains2.
@Test
public void testDumpContains2() throws Exception {
String input = "list not contains \"b\"";
String expected = "!( list contains \"b\" )";
ConstraintConnectiveDescr descr = parse(input);
String result = dumper.dump(descr);
assertEquals(expected, result);
}
use of org.drools.compiler.lang.descr.ConstraintConnectiveDescr in project drools by kiegroup.
the class MVELDumperTest method testDumpMatches2.
@Test
public void testDumpMatches2() throws Exception {
String input = "type.toString matches 'something\\swith\\tsingle escapes'";
String expected = "type.toString ~= \"something\\swith\\tsingle escapes\"";
ConstraintConnectiveDescr descr = parse(input);
String result = dumper.dump(descr);
assertEquals(expected, result);
}
use of org.drools.compiler.lang.descr.ConstraintConnectiveDescr in project drools by kiegroup.
the class MVELDumperTest method testDumpComplex.
@Test
public void testDumpComplex() throws Exception {
String input = "a ( > 60 && < 70 ) || ( > 50 && < 55 ) && a3 == \"black\" || a == 40 && a3 == \"pink\" || a == 12 && a3 == \"yellow\" || a3 == \"blue\"";
String expected = "( ( a > 60 && a < 70 || a > 50 && a < 55 ) && a3 == \"black\" || a == 40 && a3 == \"pink\" || a == 12 && a3 == \"yellow\" || a3 == \"blue\" )";
ConstraintConnectiveDescr descr = parse(input);
String result = dumper.dump(descr);
assertEquals(expected, result);
}
use of org.drools.compiler.lang.descr.ConstraintConnectiveDescr in project drools by kiegroup.
the class MVELDumperTest method testDumpBindingsWithRestriction.
@Test
public void testDumpBindingsWithRestriction() throws Exception {
String input = "$x : age > 10 && < 20 || > 30";
String expected = "( age > 10 && age < 20 || age > 30 )";
ConstraintConnectiveDescr descr = parse(input);
MVELDumperContext ctx = new MVELDumperContext();
String result = dumper.dump(descr, ctx);
assertEquals(expected, result);
assertEquals(1, ctx.getBindings().size());
BindingDescr bind = ctx.getBindings().get(0);
assertEquals("$x", bind.getVariable());
assertEquals("age", bind.getExpression());
}
Aggregations