private static void assertEqualCredentials(AWSCredentials expected, AWSCredentials actual) {
        assertEquals(expected.getAWSAccessKeyId(),
                actual.getAWSAccessKeyId());
        assertEquals(expected.getAWSAccessKeyId(),
                actual.getAWSAccessKeyId());

        if (expected instanceof AWSSessionCredentials) {
            assertTrue(actual instanceof AWSSessionCredentials);

            AWSSessionCredentials expectedSession = (AWSSessionCredentials)expected;
            AWSSessionCredentials actualSession   = (AWSSessionCredentials)actual;
            assertEquals(expectedSession.getSessionToken(),
                    actualSession.getSessionToken());
        } else {
            assertFalse(actual instanceof AWSSessionCredentials);
        }
    }
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