ValidationTaskRunner { void run(String policy, String report, UploadedFile uploadedFile) throws InterruptedException { Map<ResultType, ValidationService> serviceMap = getValidationServiceMap(); ExecutorService executorService = Executors.newFixedThreadPool(serviceMap.size()); serviceMap.entrySet().forEach(entry -> executorService.submit(() -> validateFile(entry.getValue(), entry.getKey(), report, uploadedFile, policy))); executorService.shutdown(); executorService.awaitTermination(2, TimeUnit.MINUTES); }  @Autowired @Qualifier(value = SivaServiceType.JSON_SERVICE) void setJsonValidationService(final ValidationService jsonValidationService); @Autowired @Qualifier(value = SivaServiceType.SOAP_SERVICE) void setSoapValidationService(ValidationService soapValidationService);  }
@Test public void validationServiceThrowsExceptionLogMessageIsWritten() throws Exception { given(validationServiceJson.validateDocument(any(String.class), any(String.class), any(UploadedFile.class))).willThrow(new IOException()); validationTaskRunner.run("", "", new UploadedFile()); verify(mockAppender).doAppend(captorLoggingEvent.capture()); final LoggingEvent loggingEvent = captorLoggingEvent.getValue(); assertThat(loggingEvent.getLevel()).isEqualTo(Level.WARN); assertThat(loggingEvent.getFormattedMessage()).contains("Uploaded file validation failed with error"); }