public void completeDefaults(Props props) {
    // init string properties
    for (Map.Entry<Object, Object> entry : defaults().entrySet()) {
      props.setDefault(entry.getKey().toString(), entry.getValue().toString());
    }

    boolean clusterEnabled = props.valueAsBoolean(CLUSTER_ENABLED.getKey(), false);
    if (!clusterEnabled) {
      props.setDefault(SEARCH_HOST.getKey(), InetAddress.getLoopbackAddress().getHostAddress());
      props.setDefault(SEARCH_PORT.getKey(), "9001");
      fixPortIfZero(props, Property.SEARCH_HOST.getKey(), SEARCH_PORT.getKey());
      fixEsTransportPortIfNull(props);
    }
  }
@Test
  public void defaults_throws_exception_on_same_property_defined_more_than_once_in_extensions() {
    Props p = new Props(new Properties());
    when(serviceLoaderWrapper.load()).thenReturn(ImmutableSet.of(new FakeExtension1(), new FakeExtension2()));

    assertThatThrownBy(() -> processProperties.completeDefaults(p))
      .isInstanceOf(IllegalStateException.class)
      .hasMessage("Configuration error: property definition named 'sonar.some.property2' found in multiple extensions.");
  }