@Test public void invalid() throws Exception { when(mockTemplate.validateMessage()).thenReturn(false); new ValidationPhase().runPhase(mockTemplate, mockContext, mockPhaseResultNotifier); verify(mockTemplate, times(1)).discardInvalidMessage(); verify(mockPhaseResultNotifier, Mockito.times(1)).phaseConsumedMessage(); }
@Test public void validationFails() throws Exception { when(mockTemplate.validateMessage()).thenReturn(false); doThrow(mockMulException).when(mockTemplate).discardInvalidMessage(); new ValidationPhase().runPhase(mockTemplate, mockContext, mockPhaseResultNotifier); verify(mockPhaseResultNotifier, Mockito.times(1)).phaseFailure(mockMulException); }
@Test public void valid() { when(mockTemplate.validateMessage()).thenReturn(true); new ValidationPhase().runPhase(mockTemplate, mockContext, mockPhaseResultNotifier); verify(mockPhaseResultNotifier, Mockito.times(1)).phaseSuccessfully(); }