### Question:
CompositeService extends AbstractService { protected void serviceStop() throws Exception { int numOfServicesToStop = serviceList.size(); if (LOG.isDebugEnabled()) { LOG.debug(getName() + ": stopping services, size=" + numOfServicesToStop); } stop(numOfServicesToStop, STOP_ONLY_STARTED_SERVICES); super.serviceStop(); } CompositeService(String name); List<Service> getServices();  }### Answer:
@Test public void testServiceStop() { ServiceManager serviceManager = new ServiceManager("ServiceManager"); for (int i = 0; i < NUM_OF_SERVICES; i++) { CompositeServiceImpl service = new CompositeServiceImpl(i); if (i == FAILED_SERVICE_SEQ_NUMBER) { service.setThrowExceptionOnStop(true); } serviceManager.addTestService(service); } CompositeServiceImpl[] services = serviceManager.getServices().toArray( new CompositeServiceImpl[0]); Configuration conf = new Configuration(); serviceManager.init(conf); serviceManager.start(); try { serviceManager.stop(); } catch (ServiceTestRuntimeException e) { } assertInState(STATE.STOPPED, services); }