@SuppressWarnings("static-access") @Test public void getAttachedPolicyOfIAMUserTest() throws Exception { ListAttachedUserPoliciesResult policiesResult = new ListAttachedUserPoliciesResult(); when(iamClient.listAttachedUserPolicies(anyObject())).thenReturn(policiesResult); assertThat(iamUtils.getAttachedPolicyOfIAMUser("user",iamClient),is(notNullValue())); }
public static List<AttachedPolicy> getAttachedPolicyOfIAMUser(String userName, AmazonIdentityManagementClient iamClient) throws RuleExecutionFailedExeption { ListAttachedUserPoliciesRequest attachedUserPoliciesRequest = new ListAttachedUserPoliciesRequest(); attachedUserPoliciesRequest.setUserName(userName); ListAttachedUserPoliciesResult userPoliciesResult = iamClient .listAttachedUserPolicies(attachedUserPoliciesRequest); return userPoliciesResult.getAttachedPolicies(); }
IAMUtils { public static List<AttachedPolicy> getAttachedPolicyOfIAMUser(String userName, AmazonIdentityManagementClient iamClient) throws RuleExecutionFailedExeption { ListAttachedUserPoliciesRequest attachedUserPoliciesRequest = new ListAttachedUserPoliciesRequest(); attachedUserPoliciesRequest.setUserName(userName); ListAttachedUserPoliciesResult userPoliciesResult = iamClient .listAttachedUserPolicies(attachedUserPoliciesRequest); return userPoliciesResult.getAttachedPolicies(); } }
IAMUtils { public static List<AttachedPolicy> getAttachedPolicyOfIAMUser(String userName, AmazonIdentityManagementClient iamClient) throws RuleExecutionFailedExeption { ListAttachedUserPoliciesRequest attachedUserPoliciesRequest = new ListAttachedUserPoliciesRequest(); attachedUserPoliciesRequest.setUserName(userName); ListAttachedUserPoliciesResult userPoliciesResult = iamClient .listAttachedUserPolicies(attachedUserPoliciesRequest); return userPoliciesResult.getAttachedPolicies(); } private  IAMUtils(); }
IAMUtils { public static List<AttachedPolicy> getAttachedPolicyOfIAMUser(String userName, AmazonIdentityManagementClient iamClient) throws RuleExecutionFailedExeption { ListAttachedUserPoliciesRequest attachedUserPoliciesRequest = new ListAttachedUserPoliciesRequest(); attachedUserPoliciesRequest.setUserName(userName); ListAttachedUserPoliciesResult userPoliciesResult = iamClient .listAttachedUserPolicies(attachedUserPoliciesRequest); return userPoliciesResult.getAttachedPolicies(); } private  IAMUtils(); static List<AccessKeyMetadata> getAccessKeyInformationForUser(
            final String userName, AmazonIdentityManagementClient iamClient); static Set<String> getAllowedActionsByUserPolicy(AmazonIdentityManagementClient iamClient, String userName); static List<AttachedPolicy> getAttachedPolicyOfIAMUser(String userName,
			AmazonIdentityManagementClient iamClient); static Set<String> getAllowedActionsByRolePolicy(AmazonIdentityManagementClient iamClient, String roleName); static List<AttachedPolicy> getAttachedPolicyOfIAMRole(final String roleName,
			AmazonIdentityManagementClient iamClient); }
IAMUtils { public static List<AttachedPolicy> getAttachedPolicyOfIAMUser(String userName, AmazonIdentityManagementClient iamClient) throws RuleExecutionFailedExeption { ListAttachedUserPoliciesRequest attachedUserPoliciesRequest = new ListAttachedUserPoliciesRequest(); attachedUserPoliciesRequest.setUserName(userName); ListAttachedUserPoliciesResult userPoliciesResult = iamClient .listAttachedUserPolicies(attachedUserPoliciesRequest); return userPoliciesResult.getAttachedPolicies(); } private  IAMUtils(); static List<AccessKeyMetadata> getAccessKeyInformationForUser(
            final String userName, AmazonIdentityManagementClient iamClient); static Set<String> getAllowedActionsByUserPolicy(AmazonIdentityManagementClient iamClient, String userName); static List<AttachedPolicy> getAttachedPolicyOfIAMUser(String userName,
			AmazonIdentityManagementClient iamClient); static Set<String> getAllowedActionsByRolePolicy(AmazonIdentityManagementClient iamClient, String roleName); static List<AttachedPolicy> getAttachedPolicyOfIAMRole(final String roleName,
			AmazonIdentityManagementClient iamClient);  }