@Test
public void testGetClassInstance() {

    HostnameResolver hostnameResolver = new HostnameResolver(){};
    InstanceProviderManager providerManager = new InstanceProviderManager(null, null, null);
    InstanceProvider provider = providerManager.getClassProvider("unknown.class", "provider", hostnameResolver);
    assertNull(provider);
    
    provider = providerManager.getClassProvider("com.yahoo.athenz.instance.provider.impl.InstanceAWSProvider", "provider", hostnameResolver);
    assertNotNull(provider);
    provider = providerManager.getClassProvider("com.yahoo.athenz.instance.provider.impl.InstanceAWSECSProvider", "provider", hostnameResolver);
    assertNotNull(provider);
    provider = providerManager.getClassProvider("com.yahoo.athenz.instance.provider.impl.InstanceAWSLambdaProvider", "provider", hostnameResolver);
    assertNotNull(provider);
    // we should get this from the cache now
    
    provider = providerManager.getClassProvider("com.yahoo.athenz.instance.provider.impl.InstanceAWSProvider", "provider", hostnameResolver);
    assertNotNull(provider);
    
    // some invalid class name
    
    provider = providerManager.getClassProvider("com.yahoo.athenz.unknown.class", "provider", hostnameResolver);
    assertNull(provider);
    
    // class name that doesn't implement expected interface
    
    try {
        providerManager.getClassProvider("com.yahoo.athenz.zts.ZTSConsts", "provider", hostnameResolver);
        fail();
    } catch (Exception ignored) {
    }
}