### Question:
AppServerStartup implements PostConstruct, ModuleStartup { @Override public synchronized void stop() { state.set(State.SHUTTING_DOWN); if(env.getStatus() == ServerEnvironment.Status.stopped) { logger.fine("Already stopped, so just returning"); return; } env.setStatus(ServerEnvironment.Status.stopping); try { events.send(new Event(EventTypes.PREPARE_SHUTDOWN), false); } catch (Exception e) { logger.log(Level.SEVERE, KernelLoggerInfo.exceptionDuringShutdown, e); } try { proceedTo(InitRunLevel.VAL); } catch (Exception e) { logger.log(Level.SEVERE, KernelLoggerInfo.exceptionDuringShutdown, e); } env.setStatus(ServerEnvironment.Status.stopped); try { events.send(new Event(EventTypes.SERVER_SHUTDOWN), false); } catch (Exception e) { logger.log(Level.SEVERE, KernelLoggerInfo.exceptionDuringShutdown, e); } try { runLevelController.proceedTo(0); } catch (Exception e) { logger.log(Level.SEVERE, KernelLoggerInfo.exceptionDuringShutdown, e); } logger.info(KernelLoggerInfo.shutdownFinished); state.set(State.SHUT_DOWN); if (serverThread!=null) { synchronized (serverThread) { serverThread.notify(); } try { serverThread.join(0); } catch (InterruptedException e) { throw new RuntimeException(e); } } }  @Override @Inject void setStartupContext(StartupContext context); @Override void postConstruct(); @Override synchronized void start(); boolean run(); static void printModuleStatus(ModulesRegistry registry, Level level); @Override synchronized void stop();  }### Answer:
@Test @Ignore public void testRunLevelServices() { listFutures.add(new TestFuture()); listFutures.add(new TestFuture()); listFutures.add(new TestFuture()); testRunAppServerStartup(); Assert.assertTrue(as.env.getStatus() == ServerEnvironment.Status.started); Assert.assertEquals(2, results.getListEvents().size()); Assert.assertEquals(EventTypes.SERVER_STARTUP, results.getListEvents().get(0)); Assert.assertEquals(EventTypes.SERVER_READY, results.getListEvents().get(1)); Assert.assertTrue(results.isConstructed(TestInitRunLevelService.class, InitRunLevel.VAL)); Assert.assertTrue(results.isConstructed(TestStartupService.class, StartupRunLevel.VAL)); Assert.assertTrue(results.isConstructed(TestStartupRunLevelService.class, StartupRunLevel.VAL)); Assert.assertTrue(results.isConstructed(TestPostStartupRunLevelService.class, PostStartupRunLevel.VAL)); as.stop(); Assert.assertFalse(as.env.getStatus() == ServerEnvironment.Status.started); Assert.assertEquals(4, results.getListEvents().size()); Assert.assertEquals(EventTypes.PREPARE_SHUTDOWN, results.getListEvents().get(2)); Assert.assertEquals(EventTypes.SERVER_SHUTDOWN, results.getListEvents().get(3)); Assert.assertTrue(results.isDestroyed(TestPostStartupRunLevelService.class, PostStartupRunLevel.VAL)); Assert.assertTrue(results.isDestroyed(TestStartupService.class, StartupRunLevel.VAL)); Assert.assertTrue(results.isDestroyed(TestStartupRunLevelService.class, StartupRunLevel.VAL)); Assert.assertTrue(results.isDestroyed(TestInitRunLevelService.class, InitRunLevel.VAL)); }