InstanceAWSProvider implements InstanceProvider { boolean validateAWSInstanceId(final String reqInstanceId, final String docInstanceId, StringBuilder errMsg) { if (!reqInstanceId.equalsIgnoreCase(docInstanceId)) { errMsg.append("mismatch between instance-id values: request: ").append(reqInstanceId) .append(" vs. instance document: ").append(docInstanceId); 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 testValidateAWSInstanceId() { StringBuilder errMsg = new StringBuilder(256); MockInstanceAWSProvider provider = new MockInstanceAWSProvider(); assertFalse(provider.validateAWSInstanceId("1234", "12345", errMsg)); assertFalse(provider.validateAWSInstanceId("1234", null, errMsg)); assertTrue(provider.validateAWSInstanceId("1234", "1234", errMsg)); }