EndFileStopper implements AsyncBatchStopper, InitializingBean { @Override public void afterPropertiesSet() { Assert.state(!"".equals(endMonitoringFileName), LOGGER.getLogMessage( LogId.EAL025056, this.getClass().getSimpleName(), "executor.endMonitoringFile")); LOGGER.info(LogId.IAL025025, endMonitoringFileName); }  @Override boolean canStop(); @Override void afterPropertiesSet();  }
@Test public void testAfterPropertiesSet01() { EndFileStopper endFileStopper = (EndFileStopper) asyncBatchStopper; endFileStopper.afterPropertiesSet(); assertEquals(endFileStopper.endMonitoringFileName, "/tmp/batch_terminate_file"); assertThat(logger.getLoggingEvents(), is(asList(info( "[IAL025025] It will be checked to stop AsyncBatchExecutor at a certain interval. the end monitoring file path:/tmp/batch_terminate_file")))); }
@Test public void testAfterPropertiesSet02() { EndFileStopper endFileStopper = (EndFileStopper) asyncBatchStopper; String tempEndMonitoringFileName = endFileStopper.endMonitoringFileName; endFileStopper.endMonitoringFileName = ""; try { endFileStopper.afterPropertiesSet(); fail(); } catch (IllegalStateException e) { assertEquals(e.getMessage(), "[EAL025056] [Assertion failed] - EndFileStopper requires to set executor.endMonitoringFile. please confirm the settings."); assertThat(logger.getLoggingEvents(), IsNot.not(asList(info( "[IAL025025] It will be checked to stop AsyncBatchExecutor at a certain interval. the end monitoring file path:/tmp/batch_terminate_file")))); } finally { endFileStopper.endMonitoringFileName = tempEndMonitoringFileName; } }