bitcoinj 0.15: PeerAddress: BtcNodeConverterTest fixes.

This commit is contained in:
Oscar Guindzberg 2019-04-16 16:49:04 -03:00
parent 3717323444
commit 7b172c1280
No known key found for this signature in database
GPG Key ID: 209796BF2E1D4F75

View File

@ -45,29 +45,16 @@ public class BtcNodeConverterTest {
BtcNode node = mock(BtcNode.class);
when(node.getOnionAddress()).thenReturn("aaa.onion");
InetAddress inetAddress = mock(InetAddress.class);
//InetAddress inetAddress = mock(InetAddress.class);
Facade facade = mock(Facade.class);
when(facade.onionHostToInetAddress(any())).thenReturn(inetAddress);
//when(facade.onionHostToInetAddress(any())).thenReturn(inetAddress);
PeerAddress peerAddress = new BtcNodeConverter(facade).convertOnionHost(node);
// noinspection ConstantConditions
assertEquals(inetAddress, peerAddress.getAddr());
assertEquals(node.getOnionAddress(), peerAddress.getHostname());
}
@Test
public void testConvertOnionHostOnFailure() throws UnknownHostException {
BtcNode node = mock(BtcNode.class);
when(node.getOnionAddress()).thenReturn("aaa.onion");
Facade facade = mock(Facade.class);
when(facade.onionHostToInetAddress(any())).thenThrow(UnknownHostException.class);
PeerAddress peerAddress = new BtcNodeConverter(facade).convertOnionHost(node);
assertNull(peerAddress);
}
@Ignore
@Test
public void testConvertClearNode() {
final String ip = "192.168.0.1";