@Test void testStartDouble() { this.runnableServiceExtension.deploy(); this.runnableServiceExtension.start(); assertThrows(IllegalStateException.class, () -> this.runnableServiceExtension.start()); }
public void start() { if (this.running) throw new IllegalStateException("Service Manager is already running"); for (ServiceDescription<?> runnableService : this.serviceDescriptions) { RunnableService service = (RunnableService) this.serviceLocator.getService(runnableService).getService(); this.runningServices.add(service); } this.runningServices.forEach(RunnableService::start); this.running = true; }
ServiceManagerImpl { public void start() { if (this.running) throw new IllegalStateException("Service Manager is already running"); for (ServiceDescription<?> runnableService : this.serviceDescriptions) { RunnableService service = (RunnableService) this.serviceLocator.getService(runnableService).getService(); this.runningServices.add(service); } this.runningServices.forEach(RunnableService::start); this.running = true; } }
ServiceManagerImpl { public void start() { if (this.running) throw new IllegalStateException("Service Manager is already running"); for (ServiceDescription<?> runnableService : this.serviceDescriptions) { RunnableService service = (RunnableService) this.serviceLocator.getService(runnableService).getService(); this.runningServices.add(service); } this.runningServices.forEach(RunnableService::start); this.running = true; }  }
ServiceManagerImpl { public void start() { if (this.running) throw new IllegalStateException("Service Manager is already running"); for (ServiceDescription<?> runnableService : this.serviceDescriptions) { RunnableService service = (RunnableService) this.serviceLocator.getService(runnableService).getService(); this.runningServices.add(service); } this.runningServices.forEach(RunnableService::start); this.running = true; }  void register(ServiceDescription<?> serviceDescription); void start(); void stop(); }
ServiceManagerImpl { public void start() { if (this.running) throw new IllegalStateException("Service Manager is already running"); for (ServiceDescription<?> runnableService : this.serviceDescriptions) { RunnableService service = (RunnableService) this.serviceLocator.getService(runnableService).getService(); this.runningServices.add(service); } this.runningServices.forEach(RunnableService::start); this.running = true; }  void register(ServiceDescription<?> serviceDescription); void start(); void stop();  }