### Question:
IAMUtils { public static Set<String> getAllowedActionsByUserPolicy(AmazonIdentityManagementClient iamClient, String userName) { Set<String> actionSet = new HashSet<>(); actionSet.addAll(getAttachedUserPolicyActionSet(userName, iamClient)); actionSet.addAll(getInlineUserPolicyActionSet(userName, iamClient)); return actionSet; } 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);  }### Answer:
@SuppressWarnings("static-access") @Test public void getActionListByPolicyTest() throws Exception { AttachedPolicy attachedPolicies = new AttachedPolicy(); attachedPolicies.setPolicyName("IAMFullAccess"); List<AttachedPolicy> policies = new ArrayList<>(); policies.add(attachedPolicies); PolicyVersion versions = new PolicyVersion(); versions.setIsDefaultVersion(true); versions.setVersionId("123"); versions.setDocument("{\"ag\":\"aws-all\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"iam:*\"],\"Resource\":[\"iam:*\"]}],\"from\":0,\"searchtext\":\"\",\"size\":25}"); ListPolicyVersionsResult policyVersions = new ListPolicyVersionsResult(); policyVersions.setVersions(Arrays.asList(versions)); ListAttachedUserPoliciesResult attachedUserPoliciesResult = new ListAttachedUserPoliciesResult(); attachedUserPoliciesResult.setAttachedPolicies(policies); attachedUserPoliciesResult.setIsTruncated(false); ListUserPoliciesResult listUserPoliciesResult = new ListUserPoliciesResult(); listUserPoliciesResult.setPolicyNames(Arrays.asList("123")); listUserPoliciesResult.setIsTruncated(false); GetUserPolicyResult policyResult = new GetUserPolicyResult(); policyResult.setPolicyName("123"); policyResult.setPolicyDocument("{\"ag\":\"aws-all\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"iam:*\"],\"Resource\":[\"iam:*\"]}],\"from\":0,\"searchtext\":\"\",\"size\":25}"); policyResult.setUserName("123"); GetPolicyVersionResult versionResult = new GetPolicyVersionResult(); versionResult.setPolicyVersion(versions); when(iamClient.listAttachedUserPolicies(anyObject())).thenReturn(attachedUserPoliciesResult); when(iamClient.listUserPolicies(anyObject())).thenReturn(listUserPoliciesResult); when(iamClient.getUserPolicy(anyObject())).thenReturn(policyResult); when(iamClient.listPolicyVersions(anyObject())).thenReturn(policyVersions); when(iamClient.getPolicyVersion(anyObject())).thenReturn(versionResult); mockStatic(URLDecoder.class); when(URLDecoder.decode(anyString(),anyString())).thenReturn("qeqwehgj"); assertThat(iamUtils.getAllowedActionsByUserPolicy(iamClient,"133"),is(notNullValue())); }