### Question:
BtcNetworkConfig { public void proposePeers(List<PeerAddress> peers) { if (!peers.isEmpty()) { log.info("You connect with peerAddresses: {}", peers); PeerAddress[] peerAddresses = peers.toArray(new PeerAddress[peers.size()]); delegate.setPeerNodes(peerAddresses); } else if (proxy != null) { if (log.isWarnEnabled()) { MainNetParams mainNetParams = MainNetParams.get(); if (parameters.equals(mainNetParams)) { log.warn("You use the public Bitcoin network and are exposed to privacy issues " + "caused by the broken bloom filters. See https: "for more info. It is recommended to use the provided nodes."); } } delegate.setDiscovery(new Socks5MultiDiscovery(proxy, parameters, socks5DiscoverMode)); } else if (Config.baseCurrencyNetwork().isMainnet()) { log.warn("You don't use tor and use the public Bitcoin network and are exposed to privacy issues " + "caused by the broken bloom filters. See https: "for more info. It is recommended to use Tor and the provided nodes."); } } BtcNetworkConfig(WalletConfig delegate, NetworkParameters parameters, int socks5DiscoverMode,
                            @Nullable Socks5Proxy proxy); void proposePeers(List<PeerAddress> peers);  }### Answer:
@Test public void testProposePeersWhenProxyPresentAndNoPeers() { BtcNetworkConfig config = new BtcNetworkConfig(delegate, mock(NetworkParameters.class), MODE, mock(Socks5Proxy.class)); config.proposePeers(Collections.emptyList()); verify(delegate, never()).setPeerNodes(any()); verify(delegate).setDiscovery(any(Socks5MultiDiscovery.class)); }
@Test public void testProposePeersWhenProxyNotPresentAndNoPeers() { BtcNetworkConfig config = new BtcNetworkConfig(delegate, mock(NetworkParameters.class), MODE, null); config.proposePeers(Collections.emptyList()); verify(delegate, never()).setDiscovery(any(Socks5MultiDiscovery.class)); verify(delegate, never()).setPeerNodes(any()); }
@Test public void testProposePeersWhenPeersPresent() { BtcNetworkConfig config = new BtcNetworkConfig(delegate, mock(NetworkParameters.class), MODE, null); config.proposePeers(Collections.singletonList(mock(PeerAddress.class))); verify(delegate, never()).setDiscovery(any(Socks5MultiDiscovery.class)); verify(delegate).setPeerNodes(any()); }