@Test
public void testTeardown() throws IOException, SQLException, ClassNotFoundException 
{

    AmazonCloudFormationClient client = new AmazonCloudFormationClient();
    String name = "TestTeardownCluster" + UUID.randomUUID().toString();
    CreateStackRequest createStackRequest = new CreateStackRequest();
    
    client.setRegion(Region.getRegion(Regions.US_WEST_2)); 
    
    createStackRequest.setStackName(name);
    createStackRequest.setTemplateBody(IOUtils.toString(getClass().getResourceAsStream("cloudformation.template"), "UTF-8"));
    
    client.createStack(createStackRequest);
    
    loader.setConfiguration(configuration);
    loader.teardown(name, Region.getRegion(Regions.US_WEST_2));
    
    for(StackSummary stack : client.listStacks().getStackSummaries())
    {
        if(stack.getStackStatus().equalsIgnoreCase("DELETE_COMPLETE")) continue;
        if(stack.getStackStatus().equalsIgnoreCase("DELETE_FAILED")) continue;
        if(stack.getStackStatus().equalsIgnoreCase("DELETE_IN_PROGRESS")) continue;
        
        if(stack.getStackName().equals(name)) fail(name +  " should have been deleted but status is: " + stack.getStackStatus());
    }
}