@Test public void testGetEc2RolesFromAmazonAccount_getValidListOfRoles() { List<String> expectedEc2Roles = new ArrayList<>(); List<InstanceProfile> ec2Profiles = new ArrayList<>(); InstanceProfile defaultProfile = new InstanceProfile(); defaultProfile.setInstanceProfileName( "defaulr_role" ); InstanceProfile testProfile = new InstanceProfile(); testProfile.setInstanceProfileName( "test_role" ); ec2Profiles.add( defaultProfile ); ec2Profiles.add( testProfile ); expectedEc2Roles.add( "defaulr_role" ); expectedEc2Roles.add( "test_role" ); Mockito.when( amazonIdentityManagement.listInstanceProfiles().getInstanceProfiles() ).thenReturn( ec2Profiles ); AbstractModelList<String> ec2Roles = aimClient.getEc2RolesFromAmazonAccount(); assertEquals( expectedEc2Roles, ec2Roles ); }
@Override public AbstractModelList<String> getEc2RolesFromAmazonAccount() { List<InstanceProfile> ec2RolesList = aim.listInstanceProfiles().getInstanceProfiles(); AbstractModelList<String> ec2List; ec2List = ec2RolesList.stream().map( e -> e.getInstanceProfileName() ) .collect( Collectors.toCollection( AbstractModelList<String>::new ) ); return ec2List; }
AimClientImpl implements AimClient { @Override public AbstractModelList<String> getEc2RolesFromAmazonAccount() { List<InstanceProfile> ec2RolesList = aim.listInstanceProfiles().getInstanceProfiles(); AbstractModelList<String> ec2List; ec2List = ec2RolesList.stream().map( e -> e.getInstanceProfileName() ) .collect( Collectors.toCollection( AbstractModelList<String>::new ) ); return ec2List; } }
AimClientImpl implements AimClient { @Override public AbstractModelList<String> getEc2RolesFromAmazonAccount() { List<InstanceProfile> ec2RolesList = aim.listInstanceProfiles().getInstanceProfiles(); AbstractModelList<String> ec2List; ec2List = ec2RolesList.stream().map( e -> e.getInstanceProfileName() ) .collect( Collectors.toCollection( AbstractModelList<String>::new ) ); return ec2List; } AimClientImpl( AmazonIdentityManagement aim ); }
AimClientImpl implements AimClient { @Override public AbstractModelList<String> getEc2RolesFromAmazonAccount() { List<InstanceProfile> ec2RolesList = aim.listInstanceProfiles().getInstanceProfiles(); AbstractModelList<String> ec2List; ec2List = ec2RolesList.stream().map( e -> e.getInstanceProfileName() ) .collect( Collectors.toCollection( AbstractModelList<String>::new ) ); return ec2List; } AimClientImpl( AmazonIdentityManagement aim ); @Override AbstractModelList<String> getEc2RolesFromAmazonAccount(); @Override AbstractModelList<String> getEmrRolesFromAmazonAccount(); }
AimClientImpl implements AimClient { @Override public AbstractModelList<String> getEc2RolesFromAmazonAccount() { List<InstanceProfile> ec2RolesList = aim.listInstanceProfiles().getInstanceProfiles(); AbstractModelList<String> ec2List; ec2List = ec2RolesList.stream().map( e -> e.getInstanceProfileName() ) .collect( Collectors.toCollection( AbstractModelList<String>::new ) ); return ec2List; } AimClientImpl( AmazonIdentityManagement aim ); @Override AbstractModelList<String> getEc2RolesFromAmazonAccount(); @Override AbstractModelList<String> getEmrRolesFromAmazonAccount();  }