@Override
    public Map<String, String> getAddresses() {
        AwsCredentials credentials = awsCredentialsProvider.credentials();
        List<String> taskAddresses = emptyList();
        if (!awsConfig.anyOfEc2PropertiesConfigured()) {
            taskAddresses = awsEcsApi.listTaskPrivateAddresses(cluster, credentials);
            LOGGER.fine("AWS ECS DescribeTasks found the following addresses: %s", taskAddresses);
        }
        if (!taskAddresses.isEmpty()) {
            return awsEc2Api.describeNetworkInterfaces(taskAddresses, credentials);
        } else if (DiscoveryMode.Client == awsConfig.getDiscoveryMode() && !awsConfig.anyOfEcsPropertiesConfigured()) {
            LOGGER.fine("No tasks found in ECS cluster: '%s'. Trying AWS EC2 Discovery.", cluster);
            return awsEc2Api.describeInstances(credentials);
        }
        return emptyMap();
    }
@Test
    public void getAddressesNoTasks() {
        // given
        given(awsEcsApi.listTaskPrivateAddresses(CLUSTER, CREDENTIALS)).willReturn(emptyList());

        // when
        Map<String, String> result = awsEcsClient.getAddresses();

        // then
        assertTrue(result.isEmpty());
    }