ControlServer implements TailerListener { public void enterLoop() throws IOException, ServiceAlreadyStartedException { File userAppDir = UserConfig.getUserConfigDir(); userAppDir.mkdirs(); controlFile.delete(); controlFile.createNewFile(); controlFile.deleteOnExit(); logger.log(Level.INFO, "Monitoring control file for commands at " + controlFile + " ..."); logger.log(Level.INFO, " (Note: This is a blocking operation. The 'main' thread is now blocked until '" + ControlCommand.SHUTDOWN + "' is received.)"); controlFileTailer.run(); } ControlServer(); @Deprecated  ControlServer(File ctrlFile, Tailer ctrTailer, LocalEventBus eventBus); void enterLoop(); @Override void fileNotFound(); @Override void handle(String command); @Override void handle(Exception e); @Override void init(Tailer tailer); @Override void fileRotated();  }
@Test public void testEnterLoop() throws IOException, ServiceAlreadyStartedException { ctrlServer.enterLoop(); verify(ctrlFile).delete(); verify(ctrlFile).createNewFile(); verify(ctrlFile).deleteOnExit(); verify(ctrlFileTailer).run(); }