CashFlowForm implements Serializable { public boolean shouldForValidateIndebtednessRate() { return captureCapitalLiabilityInfo && indebtednessRatio != null && indebtednessRatio > 0 && loanAmount != null && cashFlowDetail != null && cashFlowDetail.shouldForValidateIndebtednessRate(); } @SuppressWarnings({"UnusedDeclaration", "PMD.UnnecessaryConstructor", "PMD.UncommentedEmptyConstructor"})  CashFlowForm();  CashFlowForm(CashFlowDetail cashFlowDetail, boolean captureCapitalLiabilityInfo, BigDecimal loanAmount, Double indebtednessRatio); void setTotalCapital(BigDecimal totalCapital); void setTotalLiability(BigDecimal totalLiability); BigDecimal getTotalCapital(); BigDecimal getTotalLiability(); @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") List<MonthlyCashFlowForm> getMonthlyCashFlows(); boolean isCaptureCapitalLiabilityInfo(); BigDecimal getLoanAmount(); Double getIndebtednessRatio(); boolean shouldForValidateIndebtednessRate(); void validateCaptureCashFlowDetails(ValidationContext context); void validateEditCashflow(ValidationContext context); BigDecimal getTotalRevenues(); void setTotalRevenues(BigDecimal totalRevenues); BigDecimal getTotalExpenses(); void setTotalExpenses(BigDecimal totalExpenses); BigDecimal getTotalBalance(); BigDecimal computeRepaymentCapacity(BigDecimal totalInstallmentAmount);  }
@Test public void shouldForValidateIndebtednessRate() { CashFlowDetail cashFlowDetail = new CashFlowDetail(Collections.EMPTY_LIST); cashFlowDetail.setTotalCapital(BigDecimal.TEN); cashFlowDetail.setTotalLiability(BigDecimal.TEN); CashFlowForm cashFlowForm; cashFlowForm = new CashFlowForm(cashFlowDetail, true, new BigDecimal(123), null); assertThat(cashFlowForm.shouldForValidateIndebtednessRate(), is(false)); cashFlowForm = new CashFlowForm(cashFlowDetail, true, new BigDecimal(123), 0d); assertThat(cashFlowForm.shouldForValidateIndebtednessRate(), is(false)); cashFlowForm = new CashFlowForm(cashFlowDetail, true, null, 123d); assertThat(cashFlowForm.shouldForValidateIndebtednessRate(), is(false)); cashFlowForm = new CashFlowForm(null, true, new BigDecimal(123), 123d); assertThat(cashFlowForm.shouldForValidateIndebtednessRate(), is(false)); cashFlowForm = new CashFlowForm(cashFlowDetail, false, new BigDecimal(123), 123d); assertThat(cashFlowForm.shouldForValidateIndebtednessRate(), is(false)); cashFlowForm = new CashFlowForm(cashFlowDetail, true, new BigDecimal(123), 123d); assertThat(cashFlowForm.shouldForValidateIndebtednessRate(), is(true)); }