private GameHost gameHost(final GameRepository mockGameRepository) { final DestinationFactory destinationFactory = new DestinationFactory(); GameInitialiser gameInitialiser = new GameInitialiser(); gameInitialiser.setEventPreInitialisationProcessors( Arrays.asList( (EventPreprocessor) new TableClosedPreprocessor(destinationFactory), new GameDisabledPreprocessor(mockGameRepository, destinationFactory))); gameInitialiser.setCommandPreInitialisationProcessors( Arrays.asList( new TableClosedPreprocessor(destinationFactory), new TournamentPlayerValidator(destinationFactory), new GameDisabledPreprocessor(mockGameRepository, destinationFactory))); gameInitialiser.setPostInitialisationProcessors( Arrays.asList( new PlayerNotificationPostProcessor(destinationFactory, mockGameRepository), new ObserverNotificationPostprocessor(mockGameRepository, destinationFactory), new NotifyLocationChangesPostprocessor( mockGameRepository, playerRepository, chatRepository, locationService), new TableUpdatePostprocessor(mockGameRepository, timeSource))); GameEventExecutor eventExecutor = new GameEventExecutor( mockGameRepository, auditor, bufferedGameHostWalletFactory, novomaticRequestService); eventExecutor.setGameInitialiser(gameInitialiser); GameCommandExecutor commandExecutor = new GameCommandExecutor( mockGameRepository, auditor, bufferedGameHostWalletFactory, novomaticRequestService, playerRepository, destinationFactory); commandExecutor.setGameInitialiser(gameInitialiser); commandExecutor.setUuidSource(uuidSource); final GameHost gameHost = new GameHost( auditor, mockGameRepository, destinationFactory, playerRepository, bufferedGameHostWalletFactory, novomaticRequestService, uuidSource, eventExecutor, commandExecutor, gameInitialiser); gameHost.getEventExecutor().setGameInitialiser(gameInitialiser); gameHost.getCommandExecutor().setGameInitialiser(gameInitialiser); // this setup is a nasty side-effect of splitting initialisation of these classes out of the // game host. // On the upside, it means the GH tests can in future just test the GH itself. gameHost .getEventExecutor() .setPreExecutionProcessors( Arrays.asList( new AuditPreprocessor(auditor), new TableReadyEventPreprocessor(mockGameRepository), new NopEventPreprocessor(), new EventStillValidPreprocessor())); gameHost .getEventExecutor() .setPostExecutionProcessors( Arrays.asList( new GameCompletePostprocessor(mockGameRepository, timeSource), new NotifyLocationChangesPostprocessor( mockGameRepository, playerRepository, chatRepository, locationService), new PlayerNotificationPostProcessor(destinationFactory, mockGameRepository), new ObserverNotificationPostprocessor(mockGameRepository, destinationFactory), new GameDisabledPostprocessor(mockGameRepository, destinationFactory), new TableUpdatePostprocessor(mockGameRepository, timeSource), new GameXPPublishingPostProcessor(playerStatisticEventsPublisher), new TableAuditPostprocessor(auditor, gameCompletePublisher, mockGameRepository))); gameHost .getCommandExecutor() .setPreExecutionProcessors( Arrays.asList( new AuditPreprocessor(auditor), new TableClosingPreprocessor(destinationFactory), new InitialGetStatusPreprocessor(auditor, destinationFactory), new AcknowledgementPreprocessor())); gameHost .getCommandExecutor() .setPostExecutionProcessors( Arrays.asList( new GameCompletePostprocessor(mockGameRepository, timeSource), new NotifyLocationChangesPostprocessor( mockGameRepository, playerRepository, chatRepository, locationService), new PlayerNotificationPostProcessor(destinationFactory, mockGameRepository), new ObserverNotificationPostprocessor(mockGameRepository, destinationFactory), new GameDisabledPostprocessor(mockGameRepository, destinationFactory), new TableUpdatePostprocessor(mockGameRepository, timeSource), new GameXPPublishingPostProcessor(playerStatisticEventsPublisher), new TableAuditPostprocessor(auditor, gameCompletePublisher, mockGameRepository))); gameHost.setPlayerRemovalProcessors( Arrays.asList( (PlayerRemovalProcessor) new NotifyLocationChangesPostprocessor( mockGameRepository, playerRepository, chatRepository, locationService))); return gameHost; }