@Test public void shouldReturnFalseIfAPreProcessorFails() { Table table = tableWithPhase(Playing, 100L); when(wallet.getTable()).thenReturn(table); EventPreprocessor processor3 = mockEventPreprocessor(true); underTest.setEventPreInitialisationProcessors( Arrays.asList(mockEventPreprocessor(true), mockEventPreprocessor(false), processor3)); boolean successful = underTest.runPreProcessors(gameRules, defaultEventContext()); assertFalse(successful); assertEquals(Long.valueOf(100), table.getGameId()); verifyZeroInteractions(processor3); }
@Test public void shouldRunAllPreProcessorsBeforeExecuting() { Table table = tableWithPhase(Playing, 100L); when(wallet.getTable()).thenReturn(table); EventPreprocessor processor1 = mockEventPreprocessor(true); EventPreprocessor processor2 = mockEventPreprocessor(true); EventPreprocessor processor3 = mockEventPreprocessor(true); underTest.setEventPreInitialisationProcessors(toList(processor2, processor3, processor1)); underTest.runPreProcessors(gameRules, defaultEventContext()); verify(processor1).preprocess(any(com.yazino.game.api.ScheduledEvent.class), eq(table)); verify(processor2).preprocess(any(com.yazino.game.api.ScheduledEvent.class), eq(table)); verify(processor3).preprocess(any(com.yazino.game.api.ScheduledEvent.class), eq(table)); }