@Test
public void testConfirmInstance() {

    
    System.setProperty(InstanceAWSProvider.AWS_PROP_DNS_SUFFIX, "athenz.cloud");
    MockInstanceAWSProvider provider = new MockInstanceAWSProvider();
    System.setProperty(InstanceAWSProvider.AWS_PROP_PUBLIC_CERT, "src/test/resources/aws_public.cert");
    
    provider.initialize("provider", "com.yahoo.athenz.instance.provider.impl.InstanceAWSProvider", null, null);
    
    String bootTime = Timestamp.fromMillis(System.currentTimeMillis() - 100).toString();
    InstanceConfirmation confirmation = new InstanceConfirmation()
            .setAttestationData("{\"document\": \"{\\\"accountId\\\": \\\"1234\\\",\\\"pendingTime\\\": \\\""
                    + bootTime + "\\\",\\\"region\\\": \\\"us-west-2\\\",\\\"instanceId\\\": \\\"i-1234\\\","
                    + "\\\"privateIp\\\": \\\"10.10.10.11\\\"}\","
                    + "\"signature\": \"signature\",\"role\": \"athenz.service\"}")
            .setDomain("athenz").setProvider("athenz.aws.us-west-2").setService("service");
    HashMap<String, String> attributes = new HashMap<>();
    attributes.put("cloudAccount", "1234");
    attributes.put("sanDNS", "service.athenz.athenz.cloud,i-1234.instanceid.athenz.athenz.cloud");
    confirmation.setAttributes(attributes);
    
    InstanceConfirmation result = provider.confirmInstance(confirmation);
    assertEquals(result.getDomain(), "athenz");
    Map<String, String> attrs = result.getAttributes();
    assertNotNull(attrs);
    assertEquals(attrs.get("certSSH"), "true");
    assertEquals(attrs.get("instancePrivateIp"), "10.10.10.11");
    assertNull(attrs.get("certExpiryTime"));
    System.clearProperty(InstanceAWSProvider.AWS_PROP_DNS_SUFFIX);
}