### Question:
FilePresenceValidator implements Validator<IngestionFileEntry> { @Override public boolean isValid(IngestionFileEntry entry, AbstractMessageReport report, ReportStats reportStats, Source source, Map<String, Object> parameters) { boolean valid = true; if (hasPathInName(entry.getFileName())) { report.error(reportStats, new ControlFileSource(source.getResourceId(), entry), BaseMessageCode.BASE_0004, entry.getFileName()); valid = false; } else if (!isInZipFile(entry.getFileName(), parameters)) { report.error(reportStats, new ControlFileSource(source.getResourceId(), entry), BaseMessageCode.BASE_0001, entry.getFileName()); valid = false; } return valid; }  @Override boolean isValid(IngestionFileEntry entry, AbstractMessageReport report, ReportStats reportStats,
            Source source, Map<String, Object> parameters); boolean isInZipFile(String fileName, Map<String, Object> parameters); @Override String getStageName();  }### Answer:
@Test public void testBase004Message() { IngestionFileEntry fe = new IngestionFileEntry("/", FileFormat.CONTROL_FILE, FileType.CONTROL, "subFolder/file.ctl", ""); FilePresenceValidator v = new FilePresenceValidator(); AbstractMessageReport mr = Mockito.spy(new DummyMessageReport()); Assert.assertFalse(v.isValid(fe, mr, new SimpleReportStats(), new JobSource("control"), null)); Mockito.verify(mr, Mockito.atLeastOnce()).error(Mockito.any(ReportStats.class), Mockito.any(Source.class), Mockito.eq(BaseMessageCode.BASE_0004), Mockito.any(Object[].class)); }
@Test public void testBase001Message() { IngestionFileEntry fe = new IngestionFileEntry("/", FileFormat.CONTROL_FILE, FileType.CONTROL, "file.ctl", ""); FilePresenceValidator v = new FilePresenceValidator(); AbstractMessageReport mr = Mockito.spy(new DummyMessageReport()); Assert.assertFalse(v.isValid(fe, mr, new SimpleReportStats(), new JobSource("control"), null)); Mockito.verify(mr, Mockito.atLeastOnce()).error(Mockito.any(Throwable.class), Mockito.any(ReportStats.class), Mockito.any(Source.class), Mockito.eq(BaseMessageCode.BASE_0001), Mockito.any(Object[].class)); }