EndFileStopper implements AsyncBatchStopper, InitializingBean { @Override public boolean canStop() { File f = new File(endMonitoringFileName); boolean isExist = f.exists(); if (isExist) { LOGGER.info(LogId.IAL025011, endMonitoringFileName); } return isExist; }  @Override boolean canStop(); @Override void afterPropertiesSet();  }
@Test public void testCanStop001() throws IOException { Files.createFile(Paths.get("/tmp/batch_terminate_file")); try { logger.clear(); assertTrue(asyncBatchStopper.canStop()); } finally { Files.deleteIfExists(Paths.get("/tmp/batch_terminate_file")); } assertThat(logger.getLoggingEvents(), is(asList(info( "[IAL025011] Detected the end file. This AsyncBatchExecutor processing will complete. path:/tmp/batch_terminate_file")))); }
@Test public void testCanStop002() { assertFalse(asyncBatchStopper.canStop()); assertThat(logger.getLoggingEvents(), IsNot.not(asList(info( "[IAL025011] Detected the end file. This AsyncBatchExecutor processing will complete. path:/tmp/batch_terminate_file")))); }