MigrationUtils { public static List<ShadowUser> getEligibleUsersById(String userId,Map<String, Object> propsMap) { List<ShadowUser>shadowUsersList=new ArrayList<>(); Response response = cassandraOperation.searchValueInList(JsonKey.SUNBIRD, JsonKey.SHADOW_USER, JsonKey.USERIDS, userId,propsMap); if(!((List) response.getResult().get(JsonKey.RESPONSE)).isEmpty()) { ((List) response.getResult().get(JsonKey.RESPONSE)).stream().forEach(shadowMap->{ ShadowUser shadowUser=mapper.convertValue(shadowMap,ShadowUser.class); if(shadowUser.getClaimStatus()==ClaimStatus.ELIGIBLE.getValue()) { shadowUsersList.add(shadowUser); } }); } return shadowUsersList; }  static ShadowUser getRecordByUserId(String userId); static boolean updateRecord(Map<String, Object> propertiesMap, String channel, String userExtId); static boolean markUserAsRejected(ShadowUser shadowUser); static boolean updateClaimStatus(ShadowUser shadowUser,int claimStatus); static List<ShadowUser> getEligibleUsersById(String userId,Map<String, Object> propsMap); static List<ShadowUser> getEligibleUsersById(String userId);  }
@Test public void testGetEligibleUserByIdsSuccess() { List<ShadowUser> shadowUserList = MigrationUtils.getEligibleUsersById("ABC", new HashMap<>()); Assert.assertEquals(1, shadowUserList.size()); }
@Test public void testGetEligibleUserByIdsFailure() { List<ShadowUser> shadowUserList = MigrationUtils.getEligibleUsersById("XYZ", new HashMap<>()); Assert.assertEquals(0, shadowUserList.size()); }
@Test public void testGetEligibleUserByIdsWithoutProps() { List<ShadowUser> shadowUserList = MigrationUtils.getEligibleUsersById("EFG"); Assert.assertEquals(1, shadowUserList.size()); }