use of org.drools.modelcompiler.domain.InternationalAddress in project drools by kiegroup.
the class OOPathTest method testSimpleOOPathCast2.
@Test
public void testSimpleOOPathCast2() {
final String str = "import org.drools.modelcompiler.domain.*;\n" + "global java.util.List list\n" + "\n" + "rule R when\n" + " Man( $name : name, $italy: /address#InternationalAddress[ state == \"Italy\" ] )\n" + "then\n" + " list.add( $name );\n" + "end\n";
KieSession ksession = getKieSession(str);
final List<String> list = new ArrayList<>();
ksession.setGlobal("list", list);
final Man bob = new Man("Bob", 40);
bob.setAddress(new InternationalAddress("Via Verdi", "Italy"));
ksession.insert(bob);
ksession.fireAllRules();
Assertions.assertThat(list).containsExactlyInAnyOrder("Bob");
}
Aggregations