### Question:
BtcNodeConverter { @Nullable PeerAddress convertWithTor(BtcNode node, Socks5Proxy proxy) { int port = node.getPort(); PeerAddress result = create(proxy, node.getHostNameOrAddress(), port); if (result == null) { String address = node.getAddress(); if (address != null) { result = create(proxy, address, port); } else { log.warn("Lookup failed, no address for node {}", node); } } return result; } BtcNodeConverter();   BtcNodeConverter(Facade facade);   }### Answer:
@Test public void testConvertWithTor() throws DnsLookupException { InetAddress expected = mock(InetAddress.class); Facade facade = mock(Facade.class); when(facade.torLookup(any(), anyString())).thenReturn(expected); BtcNode node = mock(BtcNode.class); when(node.getHostNameOrAddress()).thenReturn("aaa.onion"); PeerAddress peerAddress = new BtcNodeConverter(facade).convertWithTor(node, mock(Socks5Proxy.class)); assertEquals(expected, peerAddress.getAddr()); }