final RuleRuntimeEventListener wmeListener = mock( RuleRuntimeEventListener.class );
ksession.addEventListener( wmeListener );
// listener will be notified of both facts insertion
ksession.insert( new Cheese( "stilton" ) );
ksession.insert( wmeListener );
// firing rules will remove listener
ksession.fireAllRules();
// inserting another object into the working memory, listener should NOT be notified,
// since it is no longer listening.
ksession.insert( new Cheese( "brie" ) );
verify( wmeListener,
times( 2 ) ).objectInserted( any( org.kie.api.event.rule.ObjectInsertedEvent.class ) );
}