Source:
<code>private static void testEditPrincipalPaymentPercentageForActiveRevolvingCreditLoans() throws MambuApiException { methodName = new Object() {}.getClass().getEnclosingMethod().getName(); System.out.println("\nIn " + methodName); LoanProductType loanProductType = demoProduct.getLoanProductType(); LoansService loanService = MambuAPIFactory.getLoanService(); AccountState accountState = loanService.getLoanAccount(NEW_LOAN_ACCOUNT_ID).getAccountState(); PrincipalPaymentAccountSettings paymentSettings = newAccount.getPrincipalPaymentSettings(); if (loanProductType.equals(LoanProductType.REVOLVING_CREDIT) && <START> paymentSettings.getPrincipalPaymentMethod().name().equals("OUTSTANDING_PRINCIPAL_PERCENTAGE") && <END> (accountState.equals(AccountState.ACTIVE) || accountState.equals(AccountState.ACTIVE_IN_ARREARS))) { LoanAccount newLoanAccount = new LoanAccount(); newLoanAccount.setId(NEW_LOAN_ACCOUNT_ID); paymentSettings.setPercentage(paymentSettings.getPercentage().add(new BigDecimal(extraPercentage))); newLoanAccount.setPrincipalPaymentSettings(paymentSettings); newLoanAccount.setLoanAmount((BigDecimal) null); newLoanAccount.setPeriodicPayment((BigDecimal) null); newLoanAccount.setRepaymentInstallments(null); newLoanAccount.setGracePeriod(null); newLoanAccount.setPrincipalRepaymentInterval(null); newLoanAccount.setArrearsTolerancePeriod(null); boolean patchResult = loanService.patchLoanAccount(newLoanAccount); System.out.println("The loan's principal payment percentage was edited for the loan account " + NEW_LOAN_ACCOUNT_ID + ". Status: " + patchResult); } else { System.out.println( "The loan account does not meet the prerequisites, therefore its principal payment percentage will not be updated."); } }</code><technical_language>Instead of calling .name().equals(some string) a check if (paymentSettings.getPrincipalPaymentMethod() == PrincipalPaymentMethod.OUTSTANDING_PRINCIPAL_PERCENTAGE)</technical_language>

Target:
private static void testEditPrincipalPaymentPercentageForActiveRevolvingCreditLoans() throws MambuApiException { methodName = new Object() {}.getClass().getEnclosingMethod().getName(); System.out.println("\nIn " + methodName); LoanProductType loanProductType = demoProduct.getLoanProductType(); LoansService loanService = MambuAPIFactory.getLoanService(); AccountState accountState = loanService.getLoanAccount(NEW_LOAN_ACCOUNT_ID).getAccountState(); PrincipalPaymentAccountSettings paymentSettings = newAccount.getPrincipalPaymentSettings(); if (loanProductType.equals(LoanProductType.REVOLVING_CREDIT) && PrincipalPaymentMethod.OUTSTANDING_PRINCIPAL_PERCENTAGE.equals(paymentSettings.getPrincipalPaymentMethod()) && (accountState.equals(AccountState.ACTIVE) || accountState.equals(AccountState.ACTIVE_IN_ARREARS))) { LoanAccount newLoanAccount = new LoanAccount(); newLoanAccount.setId(NEW_LOAN_ACCOUNT_ID); paymentSettings.setPercentage(paymentSettings.getPercentage().add(new BigDecimal(extraPercentage))); newLoanAccount.setPrincipalPaymentSettings(paymentSettings); newLoanAccount.setLoanAmount((BigDecimal) null); newLoanAccount.setPeriodicPayment((BigDecimal) null); newLoanAccount.setRepaymentInstallments(null); newLoanAccount.setGracePeriod(null); newLoanAccount.setPrincipalRepaymentInterval(null); newLoanAccount.setArrearsTolerancePeriod(null); boolean patchResult = loanService.patchLoanAccount(newLoanAccount); System.out.println("The loan's principal payment percentage was edited for the loan account " + NEW_LOAN_ACCOUNT_ID + ". Status: " + patchResult); } else { System.out.println( "The loan account does not meet the prerequisites, therefore its principal payment percentage will not be updated."); } }