FINERACT-2086: Fix ClassCastException in AccountAssociations and add unit tests
- Simplified conversion using Number.intValue() to handle Short and Integer types. - Removed redundant null checks as per feedback. - Added unit tests for type-safety verification.
This commit is contained in:
+3
-1
@@ -99,7 +99,9 @@ public class AccountAssociationsReadPlatformServiceImpl implements AccountAssoci
|
||||
|
||||
final List<Map<String, Object>> statusList = this.jdbcTemplate.queryForList(sql1, savingsId);
|
||||
for (final Map<String, Object> statusMap : statusList) {
|
||||
AccountAssociationType associationType = AccountAssociationType.fromInt((Integer) statusMap.get("type"));
|
||||
// Direct conversion using Number handles both Short and Integer safely
|
||||
final Integer typeValue = ((Number) statusMap.get("type")).intValue();
|
||||
final AccountAssociationType associationType = AccountAssociationType.fromInt(typeValue);
|
||||
if (!associationType.isLinkedAccountAssociation() && (Boolean) statusMap.get("active")) {
|
||||
hasActiveAccount = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user