use of org.mamute.model.flag.FlagTrigger in project mamute by caelum.
the class FlagTriggerTest method should_trigger_correct_actions.
@Test
public void should_trigger_correct_actions() {
FlagAction neverExecuteAction = mock(FlagAction.class);
FlagAction alwaysExecuteAction = mock(FlagAction.class);
Flaggable flaggable = mock(Flaggable.class);
when(neverExecuteAction.shouldHandle(Mockito.any(Flaggable.class))).thenReturn(false);
when(alwaysExecuteAction.shouldHandle(Mockito.any(Flaggable.class))).thenReturn(true);
FlagTrigger flagTrigger = new FlagTrigger(Arrays.asList(neverExecuteAction, alwaysExecuteAction));
flagTrigger.fire(flaggable);
verify(neverExecuteAction, never()).fire(flaggable);
verify(alwaysExecuteAction, times(1)).fire(flaggable);
}
Aggregations