CashFlowDetail implements Serializable { public boolean shouldForValidateIndebtednessRate() { return totalCapital != null && totalCapital.compareTo(BigDecimal.ZERO) > 0 && totalLiability != null; } CashFlowDetail();  CashFlowDetail(List<MonthlyCashFlowDetail> monthlyCashFlows); List<MonthlyCashFlowDetail> getMonthlyCashFlowDetails(); BigDecimal getCumulativeCashFlowForMonth(DateTime dateTime); void setTotalCapital(BigDecimal totalCapital); void setTotalLiability(BigDecimal totalLiability); BigDecimal getTotalCapital(); BigDecimal getTotalLiability(); boolean shouldForValidateIndebtednessRate();  }
@Test public void shouldForValidateIndebtednessRate() { CashFlowDetail cashFlowDetail = new CashFlowDetail(); cashFlowDetail.setTotalCapital(null); cashFlowDetail.setTotalLiability(BigDecimal.TEN); assertThat(cashFlowDetail.shouldForValidateIndebtednessRate(), is(false)); cashFlowDetail.setTotalCapital(BigDecimal.ZERO); cashFlowDetail.setTotalLiability(BigDecimal.TEN); assertThat(cashFlowDetail.shouldForValidateIndebtednessRate(), is(false)); cashFlowDetail.setTotalCapital(BigDecimal.TEN); cashFlowDetail.setTotalLiability(null); assertThat(cashFlowDetail.shouldForValidateIndebtednessRate(), is(false)); cashFlowDetail.setTotalCapital(BigDecimal.TEN); cashFlowDetail.setTotalLiability(BigDecimal.TEN); assertThat(cashFlowDetail.shouldForValidateIndebtednessRate(), is(true)); }