use of org.nhindirect.monitor.condition.TxCompletionCondition in project nhin-d by DirectProject.
the class VariableCompletionCondition_isCompleteTest method testIsComplete_isTimely_assertComplete.
@SuppressWarnings("unchecked")
@Test
public void testIsComplete_isTimely_assertComplete() {
TxCompletionCondition timelyCond = mock(TxCompletionCondition.class);
when(timelyCond.isComplete((Collection<Tx>) any())).thenReturn(true);
TxCompletionCondition generalCond = mock(TxCompletionCondition.class);
VariableCompletionCondition cond = new VariableCompletionCondition(timelyCond, generalCond);
VariableCompletionCondition spy = spy(cond);
Tx msgToTrack = mock(Tx.class);
when(spy.getMessageToTrackInternal((Collection<Tx>) any())).thenReturn(msgToTrack);
when(spy.isRelAndTimelyRequired((Tx) any())).thenReturn(true);
assertTrue(spy.isComplete(null));
verify(timelyCond, times(1)).isComplete((Collection<Tx>) any());
verify(generalCond, never()).isComplete((Collection<Tx>) any());
}
Aggregations