@Test public void testHandleTemplateReplacements() { assertThat(awsIamService.handleTemplateReplacements(null, Collections.emptyMap())).isNull(); assertThat(awsIamService.handleTemplateReplacements("", Collections.emptyMap())).isEqualTo(""); assertThat(awsIamService.handleTemplateReplacements("abc", Collections.emptyMap())).isEqualTo("abc"); assertThat(awsIamService.handleTemplateReplacements("abc", Collections.singletonMap("abc", "def"))).isEqualTo("def"); assertThat(awsIamService.handleTemplateReplacements("abcabc", Collections.singletonMap("abc", "def"))).isEqualTo("defdef"); Map<String, String> replacements = Map.ofEntries( Map.entry("abc", "def"), Map.entry("ghi", "jkl") ); assertThat(awsIamService.handleTemplateReplacements("abc ghi", replacements)).isEqualTo("def jkl"); }
String handleTemplateReplacements(String template, Map<String, String> replacements) { String replacedTemplate = template; if (replacedTemplate != null) { for (Entry<String, String> replacement : replacements.entrySet()) { String replacementValue = replacement.getValue() != null ? replacement.getValue() : ""; replacedTemplate = replacedTemplate.replace(replacement.getKey(), replacementValue); } } return replacedTemplate; }
AwsIamService { String handleTemplateReplacements(String template, Map<String, String> replacements) { String replacedTemplate = template; if (replacedTemplate != null) { for (Entry<String, String> replacement : replacements.entrySet()) { String replacementValue = replacement.getValue() != null ? replacement.getValue() : ""; replacedTemplate = replacedTemplate.replace(replacement.getKey(), replacementValue); } } return replacedTemplate; } }
AwsIamService { String handleTemplateReplacements(String template, Map<String, String> replacements) { String replacedTemplate = template; if (replacedTemplate != null) { for (Entry<String, String> replacement : replacements.entrySet()) { String replacementValue = replacement.getValue() != null ? replacement.getValue() : ""; replacedTemplate = replacedTemplate.replace(replacement.getKey(), replacementValue); } } return replacedTemplate; }  }
AwsIamService { String handleTemplateReplacements(String template, Map<String, String> replacements) { String replacedTemplate = template; if (replacedTemplate != null) { for (Entry<String, String> replacement : replacements.entrySet()) { String replacementValue = replacement.getValue() != null ? replacement.getValue() : ""; replacedTemplate = replacedTemplate.replace(replacement.getKey(), replacementValue); } } return replacedTemplate; }  InstanceProfile getInstanceProfile(AmazonIdentityManagement iam, String instanceProfileArn,
            ValidationResultBuilder validationResultBuilder); Set<Role> getValidRoles(AmazonIdentityManagement iam, Set<String> roleArns,
            ValidationResultBuilder validationResultBuilder); Role getRole(AmazonIdentityManagement iam, String roleArn,
            ValidationResultBuilder validationResultBuilder); Policy getAssumeRolePolicy(Role role); Policy getPolicy(String policyFileName, Map<String, String> replacements); SortedSet<String> getStatementActions(Statement statement); SortedSet<String> getStatementResources(Statement statement); List<EvaluationResult> simulatePrincipalPolicy(AmazonIdentityManagement iam,
            String policySourceArn, Collection<String> actionNames, Collection<String> resourceArns); List<EvaluationResult> validateRolePolicies(AmazonIdentityManagement iam, Role role,
            Collection<Policy> policies); }
AwsIamService { String handleTemplateReplacements(String template, Map<String, String> replacements) { String replacedTemplate = template; if (replacedTemplate != null) { for (Entry<String, String> replacement : replacements.entrySet()) { String replacementValue = replacement.getValue() != null ? replacement.getValue() : ""; replacedTemplate = replacedTemplate.replace(replacement.getKey(), replacementValue); } } return replacedTemplate; }  InstanceProfile getInstanceProfile(AmazonIdentityManagement iam, String instanceProfileArn,
            ValidationResultBuilder validationResultBuilder); Set<Role> getValidRoles(AmazonIdentityManagement iam, Set<String> roleArns,
            ValidationResultBuilder validationResultBuilder); Role getRole(AmazonIdentityManagement iam, String roleArn,
            ValidationResultBuilder validationResultBuilder); Policy getAssumeRolePolicy(Role role); Policy getPolicy(String policyFileName, Map<String, String> replacements); SortedSet<String> getStatementActions(Statement statement); SortedSet<String> getStatementResources(Statement statement); List<EvaluationResult> simulatePrincipalPolicy(AmazonIdentityManagement iam,
            String policySourceArn, Collection<String> actionNames, Collection<String> resourceArns); List<EvaluationResult> validateRolePolicies(AmazonIdentityManagement iam, Role role,
            Collection<Policy> policies);  }