@Test public void testInvalidProcessControlFile() throws IOException, SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { Resource ctlFileResource = new ClassPathResource(invalidControlFile); File ctlFile = ctlFileResource.getFile(); AbstractMessageReport messageReport = Mockito.mock(AbstractMessageReport.class); PrivateAccessor.setField(validationController, "messageReport", messageReport); ReportStats reportStats = Mockito.mock(ReportStats.class); Mockito.when(reportStats.hasErrors()).thenReturn(false); validationController.processControlFile(ctlFile.getParentFile(), ctlFile.getName(), reportStats); Mockito.verify(messageReport).error(Matchers.any(Throwable.class), Matchers.any(ReportStats.class), Matchers.any(Source.class), Matchers.eq(ValidationMessageCode.VALIDATION_0010), Matchers.anyString()); }
public void processControlFile(File parentDirectoryOrZipFile, String ctlFile, ReportStats reportStats) { Source source = new ControlFileSource(ctlFile); messageReport.info(reportStats, source, ValidationMessageCode.VALIDATION_0007, ctlFile); try { ControlFile cfile = ControlFile.parse(parentDirectoryOrZipFile.getAbsolutePath(), ctlFile, messageReport); controlFilevalidator.isValid(cfile, messageReport, reportStats, source, null); processValidators(cfile, reportStats); } catch (IOException e) { messageReport.error(e, reportStats, source, ValidationMessageCode.VALIDATION_0008); } catch (SubmissionLevelException exception) { messageReport.error(exception, reportStats, source, ValidationMessageCode.VALIDATION_0010, exception.getMessage()); } finally { messageReport.info(reportStats, source, ValidationMessageCode.VALIDATION_0009, ctlFile); } }
ValidationController { public void processControlFile(File parentDirectoryOrZipFile, String ctlFile, ReportStats reportStats) { Source source = new ControlFileSource(ctlFile); messageReport.info(reportStats, source, ValidationMessageCode.VALIDATION_0007, ctlFile); try { ControlFile cfile = ControlFile.parse(parentDirectoryOrZipFile.getAbsolutePath(), ctlFile, messageReport); controlFilevalidator.isValid(cfile, messageReport, reportStats, source, null); processValidators(cfile, reportStats); } catch (IOException e) { messageReport.error(e, reportStats, source, ValidationMessageCode.VALIDATION_0008); } catch (SubmissionLevelException exception) { messageReport.error(exception, reportStats, source, ValidationMessageCode.VALIDATION_0010, exception.getMessage()); } finally { messageReport.info(reportStats, source, ValidationMessageCode.VALIDATION_0009, ctlFile); } } }
ValidationController { public void processControlFile(File parentDirectoryOrZipFile, String ctlFile, ReportStats reportStats) { Source source = new ControlFileSource(ctlFile); messageReport.info(reportStats, source, ValidationMessageCode.VALIDATION_0007, ctlFile); try { ControlFile cfile = ControlFile.parse(parentDirectoryOrZipFile.getAbsolutePath(), ctlFile, messageReport); controlFilevalidator.isValid(cfile, messageReport, reportStats, source, null); processValidators(cfile, reportStats); } catch (IOException e) { messageReport.error(e, reportStats, source, ValidationMessageCode.VALIDATION_0008); } catch (SubmissionLevelException exception) { messageReport.error(exception, reportStats, source, ValidationMessageCode.VALIDATION_0010, exception.getMessage()); } finally { messageReport.info(reportStats, source, ValidationMessageCode.VALIDATION_0009, ctlFile); } }  }
ValidationController { public void processControlFile(File parentDirectoryOrZipFile, String ctlFile, ReportStats reportStats) { Source source = new ControlFileSource(ctlFile); messageReport.info(reportStats, source, ValidationMessageCode.VALIDATION_0007, ctlFile); try { ControlFile cfile = ControlFile.parse(parentDirectoryOrZipFile.getAbsolutePath(), ctlFile, messageReport); controlFilevalidator.isValid(cfile, messageReport, reportStats, source, null); processValidators(cfile, reportStats); } catch (IOException e) { messageReport.error(e, reportStats, source, ValidationMessageCode.VALIDATION_0008); } catch (SubmissionLevelException exception) { messageReport.error(exception, reportStats, source, ValidationMessageCode.VALIDATION_0010, exception.getMessage()); } finally { messageReport.info(reportStats, source, ValidationMessageCode.VALIDATION_0009, ctlFile); } }  void doValidation(File path); void processValidators(ControlFile cfile, ReportStats reportStats); void processZip(File zipFile, ReportStats reportStats); void processControlFile(File parentDirectoryOrZipFile, String ctlFile, ReportStats reportStats); Handler<Resource, String> getZipFileHandler(); void setZipFileHandler(Handler<Resource, String> zipFileHandler); ComplexValidator<IngestionFileEntry> getComplexValidator(); void setComplexValidator(ComplexValidator<IngestionFileEntry> complexValidator); Validator<ControlFile> getControlFilevalidator(); void setControlFilevalidator(Validator<ControlFile> controlFilevalidator); AbstractMessageReport getMessageReport(); void setMessageReport(AbstractMessageReport messageReport); }
ValidationController { public void processControlFile(File parentDirectoryOrZipFile, String ctlFile, ReportStats reportStats) { Source source = new ControlFileSource(ctlFile); messageReport.info(reportStats, source, ValidationMessageCode.VALIDATION_0007, ctlFile); try { ControlFile cfile = ControlFile.parse(parentDirectoryOrZipFile.getAbsolutePath(), ctlFile, messageReport); controlFilevalidator.isValid(cfile, messageReport, reportStats, source, null); processValidators(cfile, reportStats); } catch (IOException e) { messageReport.error(e, reportStats, source, ValidationMessageCode.VALIDATION_0008); } catch (SubmissionLevelException exception) { messageReport.error(exception, reportStats, source, ValidationMessageCode.VALIDATION_0010, exception.getMessage()); } finally { messageReport.info(reportStats, source, ValidationMessageCode.VALIDATION_0009, ctlFile); } }  void doValidation(File path); void processValidators(ControlFile cfile, ReportStats reportStats); void processZip(File zipFile, ReportStats reportStats); void processControlFile(File parentDirectoryOrZipFile, String ctlFile, ReportStats reportStats); Handler<Resource, String> getZipFileHandler(); void setZipFileHandler(Handler<Resource, String> zipFileHandler); ComplexValidator<IngestionFileEntry> getComplexValidator(); void setComplexValidator(ComplexValidator<IngestionFileEntry> complexValidator); Validator<ControlFile> getControlFilevalidator(); void setControlFilevalidator(Validator<ControlFile> controlFilevalidator); AbstractMessageReport getMessageReport(); void setMessageReport(AbstractMessageReport messageReport);  }