@Test
public void testMergeServiceProperties() throws Exception {

  // Given
  ServiceInfo serviceInfo = new ServiceInfo();
  ServiceInfo parentServiceInfo = new ServiceInfo();
  ServicePropertyInfo p1 = new ServicePropertyInfo();
  p1.setName("P1");
  p1.setValue("V1");
  ServicePropertyInfo p2 = new ServicePropertyInfo();
  p2.setName("P2");
  p2.setValue("V2");
  ServicePropertyInfo p2Override = new ServicePropertyInfo();
  p2Override.setName("P2");
  p2Override.setValue("V2_OVERRIDE");
  ServicePropertyInfo p3 = new ServicePropertyInfo();
  p3.setName("P3");
  p3.setValue("V3");
  List<ServicePropertyInfo> parentServicePropertyList = Lists.newArrayList(p1, p2);
  parentServiceInfo.setServicePropertyList(parentServicePropertyList);
  List<ServicePropertyInfo> servicePropertyList = Lists.newArrayList(p2Override, p3);
  serviceInfo.setServicePropertyList(servicePropertyList);
  // When
  ServiceModule serviceModule = resolveService(serviceInfo, parentServiceInfo);
  // Then
  List<ServicePropertyInfo> expectedPropertyList = Lists.newArrayList(p1, p2Override, p3);
  Map<String, String> expectedServiceProperties = ImmutableMap.<String, String>builder()
    .put("P1", "V1")
    .put("P2", "V2_OVERRIDE")
    .put("P3", "V3")
    .put(ServiceInfo.DEFAULT_SERVICE_INSTALLABLE_PROPERTY)
    .put(ServiceInfo.DEFAULT_SERVICE_MANAGED_PROPERTY)
    .put(ServiceInfo.DEFAULT_SERVICE_MONITORED_PROPERTY)
    .build();
  List<ServicePropertyInfo> actualPropertyList = serviceModule.getModuleInfo().getServicePropertyList();
  assertTrue(actualPropertyList.containsAll(expectedPropertyList) && expectedPropertyList.containsAll(actualPropertyList));
  assertEquals(expectedServiceProperties, serviceModule.getModuleInfo().getServiceProperties());
}