private void enterControlLoop() throws IOException, ServiceAlreadyStartedException { logger.log(Level.INFO, "Starting daemon control server ..."); controlServer = new ControlServer(); controlServer.enterLoop(); // This blocks! }
@Test public void testEnterLoop() throws IOException, ServiceAlreadyStartedException { // invoke method ctrlServer.enterLoop(); // verify interactions verify(ctrlFile).delete(); verify(ctrlFile).createNewFile(); verify(ctrlFile).deleteOnExit(); verify(ctrlFileTailer).run(); }