### Question:
HQServer { public void stop() { log.info("Stopping HQ server..."); try { engineController.stop(); } catch (Throwable e) { log.error("Error stopping HQ server: " + e, e); return; } return; } @Autowired  HQServer(@Value("#{ systemProperties['server.home'] }") String serverHome,
                    @Value("#{ systemProperties['engine.home'] }") String engineHome,
                    ProcessManager processManager,
                    EmbeddedDatabaseController embeddedDatabaseController,
                    ServerConfigurator serverConfigurator, EngineController engineController,
                    OperatingSystem osInfo, DataSource dataSource); int start(); void stop(); static void main(String[] args);  }### Answer:
@Test public void testStop() throws Exception { EasyMock.expect(engineController.stop()).andReturn(true); replay(); server.stop(); verify(); }
@Test public void testStopErrorStoppingEngine() throws Exception { EasyMock.expect(engineController.stop()).andThrow(new SigarException(EXPECTED_EXCEPTION_MSG)); replay(); server.stop(); verify(); }
@Test public void testStopErrorStoppingBuiltInDB() throws Exception { EasyMock.expect(engineController.stop()).andReturn(true); replay(); server.stop(); verify(); }