@Test public void shouldNotValidateForCalculatedIndebtednessRateLessThanIndebtednessRate() { when(validationContext.getMessageContext()).thenReturn(messageContext); CashFlowDetail cashFlowDetail = new CashFlowDetail(EMPTY_LIST); cashFlowDetail.setTotalCapital(new BigDecimal(1000d)); cashFlowDetail.setTotalLiability(new BigDecimal(5d)); CashFlowForm cashFlowForm = new CashFlowForm(cashFlowDetail, true, new BigDecimal(1000d), 1000d); cashFlowValidator.validateCaptureCashFlow(cashFlowForm, validationContext); verify(validationContext).getMessageContext(); verify(messageContext, never()).addMessage(Matchers.<MessageResolver>anyObject()); }
public void validateCaptureCashFlow(CashFlowForm cashFlow, ValidationContext context) { MessageContext messageContext = context.getMessageContext(); for (MonthlyCashFlowForm monthlyCashFlowForm : cashFlow.getMonthlyCashFlows()) { validateExpense(messageContext, monthlyCashFlowForm); validateRevenue(messageContext, monthlyCashFlowForm); validateNotes(messageContext, monthlyCashFlowForm); } validateCumulativeCashFlow(cashFlow, messageContext); validateTotalCapitalAndLiability(cashFlow, messageContext); validateIndebtednessRatio(cashFlow, messageContext); setTotalsOnCashFlowForm(cashFlow, messageContext); }
CashFlowValidator { public void validateCaptureCashFlow(CashFlowForm cashFlow, ValidationContext context) { MessageContext messageContext = context.getMessageContext(); for (MonthlyCashFlowForm monthlyCashFlowForm : cashFlow.getMonthlyCashFlows()) { validateExpense(messageContext, monthlyCashFlowForm); validateRevenue(messageContext, monthlyCashFlowForm); validateNotes(messageContext, monthlyCashFlowForm); } validateCumulativeCashFlow(cashFlow, messageContext); validateTotalCapitalAndLiability(cashFlow, messageContext); validateIndebtednessRatio(cashFlow, messageContext); setTotalsOnCashFlowForm(cashFlow, messageContext); } }
CashFlowValidator { public void validateCaptureCashFlow(CashFlowForm cashFlow, ValidationContext context) { MessageContext messageContext = context.getMessageContext(); for (MonthlyCashFlowForm monthlyCashFlowForm : cashFlow.getMonthlyCashFlows()) { validateExpense(messageContext, monthlyCashFlowForm); validateRevenue(messageContext, monthlyCashFlowForm); validateNotes(messageContext, monthlyCashFlowForm); } validateCumulativeCashFlow(cashFlow, messageContext); validateTotalCapitalAndLiability(cashFlow, messageContext); validateIndebtednessRatio(cashFlow, messageContext); setTotalsOnCashFlowForm(cashFlow, messageContext); }  }
CashFlowValidator { public void validateCaptureCashFlow(CashFlowForm cashFlow, ValidationContext context) { MessageContext messageContext = context.getMessageContext(); for (MonthlyCashFlowForm monthlyCashFlowForm : cashFlow.getMonthlyCashFlows()) { validateExpense(messageContext, monthlyCashFlowForm); validateRevenue(messageContext, monthlyCashFlowForm); validateNotes(messageContext, monthlyCashFlowForm); } validateCumulativeCashFlow(cashFlow, messageContext); validateTotalCapitalAndLiability(cashFlow, messageContext); validateIndebtednessRatio(cashFlow, messageContext); setTotalsOnCashFlowForm(cashFlow, messageContext); }  void validateCaptureCashFlow(CashFlowForm cashFlow, ValidationContext context); }
CashFlowValidator { public void validateCaptureCashFlow(CashFlowForm cashFlow, ValidationContext context) { MessageContext messageContext = context.getMessageContext(); for (MonthlyCashFlowForm monthlyCashFlowForm : cashFlow.getMonthlyCashFlows()) { validateExpense(messageContext, monthlyCashFlowForm); validateRevenue(messageContext, monthlyCashFlowForm); validateNotes(messageContext, monthlyCashFlowForm); } validateCumulativeCashFlow(cashFlow, messageContext); validateTotalCapitalAndLiability(cashFlow, messageContext); validateIndebtednessRatio(cashFlow, messageContext); setTotalsOnCashFlowForm(cashFlow, messageContext); }  void validateCaptureCashFlow(CashFlowForm cashFlow, ValidationContext context);  }