Created
June 21, 2019 15:51
-
-
Save lucamolteni/0036d6a754bdeb503e050eb1ffb00a9d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
@Ignore("why does this fail in both drl and exec model?") | |
public void testIntegerShort() { | |
String str = | |
"import " + Result.class.getCanonicalName() + ";" + | |
"import " + Person.class.getCanonicalName() + ";" + | |
"rule R when\n" + | |
" $r : Result()\n" + | |
" $markV : Person(name == \"Mark\")\n" + | |
" $olderV : Person(name != \"Mark\", ageAsShort == $markV.age)\n" + | |
"then\n" + | |
" $r.setValue($olderV.getName() + \" is same age as \" + $markV.getName());\n" + | |
"end"; | |
KieSession ksession = getKieSession( str ); | |
Result result = new Result(); | |
ksession.insert( result ); | |
ksession.insert(new Person("Mark", 40)); | |
ksession.insert(new Person("Edson", 35)); | |
ksession.insert(new Person("Mario", 40)); | |
ksession.fireAllRules(); | |
assertEquals("Mario is same age as Mark", result.getValue()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment