private static void checkCredentialsFile(File file, Profile... expectedProfiles) {
        ProfilesConfigFile parsedFile = new ProfilesConfigFile(file);
        Map<String, Profile> loadedProfiles = parsedFile.getAllProfiles();

        assertTrue(expectedProfiles.length == loadedProfiles.size());

        for (Profile expectedProfile : expectedProfiles) {
            Profile loadedProfile = loadedProfiles.get(expectedProfile.getProfileName());
            assertEqualProfiles(expectedProfile, loadedProfile);
        }
    }
Loads the given credentials file and checks that it contains the same
set of profiles as expected.
aws-java-sdk-core/src/test/java/com/amazonaws/auth/profile/ProfilesConfigFileWriterTest.java