@Test
public void listenerShouldBeInvokedBeforeCheckingRules() {

    // Given
    when(rule1.evaluate(facts)).thenReturn(true);
    when(ruleListener.beforeEvaluate(rule1, facts)).thenReturn(true);
    DefaultRulesEngine rulesEngine = new DefaultRulesEngine();
    rulesEngine.registerRuleListener(ruleListener);
    rules.register(rule1);
    // When
    rulesEngine.check(rules, facts);
    // Then
    verify(ruleListener).beforeEvaluate(rule1, facts);
}