@Test public void testGetMonthlyCashFlows() throws Exception { MonthlyCashFlowDetail cashFlowDetail1 = new MonthlyCashFlowDetail(new DateTime(), new BigDecimal(12), new BigDecimal(12), "notes"); MonthlyCashFlowDetail cashFlowDetail2 = new MonthlyCashFlowDetail(new DateTime(), new BigDecimal(23), new BigDecimal(34), "notes"); ArrayList<MonthlyCashFlowDetail> monthlyCashFlowDetails = new ArrayList<MonthlyCashFlowDetail>(); monthlyCashFlowDetails.add(cashFlowDetail1); monthlyCashFlowDetails.add(cashFlowDetail2); CashFlowDetail cashFlowDetail = new CashFlowDetail(monthlyCashFlowDetails); CashFlowForm cashFlowForm= new CashFlowForm(cashFlowDetail, false, null, 0d); List<MonthlyCashFlowForm> actual = cashFlowForm.getMonthlyCashFlows(); List<MonthlyCashFlowForm> expected = new ArrayList<MonthlyCashFlowForm>(); expected.add(new MonthlyCashFlowForm(cashFlowDetail1)); expected.add(new MonthlyCashFlowForm(cashFlowDetail2)); assertThat(actual.get(0),new MonthlyCashFlowFormMatcher(expected.get(0))); assertThat(actual.get(1),new MonthlyCashFlowFormMatcher(expected.get(1))); }
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public List<MonthlyCashFlowForm> getMonthlyCashFlows() { List<MonthlyCashFlowForm> monthlyCashFlows = new ArrayList<MonthlyCashFlowForm>(); if (cashFlowDetail != null) { for (MonthlyCashFlowDetail monthlyCashFlowDetail : cashFlowDetail.getMonthlyCashFlowDetails()) { MonthlyCashFlowForm monthlyCashFlowForm = new MonthlyCashFlowForm(monthlyCashFlowDetail); monthlyCashFlows.add(monthlyCashFlowForm); } } return monthlyCashFlows; }
CashFlowForm implements Serializable { @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public List<MonthlyCashFlowForm> getMonthlyCashFlows() { List<MonthlyCashFlowForm> monthlyCashFlows = new ArrayList<MonthlyCashFlowForm>(); if (cashFlowDetail != null) { for (MonthlyCashFlowDetail monthlyCashFlowDetail : cashFlowDetail.getMonthlyCashFlowDetails()) { MonthlyCashFlowForm monthlyCashFlowForm = new MonthlyCashFlowForm(monthlyCashFlowDetail); monthlyCashFlows.add(monthlyCashFlowForm); } } return monthlyCashFlows; } }
CashFlowForm implements Serializable { @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public List<MonthlyCashFlowForm> getMonthlyCashFlows() { List<MonthlyCashFlowForm> monthlyCashFlows = new ArrayList<MonthlyCashFlowForm>(); if (cashFlowDetail != null) { for (MonthlyCashFlowDetail monthlyCashFlowDetail : cashFlowDetail.getMonthlyCashFlowDetails()) { MonthlyCashFlowForm monthlyCashFlowForm = new MonthlyCashFlowForm(monthlyCashFlowDetail); monthlyCashFlows.add(monthlyCashFlowForm); } } return monthlyCashFlows; } @SuppressWarnings({"UnusedDeclaration", "PMD.UnnecessaryConstructor", "PMD.UncommentedEmptyConstructor"})  CashFlowForm();  CashFlowForm(CashFlowDetail cashFlowDetail, boolean captureCapitalLiabilityInfo, BigDecimal loanAmount, Double indebtednessRatio); }
CashFlowForm implements Serializable { @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public List<MonthlyCashFlowForm> getMonthlyCashFlows() { List<MonthlyCashFlowForm> monthlyCashFlows = new ArrayList<MonthlyCashFlowForm>(); if (cashFlowDetail != null) { for (MonthlyCashFlowDetail monthlyCashFlowDetail : cashFlowDetail.getMonthlyCashFlowDetails()) { MonthlyCashFlowForm monthlyCashFlowForm = new MonthlyCashFlowForm(monthlyCashFlowDetail); monthlyCashFlows.add(monthlyCashFlowForm); } } return monthlyCashFlows; } @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); }
CashFlowForm implements Serializable { @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public List<MonthlyCashFlowForm> getMonthlyCashFlows() { List<MonthlyCashFlowForm> monthlyCashFlows = new ArrayList<MonthlyCashFlowForm>(); if (cashFlowDetail != null) { for (MonthlyCashFlowDetail monthlyCashFlowDetail : cashFlowDetail.getMonthlyCashFlowDetails()) { MonthlyCashFlowForm monthlyCashFlowForm = new MonthlyCashFlowForm(monthlyCashFlowDetail); monthlyCashFlows.add(monthlyCashFlowForm); } } return monthlyCashFlows; } @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);  }