@Test
    public void testModifyAndInsertProfile_WithAccountId() throws IOException, URISyntaxException {
        File credWithAccountId = ProfileResourceLoader.profilesWithAccountId().asFile();
        File tmpFile = copyToTempFile(credWithAccountId);

        String originalContent = FileUtils.readFileToString(tmpFile);

        Profile[] expected = {
                new Profile("default", defaultCred),
                new Profile("a", basicCredAWithAccountId),
                new Profile("b", basicCredBWithAccountId),
                new Profile("c", sessionCredCWithAccountId),
                new Profile("d", sessionCredDWithAccountId)
        };

        // a <==> b, c <==> d, also renaming them to uppercase letters
        Profile[] modified = {
                new Profile("default", defaultCred),
                new Profile("A", basicCredBWithAccountId),
                new Profile("B", basicCredAWithAccountId),
                new Profile("C", sessionCredDWithAccountId),
                new Profile("D", sessionCredCWithAccountId)
        };
        ProfilesConfigFileWriter.modifyProfiles(tmpFile, ImmutableMapParameter
                .of("a", modified[1],
                        "b", modified[2],
                        "c", modified[3],
                        "d", modified[4]));
        checkCredentialsFile(tmpFile, modified);

        // Sanity check that the content is altered
        String modifiedContent = FileUtils.readFileToString(tmpFile);
        assertFalse(originalContent.equals(modifiedContent));

        // Restore the properties
        ProfilesConfigFileWriter.modifyProfiles(tmpFile, ImmutableMapParameter
                .of("A", expected[1],
                        "B", expected[2],
                        "C", expected[3],
                        "D", expected[4]));
        checkCredentialsFile(tmpFile, expected);

        // Check that the content is now the same as the original
        String restoredContent = FileUtils.readFileToString(tmpFile);
        assertEquals(originalContent, restoredContent);
    }
Tests that properties, including account ID, are preserved after profile modification.
@throws URISyntaxException
aws-java-sdk-core/src/test/java/com/amazonaws/auth/profile/ProfilesConfigFileWriterTest.java