bug6038: needed to mock the new getHostname() method

This commit is contained in:
Axel Uhl committed 2024-08-03 20:42:31 +02:00
1 parent 72923ec512
commit d197999b13
1 file changed
+2
@@ -36,10 +36,12 @@ public class MongoUriParserTest {
final AwsInstance<String> host1 = mock(AwsInstance.class);
when(host1.getPublicAddress()).thenReturn(wwwExampleCom);
when(host1.getPrivateAddress()).thenReturn(wwwExampleCom);
when(host1.getHostname()).thenReturn(WWW_EXAMPLE_COM);
when(landscape.getHostByPrivateIpAddress(ArgumentMatchers.any(Region.class), ArgumentMatchers.contains(wwwExampleCom.getHostAddress()), ArgumentMatchers.any(HostSupplier.class))).thenReturn(host1);
final InetAddress loopback = InetAddress.getLoopbackAddress();
final AwsInstance<String> host2 = mock(AwsInstance.class);
when(host2.getPrivateAddress()).thenReturn(loopback);
when(host2.getHostname()).thenReturn(loopback.getHostAddress());
when(landscape.getHostByPrivateIpAddress(ArgumentMatchers.any(Region.class), ArgumentMatchers.contains(loopback.getHostAddress()), ArgumentMatchers.any(HostSupplier.class))).thenReturn(host2);
parser = new MongoUriParser<String>(landscape, new AwsRegion("eu-west-2", landscape));
}