> partitions) throws AcknowledgementTimeoutException;
}
diff --git a/fineract-core/src/main/java/org/apache/fineract/infrastructure/security/utils/SQLBuilder.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/security/utils/SQLBuilder.java
index e8c2bbe91..694a65aa6 100644
--- a/fineract-core/src/main/java/org/apache/fineract/infrastructure/security/utils/SQLBuilder.java
+++ b/fineract-core/src/main/java/org/apache/fineract/infrastructure/security/utils/SQLBuilder.java
@@ -27,11 +27,9 @@ import java.util.regex.Pattern;
import lombok.Getter;
/**
- * Utility to assemble the WHERE clause of an SQL query without the risk of SQL injection.
- *
- *
- * When using this utility instead of manually assembling SQL queries, then {@link SqlValidator} should not be required
- * anymore. (Correctly using this means only ever passing completely fixed String literals to .)
+ * Utility to assemble the WHERE clause of an SQL query without the risk of SQL injection. When using this utility
+ * instead of manually assembling SQL queries, then SqlValidator should not be required anymore. (Correctly using this
+ * means only ever passing completely fixed String literals to .)
*
* @author Michael Vorburger
*/
@@ -67,9 +65,6 @@ public class SQLBuilder {
throw new IllegalArgumentException("criteria cannot be null");
}
String trimmedCriteria = criteria.trim();
- if (trimmedCriteria.isEmpty()) {
- throw new IllegalArgumentException("criteria cannot be null");
- }
if (trimmedCriteria.contains("?")) {
throw new IllegalArgumentException(
"criteria cannot contain a '?' (that is automatically added at the end): " + trimmedCriteria);
@@ -89,7 +84,7 @@ public class SQLBuilder {
"criteria cannot contain more than 1 space (between column name and operator): " + trimmedCriteria);
}
if (!operator.equals("=") && !operator.equals("<") && !operator.equals(">") && !operator.equals("<=") && !operator.equals(">=")
- && !operator.equals("<>") && !operator.equals("LIKE") && !operator.equals("like") && !operator.toLowerCase().equals("is")) {
+ && !operator.equals("<>") && !operator.equalsIgnoreCase("like") && !operator.equalsIgnoreCase("is")) {
// add support for SQL's BETWEEN and IN, if/when ever needed.. (it's
// a little more than just adding above, as it can have multiple
// arguments)
@@ -97,7 +92,7 @@ public class SQLBuilder {
}
// TODO: Would be better to use SqlOperator functionality to handle
- if (sb.length() > 0) {
+ if (!sb.isEmpty()) {
sb.append(whereLogicalOperator.getSqlStr());
}
sb.append(trimmedCriteria);
@@ -124,7 +119,7 @@ public class SQLBuilder {
}
public void addSubOperation(Consumer subOperation) {
- if (sb.length() > 0) {
+ if (!sb.isEmpty()) {
sb.append(WhereLogicalOperator.AND.getSqlStr());
}
sb.append(" ( ");
@@ -138,8 +133,8 @@ public class SQLBuilder {
* @return SQL WHERE clause, almost always starting with " WHERE ..." (unless no criteria, then empty)
*/
public String getSQLTemplate() {
- if (sb.length() > 0) {
- return " WHERE " + sb.toString();
+ if (!sb.isEmpty()) {
+ return " WHERE " + sb;
}
return "";
}
@@ -178,7 +173,7 @@ public class SQLBuilder {
} else if (currentArg == null) {
whereClause.append("null");
} else {
- whereClause.append(String.valueOf(currentArg));
+ whereClause.append(currentArg);
}
whereClause.append("]");
}
diff --git a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountOnClosureType.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountOnClosureType.java
index 1d1002c75..f5067ae6c 100644
--- a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountOnClosureType.java
+++ b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountOnClosureType.java
@@ -19,11 +19,12 @@
package org.apache.fineract.portfolio.savings;
import java.util.Arrays;
+import lombok.Getter;
/**
- * An enumeration of different options available on account closure {@link FixedDepositAccount} &
- * {@link RecurringDepositAccount}.
+ * An enumeration of different options available on account closure
*/
+@Getter
public enum DepositAccountOnClosureType {
INVALID(0, "depositAccountClosureType.invalid"), //
@@ -40,31 +41,18 @@ public enum DepositAccountOnClosureType {
this.code = code;
}
- public Integer getValue() {
- return this.value;
- }
-
- public String getCode() {
- return this.code;
- }
-
public static DepositAccountOnClosureType fromInt(final Integer v) {
if (v == null) {
return INVALID;
}
- switch (v) {
- case 100:
- return WITHDRAW_DEPOSIT;
- case 200:
- return TRANSFER_TO_SAVINGS;
- case 300:
- return REINVEST_PRINCIPAL_AND_INTEREST;
- case 400:
- return REINVEST_PRINCIPAL_ONLY;
- default:
- return INVALID;
- }
+ return switch (v) {
+ case 100 -> WITHDRAW_DEPOSIT;
+ case 200 -> TRANSFER_TO_SAVINGS;
+ case 300 -> REINVEST_PRINCIPAL_AND_INTEREST;
+ case 400 -> REINVEST_PRINCIPAL_ONLY;
+ default -> INVALID;
+ };
}
// TODO: why not just use the enum values... just more boilerplate code here!!
diff --git a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountOnHoldTransactionType.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountOnHoldTransactionType.java
index ee293757d..e1a0d84aa 100644
--- a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountOnHoldTransactionType.java
+++ b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountOnHoldTransactionType.java
@@ -18,9 +18,12 @@
*/
package org.apache.fineract.portfolio.savings;
+import lombok.Getter;
+
/**
- * An enumeration of on hold transactions that can occur on a {@link SavingsAccount}.
+ * An enumeration of on hold transactions that can occur on SavingsAccount.
*/
+@Getter
public enum DepositAccountOnHoldTransactionType {
INVALID(0, "deposutAccountOnHoldTransactionType.invalid"), //
@@ -35,27 +38,16 @@ public enum DepositAccountOnHoldTransactionType {
this.code = code;
}
- public Integer getValue() {
- return this.value;
- }
-
- public String getCode() {
- return this.code;
- }
-
public static DepositAccountOnHoldTransactionType fromInt(final Integer v) {
if (v == null) {
return INVALID;
}
- switch (v) {
- case 1:
- return HOLD;
- case 2:
- return RELEASE;
- default:
- return INVALID;
- }
+ return switch (v) {
+ case 1 -> HOLD;
+ case 2 -> RELEASE;
+ default -> INVALID;
+ };
}
// TODO: why not just use the enum values... just more boilerplate code here!!
diff --git a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountType.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountType.java
index 95790cf0d..c11de1c1d 100644
--- a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountType.java
+++ b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountType.java
@@ -18,11 +18,13 @@
*/
package org.apache.fineract.portfolio.savings;
-import org.apache.commons.lang3.StringUtils;
+import lombok.Getter;
+import org.apache.commons.lang3.Strings;
/**
- * An enumeration of different transactions that can occur on a {@link SavingsAccount}.
+ * An enumeration of different transactions that can occur on a SavingsAccount.
*/
+@Getter
public enum DepositAccountType {
INVALID(0, "depositAccountType.invalid"), //
@@ -40,31 +42,18 @@ public enum DepositAccountType {
this.code = code;
}
- public Integer getValue() {
- return this.value;
- }
-
- public String getCode() {
- return this.code;
- }
-
public static DepositAccountType fromInt(final Integer v) {
if (v == null) {
return INVALID;
}
- switch (v) {
- case 100:
- return SAVINGS_DEPOSIT;
- case 200:
- return FIXED_DEPOSIT;
- case 300:
- return RECURRING_DEPOSIT;
- case 400:
- return CURRENT_DEPOSIT;
- default:
- return INVALID;
- }
+ return switch (v) {
+ case 100 -> SAVINGS_DEPOSIT;
+ case 200 -> FIXED_DEPOSIT;
+ case 300 -> RECURRING_DEPOSIT;
+ case 400 -> CURRENT_DEPOSIT;
+ default -> INVALID;
+ };
}
// TODO: why not just use the enum values... just more boilerplate code here!!
@@ -94,19 +83,15 @@ public enum DepositAccountType {
@Override
public String toString() {
- return StringUtils.replace(code, "_", SPACE);
+ return Strings.CS.replace(code, "_", SPACE);
}
public String resourceName() {
- switch (this) {
- case FIXED_DEPOSIT:
- return DepositsApiConstants.FIXED_DEPOSIT_ACCOUNT_RESOURCE_NAME;
- case RECURRING_DEPOSIT:
- return DepositsApiConstants.RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME;
- case SAVINGS_DEPOSIT:
- return DepositsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME;
- default:
- return "INVALID";
- }
+ return switch (this) {
+ case FIXED_DEPOSIT -> DepositsApiConstants.FIXED_DEPOSIT_ACCOUNT_RESOURCE_NAME;
+ case RECURRING_DEPOSIT -> DepositsApiConstants.RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME;
+ case SAVINGS_DEPOSIT -> DepositsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME;
+ default -> "INVALID";
+ };
}
}
diff --git a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsAccountTransactionType.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsAccountTransactionType.java
index af1034abc..51b15c0cf 100644
--- a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsAccountTransactionType.java
+++ b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/SavingsAccountTransactionType.java
@@ -24,10 +24,11 @@ import java.util.List;
import java.util.Map;
import java.util.function.Predicate;
import java.util.stream.Collectors;
+import lombok.Getter;
import org.apache.fineract.portfolio.TransactionEntryType;
/**
- * An enumeration of different transactions that can occur on a {@link SavingsAccount}.
+ * An enumeration of different transactions that can occur on a SavingsAccount.
*/
public enum SavingsAccountTransactionType {
@@ -56,7 +57,9 @@ public enum SavingsAccountTransactionType {
.collect(Collectors.toMap(SavingsAccountTransactionType::getValue, v -> v));
private final int value;
+ @Getter
private final String code;
+ @Getter
private final TransactionEntryType entryType;
SavingsAccountTransactionType(final Integer value, final String code, TransactionEntryType entryType) {
@@ -77,14 +80,6 @@ public enum SavingsAccountTransactionType {
return this.value;
}
- public String getCode() {
- return this.code;
- }
-
- public TransactionEntryType getEntryType() {
- return entryType;
- }
-
public boolean isCreditEntryType() {
return entryType != null && entryType.isCredit();
}
diff --git a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductData.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductData.java
index bed16288e..f64de2bcd 100644
--- a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductData.java
+++ b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductData.java
@@ -23,6 +23,8 @@ import java.math.BigDecimal;
import java.util.Collection;
import java.util.List;
import java.util.Map;
+import lombok.Getter;
+import lombok.Setter;
import org.apache.fineract.accounting.common.AccountingRuleType;
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
import org.apache.fineract.accounting.producttoaccountmapping.data.ChargeToGLAccountMapper;
@@ -38,24 +40,40 @@ import org.apache.fineract.portfolio.tax.data.TaxGroupData;
*/
public final class SavingsProductData implements Serializable {
+ @Getter
private final Long id;
+ @Getter
private final String name;
private final String shortName;
private final String description;
+ @Getter
private final CurrencyData currency;
+ @Getter
private final BigDecimal nominalAnnualInterestRate;
+ @Getter
private final EnumOptionData interestCompoundingPeriodType;
+ @Getter
private final EnumOptionData interestPostingPeriodType;
+ @Getter
private final EnumOptionData interestCalculationType;
+ @Getter
private final EnumOptionData interestCalculationDaysInYearType;
+ @Getter
private final BigDecimal minRequiredOpeningBalance;
+ @Getter
private final Integer lockinPeriodFrequency;
+ @Getter
private final EnumOptionData lockinPeriodFrequencyType;
+ @Getter
private final boolean withdrawalFeeForTransfers;
+ @Getter
private final boolean allowOverdraft;
+ @Getter
private final BigDecimal overdraftLimit;
+ @Getter
private final BigDecimal minRequiredBalance;
private final boolean enforceMinRequiredBalance;
+ @Getter
private final BigDecimal maxAllowedLienLimit;
private final boolean lienAllowed;
private final BigDecimal minBalanceForInterestCalculation;
@@ -63,6 +81,8 @@ public final class SavingsProductData implements Serializable {
private final BigDecimal minOverdraftForInterestCalculation;
private final boolean withHoldTax;
private final TaxGroupData taxGroup;
+ @Setter
+ @Getter
private String depositAccountType = null;
private final String accountMappingForPayment;
@@ -171,10 +191,6 @@ public final class SavingsProductData implements Serializable {
/**
* Returns a {@link SavingsProductData} that contains and exist {@link SavingsProductData} data with further
* template data for dropdowns.
- *
- * @param taxGroupOptions
- * TODO
- * @param accountMapping
*/
public static SavingsProductData withTemplate(final SavingsProductData existingProduct, final Collection currencyOptions,
final Collection interestCompoundingPeriodTypeOptions,
@@ -220,7 +236,6 @@ public final class SavingsProductData implements Serializable {
final Map> accountingMappingOptions = null;
final Collection chargeOptions = null;
final Collection penaltyOptions = null;
- final String accountMappingForPayment = null;
return new SavingsProductData(existingProduct.id, existingProduct.name, existingProduct.shortName, existingProduct.description,
existingProduct.currency, existingProduct.nominalAnnualInterestRate, existingProduct.interestCompoundingPeriodType,
@@ -505,10 +520,9 @@ public final class SavingsProductData implements Serializable {
@Override
public boolean equals(final Object obj) {
- if (!(obj instanceof SavingsProductData)) {
+ if (!(obj instanceof SavingsProductData productData)) {
return false;
}
- final SavingsProductData productData = (SavingsProductData) obj;
return productData.id.compareTo(this.id) == 0;
}
@@ -517,78 +531,6 @@ public final class SavingsProductData implements Serializable {
return this.id.hashCode();
}
- public String getName() {
- return this.name;
- }
-
- public String getDepositAccountType() {
- return depositAccountType;
- }
-
- public void setDepositAccountType(String depositAccountType) {
- this.depositAccountType = depositAccountType;
- }
-
- public BigDecimal getNominalAnnualInterestRate() {
- return nominalAnnualInterestRate;
- }
-
- public CurrencyData getCurrency() {
- return currency;
- }
-
- public Integer getLockinPeriodFrequency() {
- return lockinPeriodFrequency;
- }
-
- public EnumOptionData getLockinPeriodFrequencyType() {
- return lockinPeriodFrequencyType;
- }
-
- public BigDecimal getOverdraftLimit() {
- return overdraftLimit;
- }
-
- public BigDecimal getMinRequiredOpeningBalance() {
- return minRequiredOpeningBalance;
- }
-
- public EnumOptionData getInterestCompoundingPeriodType() {
- return interestCompoundingPeriodType;
- }
-
- public EnumOptionData getInterestPostingPeriodType() {
- return interestPostingPeriodType;
- }
-
- public EnumOptionData getInterestCalculationType() {
- return interestCalculationType;
- }
-
- public EnumOptionData getInterestCalculationDaysInYearType() {
- return interestCalculationDaysInYearType;
- }
-
- public boolean isAllowOverdraft() {
- return allowOverdraft;
- }
-
- public BigDecimal getMinRequiredBalance() {
- return minRequiredBalance;
- }
-
- public BigDecimal getMaxAllowedLienLimit() {
- return maxAllowedLienLimit;
- }
-
- public Long getId() {
- return id;
- }
-
- public boolean isWithdrawalFeeForTransfers() {
- return withdrawalFeeForTransfers;
- }
-
public boolean isCashBasedAccountingEnabled() {
return AccountingRuleType.CASH_BASED.getValue().toString().equals(this.accountingRule.getValue());
}
diff --git a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountStatusType.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountStatusType.java
index c2c18598d..ffe2fefaf 100644
--- a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountStatusType.java
+++ b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountStatusType.java
@@ -18,9 +18,12 @@
*/
package org.apache.fineract.portfolio.savings.domain;
+import lombok.Getter;
+
/**
- * Enum representation of {@link SavingsAccount} status states.
+ * Enum representation of SavingsAccount status states.
*/
+@Getter
public enum SavingsAccountStatusType {
INVALID(0, "savingsAccountStatusType.invalid"), //
@@ -39,41 +42,19 @@ public enum SavingsAccountStatusType {
private final String code;
public static SavingsAccountStatusType fromInt(final Integer type) {
-
- SavingsAccountStatusType enumeration = SavingsAccountStatusType.INVALID;
- switch (type) {
- case 100:
- enumeration = SavingsAccountStatusType.SUBMITTED_AND_PENDING_APPROVAL;
- break;
- case 200:
- enumeration = SavingsAccountStatusType.APPROVED;
- break;
- case 300:
- enumeration = SavingsAccountStatusType.ACTIVE;
- break;
- case 303:
- enumeration = SavingsAccountStatusType.TRANSFER_IN_PROGRESS;
- break;
- case 304:
- enumeration = SavingsAccountStatusType.TRANSFER_ON_HOLD;
- break;
- case 400:
- enumeration = SavingsAccountStatusType.WITHDRAWN_BY_APPLICANT;
- break;
- case 500:
- enumeration = SavingsAccountStatusType.REJECTED;
- break;
- case 600:
- enumeration = SavingsAccountStatusType.CLOSED;
- break;
- case 700:
- enumeration = SavingsAccountStatusType.PRE_MATURE_CLOSURE;
- break;
- case 800:
- enumeration = SavingsAccountStatusType.MATURED;
- break;
- }
- return enumeration;
+ return switch (type) {
+ case 100 -> SavingsAccountStatusType.SUBMITTED_AND_PENDING_APPROVAL;
+ case 200 -> SavingsAccountStatusType.APPROVED;
+ case 300 -> SavingsAccountStatusType.ACTIVE;
+ case 303 -> SavingsAccountStatusType.TRANSFER_IN_PROGRESS;
+ case 304 -> SavingsAccountStatusType.TRANSFER_ON_HOLD;
+ case 400 -> SavingsAccountStatusType.WITHDRAWN_BY_APPLICANT;
+ case 500 -> SavingsAccountStatusType.REJECTED;
+ case 600 -> SavingsAccountStatusType.CLOSED;
+ case 700 -> SavingsAccountStatusType.PRE_MATURE_CLOSURE;
+ case 800 -> SavingsAccountStatusType.MATURED;
+ default -> SavingsAccountStatusType.INVALID;
+ };
}
SavingsAccountStatusType(final Integer value, final String code) {
@@ -85,14 +66,6 @@ public enum SavingsAccountStatusType {
return this.value.equals(state.getValue());
}
- public Integer getValue() {
- return this.value;
- }
-
- public String getCode() {
- return this.code;
- }
-
public boolean isSubmittedAndPendingApproval() {
return this.value.equals(SavingsAccountStatusType.SUBMITTED_AND_PENDING_APPROVAL.getValue());
}
diff --git a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountSubStatusEnum.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountSubStatusEnum.java
index 9e19bf1d0..e36337a84 100644
--- a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountSubStatusEnum.java
+++ b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountSubStatusEnum.java
@@ -18,9 +18,12 @@
*/
package org.apache.fineract.portfolio.savings.domain;
+import lombok.Getter;
+
/**
- * Enum representation of {@link SavingsAccount} sub-status states.
+ * Enum representation of SavingsAccount sub-status states.
*/
+@Getter
public enum SavingsAccountSubStatusEnum {
NONE(0, "SavingsAccountSubStatusEnum.none"), //
@@ -38,26 +41,15 @@ public enum SavingsAccountSubStatusEnum {
SavingsAccountSubStatusEnum enumeration = SavingsAccountSubStatusEnum.NONE;
if (null != type) {
- switch (type) {
- case 100:
- enumeration = SavingsAccountSubStatusEnum.INACTIVE;
- break;
- case 200:
- enumeration = SavingsAccountSubStatusEnum.DORMANT;
- break;
- case 300:
- enumeration = SavingsAccountSubStatusEnum.ESCHEAT;
- break;
- case 400:
- enumeration = SavingsAccountSubStatusEnum.BLOCK;
- break;
- case 500:
- enumeration = SavingsAccountSubStatusEnum.BLOCK_CREDIT;
- break;
- case 600:
- enumeration = SavingsAccountSubStatusEnum.BLOCK_DEBIT;
- break;
- }
+ enumeration = switch (type) {
+ case 100 -> SavingsAccountSubStatusEnum.INACTIVE;
+ case 200 -> SavingsAccountSubStatusEnum.DORMANT;
+ case 300 -> SavingsAccountSubStatusEnum.ESCHEAT;
+ case 400 -> SavingsAccountSubStatusEnum.BLOCK;
+ case 500 -> SavingsAccountSubStatusEnum.BLOCK_CREDIT;
+ case 600 -> SavingsAccountSubStatusEnum.BLOCK_DEBIT;
+ default -> enumeration;
+ };
}
return enumeration;
}
@@ -71,14 +63,6 @@ public enum SavingsAccountSubStatusEnum {
return this.value.equals(state.getValue());
}
- public Integer getValue() {
- return this.value;
- }
-
- public String getCode() {
- return this.code;
- }
-
public boolean isSubStatusInactive() {
return this.value.equals(SavingsAccountSubStatusEnum.INACTIVE.getValue());
}
diff --git a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountTransactionDataSummaryWrapper.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountTransactionDataSummaryWrapper.java
index 2655c256a..b0c23c8e5 100644
--- a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountTransactionDataSummaryWrapper.java
+++ b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountTransactionDataSummaryWrapper.java
@@ -26,8 +26,7 @@ import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionData;
import org.springframework.stereotype.Component;
/**
- * A wrapper for dealing with side-effect free functionality related to a {@link SavingsAccount}'s
- * {@link SavingsAccountTransaction}'s.
+ * A wrapper for dealing with side-effect free functionality related to a SavingsAccountTransaction.
*/
@Component
public final class SavingsAccountTransactionDataSummaryWrapper {
diff --git a/fineract-investor/src/test/java/org/apache/fineract/investor/service/ExternalAssetOwnerLoanProductAttributesReadServiceTest.java b/fineract-investor/src/test/java/org/apache/fineract/investor/service/ExternalAssetOwnerLoanProductAttributesReadServiceTest.java
index 9286f8c7c..81a3ba7b4 100644
--- a/fineract-investor/src/test/java/org/apache/fineract/investor/service/ExternalAssetOwnerLoanProductAttributesReadServiceTest.java
+++ b/fineract-investor/src/test/java/org/apache/fineract/investor/service/ExternalAssetOwnerLoanProductAttributesReadServiceTest.java
@@ -21,7 +21,6 @@ package org.apache.fineract.investor.service;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -42,6 +41,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
+import org.mockito.ArgumentMatchers;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
@@ -64,9 +64,9 @@ public class ExternalAssetOwnerLoanProductAttributesReadServiceTest {
private ExternalAssetOwnerLoanProductAttributesReadService underTest;
- private int offset = 0;
+ private static final int OFFSET = 0;
- private int limit = 100;
+ private static final int LIMIT = 100;
@BeforeEach
public void setUp() {
@@ -80,11 +80,12 @@ public class ExternalAssetOwnerLoanProductAttributesReadServiceTest {
// given
ExternalAssetOwnerLoanProductAttributes attributes = Mockito.mock(ExternalAssetOwnerLoanProductAttributes.class);
ExternalTransferLoanProductAttributesData data = Mockito.mock(ExternalTransferLoanProductAttributesData.class);
- PageRequest pageRequest = PageRequest.of(offset, limit, Sort.by("id").ascending());
+ PageRequest pageRequest = PageRequest.of(OFFSET, LIMIT, Sort.by("id").ascending());
org.springframework.data.domain.Page attributesPage = new PageImpl<>(List.of(attributes),
pageRequest, 1);
- when(externalAssetOwnerLoanProductAttributesRepository.findAll(any(Specification.class), eq(pageRequest)))
+ when(externalAssetOwnerLoanProductAttributesRepository
+ .findAll(ArgumentMatchers.>any(), eq(pageRequest)))
.thenReturn(attributesPage);
when(loanProductRepository.existsById(loanProductId)).thenReturn(true);
when(mapper.mapLoanProductAttributes(attributes)).thenReturn(data);
@@ -95,7 +96,7 @@ public class ExternalAssetOwnerLoanProductAttributesReadServiceTest {
// then
assertEquals(1, result.getTotalFilteredRecords());
- assertEquals(data, result.getPageItems().get(0));
+ assertEquals(data, result.getPageItems().getFirst());
verify(loanProductRepository, times(1)).existsById(loanProductId);
verify(mapper, times(1)).mapLoanProductAttributes(attributes);
}
@@ -105,11 +106,12 @@ public class ExternalAssetOwnerLoanProductAttributesReadServiceTest {
// given
Long loanProductId = 1L;
ExternalAssetOwnerLoanProductAttributes attributes = Mockito.mock(ExternalAssetOwnerLoanProductAttributes.class);
- PageRequest pageRequest = PageRequest.of(offset, limit, Sort.by("id").ascending());
+ PageRequest pageRequest = PageRequest.of(OFFSET, LIMIT, Sort.by("id").ascending());
org.springframework.data.domain.Page attributesPage = new PageImpl<>(List.of(attributes),
pageRequest, 0);
- when(externalAssetOwnerLoanProductAttributesRepository.findAll(any(Specification.class), eq(pageRequest)))
+ when(externalAssetOwnerLoanProductAttributesRepository
+ .findAll(ArgumentMatchers.>any(), eq(pageRequest)))
.thenReturn(attributesPage);
when(loanProductRepository.existsById(loanProductId)).thenReturn(true);
when(mapper.mapLoanProductAttributes(attributes)).thenReturn(null);
@@ -120,8 +122,9 @@ public class ExternalAssetOwnerLoanProductAttributesReadServiceTest {
// then
assertEquals(1, result.getTotalFilteredRecords());
- assertNull(result.getPageItems().get(0));
- verify(externalAssetOwnerLoanProductAttributesRepository, times(1)).findAll(any(Specification.class), eq(pageRequest));
+ assertNull(result.getPageItems().getFirst());
+ verify(externalAssetOwnerLoanProductAttributesRepository, times(1))
+ .findAll(ArgumentMatchers.>any(), eq(pageRequest));
verify(loanProductRepository, times(1)).existsById(loanProductId);
verify(mapper, times(1)).mapLoanProductAttributes(attributes);
}