@Test public void testGetStatementResources() { assertThat(awsIamService.getStatementResources(new Statement(Effect.Allow))) .isEqualTo(new TreeSet<>()); SortedSet<String> expectedSingleResource = new TreeSet<>(); expectedSingleResource.add("resource1"); Statement statementSingleResouce = new Statement(Effect.Allow) .withResources(new Resource("resource1")); assertThat(awsIamService.getStatementResources(statementSingleResouce)) .isEqualTo(expectedSingleResource); SortedSet<String> expectedMultipleResources = new TreeSet<>(); expectedMultipleResources.add("resource1"); expectedMultipleResources.add("resource2"); Statement statementMultipleResources = new Statement(Effect.Allow) .withResources( new Resource("resource1"), new Resource("resource2")); assertThat(awsIamService.getStatementResources(statementMultipleResources)) .isEqualTo(expectedMultipleResources); }
public SortedSet<String> getStatementResources(Statement statement) { List<Resource> resources = statement.getResources(); if (resources == null) { return new TreeSet<>(); } return resources.stream() .map(Resource::getId) .collect(Collectors.toCollection(TreeSet::new)); }
AwsIamService { public SortedSet<String> getStatementResources(Statement statement) { List<Resource> resources = statement.getResources(); if (resources == null) { return new TreeSet<>(); } return resources.stream() .map(Resource::getId) .collect(Collectors.toCollection(TreeSet::new)); } }
AwsIamService { public SortedSet<String> getStatementResources(Statement statement) { List<Resource> resources = statement.getResources(); if (resources == null) { return new TreeSet<>(); } return resources.stream() .map(Resource::getId) .collect(Collectors.toCollection(TreeSet::new)); }  }
AwsIamService { public SortedSet<String> getStatementResources(Statement statement) { List<Resource> resources = statement.getResources(); if (resources == null) { return new TreeSet<>(); } return resources.stream() .map(Resource::getId) .collect(Collectors.toCollection(TreeSet::new)); }  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 { public SortedSet<String> getStatementResources(Statement statement) { List<Resource> resources = statement.getResources(); if (resources == null) { return new TreeSet<>(); } return resources.stream() .map(Resource::getId) .collect(Collectors.toCollection(TreeSet::new)); }  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);  }