ServiceManager { @SafeVarargs public final ServiceManager addServices(final Class<? extends Service>... services) { addServices(services != null ? asList(services) : EMPTY_LIST); return this; }  final ServiceManager addConfiguration(@Nullable final String... configurations); final ServiceManager addConfiguration(final Collection<String> configuration); @SafeVarargs final ServiceManager addModules(final Class<? extends Module>... modules); final ServiceManager addModules(final Collection<Class<? extends Module>> modules); @SafeVarargs final ServiceManager addServices(final Class<? extends Service>... services); final ServiceManager addServices(final Collection<Class<? extends Service>> services); void start(); void stop();  }
@Test public void addService() throws Exception { serviceManager.addServices(TestService.class); ServiceResource<Class<? extends Service>> service = getInternalState(serviceManager, "services"); Collection<Class<? extends Service>> resources = service.getResources(); assertThat(resources.size(), is(1)); assertThat(TestService.class, isIn(resources)); }
@Test public void addServices() throws Exception { serviceManager.addServices(TestService.class, AnotherTestService.class); ServiceResource<Class<? extends Service>> service = getInternalState(serviceManager, "services"); Collection<Class<? extends Service>> resources = service.getResources(); assertThat(resources.size(), is(2)); assertThat(TestService.class, isIn(resources)); assertThat(AnotherTestService.class, isIn(resources)); }
@Test public void addNullService() throws Exception { serviceManager.addServices((Class<? extends Service>[]) null); ServiceResource<Class<? extends Service>> service = getInternalState(serviceManager, "services"); Collection<Class<? extends Service>> resources = service.getResources(); assertThat(resources, is(empty())); }
@Test public void addEmptyService() throws Exception { serviceManager.addServices(); ServiceResource<Class<? extends Service>> service = getInternalState(serviceManager, "services"); Collection<Class<? extends Service>> resources = service.getResources(); assertThat(resources, is(empty())); }