### Question:
RoundRobinRelatedContentSearchRequestProcessorHandlerFactory implements RelatedContentSearchRequestProcessorHandlerFactory { @Override public RelatedContentSearchRequestProcessorHandler createHandler(Configuration config, RelatedItemSearchResultsToResponseGateway gateway,RelatedItemSearchExecutorFactory searchExecutorFactory ) { int numberOfSearchProcessors = config.getNumberOfSearchingRequestProcessors(); if(numberOfSearchProcessors==1) { log.debug("Creating Single Search Request Processor"); RelatedItemSearchExecutor searchExecutor = searchExecutorFactory.createSearchExecutor(gateway); return new DisruptorBasedRelatedContentSearchRequestProcessorHandler(gateway,searchExecutor); } else { log.debug("Creating {} Search Request Processor",numberOfSearchProcessors); RelatedItemSearchExecutor[] searchExecutors = new RelatedItemSearchExecutor[numberOfSearchProcessors]; int i = numberOfSearchProcessors; while(i-- !=0) { searchExecutors[i] = searchExecutorFactory.createSearchExecutor(gateway); } return new RoundRobinDisruptorBasedRelatedContentSearchRequestProcessorHandler(gateway,searchExecutors); } } RoundRobinRelatedContentSearchRequestProcessorHandlerFactory(); @Override RelatedContentSearchRequestProcessorHandler createHandler(Configuration config, RelatedItemSearchResultsToResponseGateway gateway,RelatedItemSearchExecutorFactory searchExecutorFactory );  }### Answer:
@Test public void testSingleRelatedContentSearchRequestProcessorHandlerIsCreated() { System.setProperty(ConfigurationConstants.PROPNAME_NUMBER_OF_SEARCHING_REQUEST_PROCESSORS,"1"); Configuration config = new SystemPropertiesConfiguration(); RoundRobinRelatedContentSearchRequestProcessorHandlerFactory factory = new RoundRobinRelatedContentSearchRequestProcessorHandlerFactory(); RelatedContentSearchRequestProcessorHandler handler = factory.createHandler(config,mock(RelatedItemSearchResultsToResponseGateway.class),mock(RelatedItemSearchExecutorFactory.class)); assertTrue(handler instanceof DisruptorBasedRelatedContentSearchRequestProcessorHandler); }
@Test public void testRoundRobinRelatedContentSearchRequestProcessorHandlerIsCreated() { System.setProperty(ConfigurationConstants.PROPNAME_NUMBER_OF_SEARCHING_REQUEST_PROCESSORS,"2"); Configuration config = new SystemPropertiesConfiguration(); RoundRobinRelatedContentSearchRequestProcessorHandlerFactory factory = new RoundRobinRelatedContentSearchRequestProcessorHandlerFactory(); RelatedContentSearchRequestProcessorHandler handler = factory.createHandler(config,mock(RelatedItemSearchResultsToResponseGateway.class),mock(RelatedItemSearchExecutorFactory.class)); assertTrue(handler instanceof RoundRobinDisruptorBasedRelatedContentSearchRequestProcessorHandler); }