Search in sources :

Example 1 with TestEvent

use of org.drools.compiler.integrationtests.facts.TestEvent in project drools by kiegroup.

the class StarImportTest method starImportedFactAlsoDeclaredInDRL.

/**
 * Tests that rule fires if given a fact that is imported using
 * "star" import, while it is also declared in DRL.
 */
@Test
public void starImportedFactAlsoDeclaredInDRL() throws Exception {
    AgendaEventListener ael = mock(AgendaEventListener.class);
    ksession.addEventListener(ael);
    ksession.insert(new TestEvent("event 1"));
    ksession.fireAllRules();
    // the rule should have fired exactly once
    verify(ael, times(1)).afterMatchFired(any(AfterMatchFiredEvent.class));
}
Also used : TestEvent(org.drools.compiler.integrationtests.facts.TestEvent) AgendaEventListener(org.kie.api.event.rule.AgendaEventListener) AfterMatchFiredEvent(org.kie.api.event.rule.AfterMatchFiredEvent) Test(org.junit.Test)

Aggregations

TestEvent (org.drools.compiler.integrationtests.facts.TestEvent)1 Test (org.junit.Test)1 AfterMatchFiredEvent (org.kie.api.event.rule.AfterMatchFiredEvent)1 AgendaEventListener (org.kie.api.event.rule.AgendaEventListener)1