### Question:
NetworkConfig { public String getAdvertisedIp() { return resolveAnyLocalAddress(advertisedIp.orElse(networkInterface)); } NetworkConfig(
      final PrivKey privateKey,
      final String networkInterface,
      final Optional<String> advertisedIp,
      final int listenPort,
      final OptionalInt advertisedPort,
      final List<String> staticPeers,
      final boolean isDiscoveryEnabled,
      final List<String> bootnodes,
      final TargetPeerRange targetPeerRange,
      final int targetSubnetSubscriberCount);  NetworkConfig(
      final PrivKey privateKey,
      final String networkInterface,
      final Optional<String> advertisedIp,
      final int listenPort,
      final OptionalInt advertisedPort,
      final List<String> staticPeers,
      final boolean isDiscoveryEnabled,
      final List<String> bootnodes,
      final TargetPeerRange targetPeerRange,
      final int targetSubnetSubscriberCount,
      final GossipConfig gossipConfig,
      final WireLogsConfig wireLogsConfig); void validateListenPortAvailable(); PrivKey getPrivateKey(); String getNetworkInterface(); String getAdvertisedIp(); int getListenPort(); int getAdvertisedPort(); List<String> getStaticPeers(); boolean isDiscoveryEnabled(); List<String> getBootnodes(); TargetPeerRange getTargetPeerRange(); int getTargetSubnetSubscriberCount(); GossipConfig getGossipConfig(); WireLogsConfig getWireLogsConfig();  }### Answer:
@Test void getAdvertisedIp_shouldUseAdvertisedAddressWhenSet() { final String expected = "1.2.3.4"; advertisedIp = Optional.of(expected); assertThat(createConfig().getAdvertisedIp()).isEqualTo(expected); }
@Test void getAdvertisedIp_shouldResolveAnyLocalAdvertisedAddress() { advertisedIp = Optional.of("0.0.0.0"); assertThat(createConfig().getAdvertisedIp()).isNotEqualTo("0.0.0.0"); }
@Test void getAdvertisedIp_shouldReturnInterfaceIpWhenNotSet() { listenIp = "127.0.0.1"; assertThat(createConfig().getAdvertisedIp()).isEqualTo(listenIp); }
@Test void getAdvertisedIp_shouldResolveLocalhostIpWhenInterfaceIpIsAnyLocal() { listenIp = "0.0.0.0"; assertThat(createConfig().getAdvertisedIp()).isNotEqualTo("0.0.0.0"); }
@Test void getAdvertisedIp_shouldResolveLocalhostIpWhenInterfaceIpIsAnyLocalIpv6() { listenIp = "::0"; final String result = createConfig().getAdvertisedIp(); assertThat(result).isNotEqualTo("::0"); assertThat(result).isNotEqualTo("0.0.0.0"); }