static String resolveRegion(AwsConfig awsConfig, AwsMetadataApi metadataApi, Environment environment) {
        if (!isNullOrEmptyAfterTrim(awsConfig.getRegion())) {
            return awsConfig.getRegion();
        }

        if (environment.isRunningOnEcs()) {
            return regionFrom(metadataApi.availabilityZoneEcs());
        }

        return regionFrom(metadataApi.availabilityZoneEc2());
    }
@Test
    public void resolveRegionAwsConfig() {
        // given
        String region = "us-east-1";
        AwsConfig awsConfig = AwsConfig.builder().setRegion(region).build();
        AwsMetadataApi awsMetadataApi = mock(AwsMetadataApi.class);
        Environment environment = mock(Environment.class);

        // when
        String result = resolveRegion(awsConfig, awsMetadataApi, environment);

        // then
        assertEquals(region, result);
    }