@Test
public void doNotValidateCumulativeCashIfRevenueOrExpenseNotGiven() {

    when(validationContext.getMessageContext()).thenReturn(messageContext);
    when(messageContext.hasErrorMessages()).thenReturn(true);
    DateTime may = new DateTime(2001, 5, 12, 0, 0, 0, 0);
    DateTime june = new DateTime(2001, 6, 12, 0, 0, 0, 0);
    DateTime july = new DateTime(2001, 7, 12, 0, 0, 0, 0);
    MonthlyCashFlowDetail cashFlowDetail1 = new MonthlyCashFlowDetail(may, new BigDecimal(12), new BigDecimal(13), "notes");
    MonthlyCashFlowDetail cashFlowDetail2 = new MonthlyCashFlowDetail(june, null, null, "notes");
    CashFlowDetail cashFlowDetail = new CashFlowDetail(asList(cashFlowDetail1, cashFlowDetail2));
    CashFlowForm cashFlowForm = new CashFlowForm(cashFlowDetail, false, new BigDecimal(1000), 10d);
    cashFlowValidator.validateCaptureCashFlow(cashFlowForm, validationContext);
    verify(messageContext, times(2)).hasErrorMessages();
    verify(validationContext).getMessageContext();
    verify(messageContext, never()).addMessage(argThat(new MessageMatcher(CashFlowConstants.CUMULATIVE_CASH_FLOW_FOR_MONTH_SHOULD_BE_GREATER_THAN_ZERO)));
}