InstanceAWSProvider implements InstanceProvider { boolean validateAWSProvider(final String provider, final String region, StringBuilder errMsg) { if (region == null) { errMsg.append("no region provided in instance document"); return false; } final String suffix = "." + region; if (!provider.endsWith(suffix)) { errMsg.append("provider ").append(provider).append(" does not end with expected suffix ").append(region); return false; } return true; }  @Override Scheme getProviderScheme(); @Override void initialize(String provider, String providerEndpoint, SSLContext sslContext,
            KeyStore keyStore); ResourceException error(String message); ResourceException error(int errorCode, String message); @Override InstanceConfirmation confirmInstance(InstanceConfirmation confirmation); @Override InstanceConfirmation refreshInstance(InstanceConfirmation confirmation);  }
@Test public void testValidateAWSProvider() { StringBuilder errMsg = new StringBuilder(256); InstanceAWSProvider provider = new InstanceAWSProvider(); assertFalse(provider.validateAWSProvider("provider", null, errMsg)); assertFalse(provider.validateAWSProvider("athenz.aws.us-east-1", "", errMsg)); assertFalse(provider.validateAWSProvider("athenz.aws.us-east-1", "us-west-2", errMsg)); assertFalse(provider.validateAWSProvider("athenz.awsus-west-2", "us-west-2", errMsg)); assertTrue(provider.validateAWSProvider("athenz.aws.us-west-2", "us-west-2", errMsg)); }