@Test public void testProvideShouldReturnsMapWithoutNetworkWhenTheThereAreMissingNodes() throws IOException { InstanceList gcpInstances = createGcpInstancesWithMissingNode(); when(computeInstancesMock.execute()).thenReturn(gcpInstances); Map<String, Optional<NetworkInterface>> actual = underTest.provide(authenticatedContext, instances); assertEquals(3, actual.size()); assertEquals(actual.get(INSTANCE_NAME_1), getNetworkForInstance(gcpInstances, INSTANCE_NAME_1)); assertEquals(actual.get(INSTANCE_NAME_2), getNetworkForInstance(gcpInstances, INSTANCE_NAME_2)); assertEquals(actual.get(INSTANCE_NAME_3), getNetworkForInstance(gcpInstances, INSTANCE_NAME_3)); }
Map<String, Optional<NetworkInterface>> provide(AuthenticatedContext authenticatedContext, List<CloudResource> instances) { String instanceNamePrefix = getInstanceNamePrefix(instances); List<Instance> gcpInstances = getInstances(authenticatedContext, instanceNamePrefix); return getNetworkMap(gcpInstances, instances); }
GcpNetworkInterfaceProvider { Map<String, Optional<NetworkInterface>> provide(AuthenticatedContext authenticatedContext, List<CloudResource> instances) { String instanceNamePrefix = getInstanceNamePrefix(instances); List<Instance> gcpInstances = getInstances(authenticatedContext, instanceNamePrefix); return getNetworkMap(gcpInstances, instances); } }
GcpNetworkInterfaceProvider { Map<String, Optional<NetworkInterface>> provide(AuthenticatedContext authenticatedContext, List<CloudResource> instances) { String instanceNamePrefix = getInstanceNamePrefix(instances); List<Instance> gcpInstances = getInstances(authenticatedContext, instanceNamePrefix); return getNetworkMap(gcpInstances, instances); }  }
GcpNetworkInterfaceProvider { Map<String, Optional<NetworkInterface>> provide(AuthenticatedContext authenticatedContext, List<CloudResource> instances) { String instanceNamePrefix = getInstanceNamePrefix(instances); List<Instance> gcpInstances = getInstances(authenticatedContext, instanceNamePrefix); return getNetworkMap(gcpInstances, instances); }  List<Instance> getInstances(AuthenticatedContext authenticatedContext, String instanceNamePrefix); }
GcpNetworkInterfaceProvider { Map<String, Optional<NetworkInterface>> provide(AuthenticatedContext authenticatedContext, List<CloudResource> instances) { String instanceNamePrefix = getInstanceNamePrefix(instances); List<Instance> gcpInstances = getInstances(authenticatedContext, instanceNamePrefix); return getNetworkMap(gcpInstances, instances); }  List<Instance> getInstances(AuthenticatedContext authenticatedContext, String instanceNamePrefix);  }