@Test
public void testResolve_RequiredServices() throws Exception {

  List<String> requiredServices = new ArrayList<String>();
  requiredServices.add("foo");
  requiredServices.add("bar");
  // specified in child only
  ServiceInfo info = new ServiceInfo();
  ServiceInfo parentInfo = new ServiceInfo();
  info.setRequiredServices(requiredServices);
  ServiceModule service = resolveService(info, parentInfo);
  assertEquals(requiredServices, service.getModuleInfo().getRequiredServices());
  // specified in parent only
  info.setRequiredServices(null);
  parentInfo.setRequiredServices(requiredServices);
  service = resolveService(info, parentInfo);
  assertEquals(requiredServices, service.getModuleInfo().getRequiredServices());
  // specified in both
  info.setRequiredServices(requiredServices);
  parentInfo.setRequiredServices(Collections.singletonList("other"));
  service = resolveService(info, parentInfo);
  assertEquals(requiredServices, service.getModuleInfo().getRequiredServices());
  // not set in either
  info.setRequiredServices(null);
  parentInfo.setRequiredServices(null);
  service = resolveService(info, parentInfo);
  assertTrue(service.getModuleInfo().getRequiredServices().isEmpty());
}