FINERACT-822 Enforce ModifiedButNotUsed check

This commit is contained in:
percyashu
2020-06-23 10:00:49 +02:00
committed by Michael Vorburger ⛑️
parent a7fdafd407
commit 9542e35702
4 changed files with 1 additions and 18 deletions
+1 -1
View File
@@ -384,7 +384,6 @@ tasks.withType(JavaCompile) {
disable( disable(
"UnusedVariable", "UnusedVariable",
"SameNameButDifferent", "SameNameButDifferent",
"ModifiedButNotUsed",
"TypeParameterUnusedInFormals", "TypeParameterUnusedInFormals",
"UndefinedEquals", "UndefinedEquals",
"JdkObsolete", "JdkObsolete",
@@ -461,6 +460,7 @@ tasks.withType(JavaCompile) {
"UnnecessaryDefaultInEnumSwitch", "UnnecessaryDefaultInEnumSwitch",
"UnusedNestedClass", "UnusedNestedClass",
"UnusedMethod", "UnusedMethod",
"ModifiedButNotUsed",
"InconsistentCapitalization", "InconsistentCapitalization",
"MissingOverride", "MissingOverride",
// "InvalidBlockTag", // "InvalidBlockTag",
@@ -74,7 +74,6 @@ public class ProvisioningIntegrationTest {
public void testCreateProvisioningCriteria() { public void testCreateProvisioningCriteria() {
ProvisioningTransactionHelper transactionHelper = new ProvisioningTransactionHelper(requestSpec, responseSpec); ProvisioningTransactionHelper transactionHelper = new ProvisioningTransactionHelper(requestSpec, responseSpec);
ArrayList<Integer> loanProducts = new ArrayList<>(LOANPRODUCTS_SIZE); ArrayList<Integer> loanProducts = new ArrayList<>(LOANPRODUCTS_SIZE);
List<Integer> loans = new ArrayList<>();
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec); final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID); ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
for (int i = 0; i < LOANPRODUCTS_SIZE; i++) { for (int i = 0; i < LOANPRODUCTS_SIZE; i++) {
@@ -90,7 +89,6 @@ public class ProvisioningIntegrationTest {
LOG.info("-------------------------------DISBURSE LOAN-------------------------------------------"); LOG.info("-------------------------------DISBURSE LOAN-------------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.disburseLoan("20 September 2011", loanID); loanStatusHashMap = this.loanTransactionHelper.disburseLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap); LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
loans.add(loanID);
Assertions.assertNotNull(loanID); Assertions.assertNotNull(loanID);
} }
@@ -60,15 +60,11 @@ public class DividendsIntegrationTests {
public void testCreateDividends() { public void testCreateDividends() {
DateFormat simple = new SimpleDateFormat("dd MMM yyyy"); DateFormat simple = new SimpleDateFormat("dd MMM yyyy");
final Integer productId = createShareProduct(); final Integer productId = createShareProduct();
ArrayList<Integer> clients = new ArrayList<>();
ArrayList<Integer> savingAccounts = new ArrayList<>();
ArrayList<Integer> shareAccounts = new ArrayList<>(); ArrayList<Integer> shareAccounts = new ArrayList<>();
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec); final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
clients.add(clientId);
Assertions.assertNotNull(clientId); Assertions.assertNotNull(clientId);
Integer savingsAccountId = SavingsAccountHelper.openSavingsAccount(requestSpec, responseSpec, clientId, "1000"); Integer savingsAccountId = SavingsAccountHelper.openSavingsAccount(requestSpec, responseSpec, clientId, "1000");
savingAccounts.add(savingsAccountId);
Assertions.assertNotNull(savingsAccountId); Assertions.assertNotNull(savingsAccountId);
final Integer shareAccountId = createShareAccount(clientId, productId, savingsAccountId, dates[i], shares[i]); final Integer shareAccountId = createShareAccount(clientId, productId, savingsAccountId, dates[i], shares[i]);
shareAccounts.add(shareAccountId); shareAccounts.add(shareAccountId);
@@ -40,7 +40,6 @@ import org.apache.fineract.portfolio.loanaccount.domain.Loan;
import org.apache.fineract.portfolio.loanaccount.domain.LoanDisbursementDetails; import org.apache.fineract.portfolio.loanaccount.domain.LoanDisbursementDetails;
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment; import org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment;
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleTransactionProcessorFactory; import org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleTransactionProcessorFactory;
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction;
import org.apache.fineract.portfolio.loanaccount.domain.transactionprocessor.LoanRepaymentScheduleTransactionProcessor; import org.apache.fineract.portfolio.loanaccount.domain.transactionprocessor.LoanRepaymentScheduleTransactionProcessor;
import org.apache.fineract.portfolio.loanaccount.loanschedule.data.LoanScheduleData; import org.apache.fineract.portfolio.loanaccount.loanschedule.data.LoanScheduleData;
import org.apache.fineract.portfolio.loanaccount.loanschedule.data.LoanSchedulePeriodData; import org.apache.fineract.portfolio.loanaccount.loanschedule.data.LoanSchedulePeriodData;
@@ -183,16 +182,6 @@ public class LoanScheduleCalculationPlatformServiceImpl implements LoanScheduleC
totalAmount = totalAmount.plus(interestDue); totalAmount = totalAmount.plus(interestDue);
} }
boolean isNewPaymentRequired = loanRepaymentScheduleInstallment.isInterestDue(currency) || totalPrincipal.isGreaterThanZero(); boolean isNewPaymentRequired = loanRepaymentScheduleInstallment.isInterestDue(currency) || totalPrincipal.isGreaterThanZero();
final List<LoanTransaction> modifiedTransactions = new ArrayList<>();
List<LoanTransaction> transactions = loan.retreiveListOfTransactionsPostDisbursementExcludeAccruals();
for (LoanTransaction loanTransaction : transactions) {
modifiedTransactions.add(LoanTransaction.copyTransactionProperties(loanTransaction));
}
if (isNewPaymentRequired) {
LoanTransaction ondayPaymentTransaction = LoanTransaction.repayment(null, totalAmount, null, today, null,
DateUtils.getLocalDateTimeOfTenant(), null);
modifiedTransactions.add(ondayPaymentTransaction);
}
LoanScheduleModel model = this.loanScheduleAssembler.assembleForInterestRecalculation(loanApplicationTerms, loan.getOfficeId(), LoanScheduleModel model = this.loanScheduleAssembler.assembleForInterestRecalculation(loanApplicationTerms, loan.getOfficeId(),
loan, loanRepaymentScheduleTransactionProcessor, loan.fetchInterestRecalculateFromDate()); loan, loanRepaymentScheduleTransactionProcessor, loan.fetchInterestRecalculateFromDate());