use of org.nhindirect.monitor.condition.TxCompletionCondition in project nhin-d by DirectProject.
the class DSNMessageGenerator_generateDSNFailureMessageTest method createGenerator.
DSNMessageGenerator createGenerator() {
DSNGenerator dsnGenerator = new DSNGenerator("Not Delivered:");
TxCompletionCondition checker = new GeneralCompletionCondition();
DSNFailureTextBodyPartGenerator textGenerator = new DefaultDSNFailureTextBodyPartGenerator("", "", "", "", "", HumanReadableTextAssemblerFactory.getInstance());
return new DSNMessageGenerator(dsnGenerator, "postmaster", checker, "JUnitMTA", textGenerator);
}
use of org.nhindirect.monitor.condition.TxCompletionCondition in project nhin-d by DirectProject.
the class VariableCompletionCondition_isCompleteTest method testIsComplete_isTimely_assertNotComplete.
@SuppressWarnings("unchecked")
@Test
public void testIsComplete_isTimely_assertNotComplete() {
TxCompletionCondition timelyCond = mock(TxCompletionCondition.class);
TxCompletionCondition generalCond = mock(TxCompletionCondition.class);
when(generalCond.isComplete((Collection<Tx>) any())).thenReturn(true);
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);
assertFalse(spy.isComplete(null));
verify(timelyCond, times(1)).isComplete((Collection<Tx>) any());
verify(generalCond, never()).isComplete((Collection<Tx>) any());
}
use of org.nhindirect.monitor.condition.TxCompletionCondition in project nhin-d by DirectProject.
the class VariableCompletionCondition_isCompleteTest method testIsComplete_nullMessageToTrack_assertNull.
@SuppressWarnings("unchecked")
@Test
public void testIsComplete_nullMessageToTrack_assertNull() {
TxCompletionCondition cond1 = mock(TxCompletionCondition.class);
TxCompletionCondition cond2 = mock(TxCompletionCondition.class);
VariableCompletionCondition cond = new VariableCompletionCondition(cond1, cond2);
VariableCompletionCondition spy = spy(cond);
when(spy.getMessageToTrackInternal((Collection<Tx>) any())).thenReturn(null);
assertFalse(spy.isComplete(null));
}
use of org.nhindirect.monitor.condition.TxCompletionCondition in project nhin-d by DirectProject.
the class VariableCompletionCondition_isTimelyAndRequiredTest method testIsTimelyAndRequired_MDNOptionForTimely_assertTrue.
@Test
public void testIsTimelyAndRequired_MDNOptionForTimely_assertTrue() {
TxCompletionCondition cond1 = mock(TxCompletionCondition.class);
TxCompletionCondition cond2 = mock(TxCompletionCondition.class);
VariableCompletionCondition cond = new VariableCompletionCondition(cond1, cond2);
Map<String, TxDetail> details = new HashMap<String, TxDetail>();
details.put(TxDetailType.DISPOSITION_OPTIONS.getType(), new TxDetail(TxDetailType.DISPOSITION_OPTIONS, MDNStandard.DispositionOption_TimelyAndReliable));
Tx msg = new Tx(TxMessageType.IMF, details);
assertTrue(cond.isRelAndTimelyRequired(msg));
}
use of org.nhindirect.monitor.condition.TxCompletionCondition in project nhin-d by DirectProject.
the class VariableCompletionCondition_isTimelyAndRequiredTest method testIsTimelyAndRequired_MDNOptionNotForTimely_assertFalse.
@Test
public void testIsTimelyAndRequired_MDNOptionNotForTimely_assertFalse() {
TxCompletionCondition cond1 = mock(TxCompletionCondition.class);
TxCompletionCondition cond2 = mock(TxCompletionCondition.class);
VariableCompletionCondition cond = new VariableCompletionCondition(cond1, cond2);
Map<String, TxDetail> details = new HashMap<String, TxDetail>();
details.put(TxDetailType.DISPOSITION_OPTIONS.getType(), new TxDetail(TxDetailType.DISPOSITION_OPTIONS, "X-NOT-TIMELY"));
Tx msg = new Tx(TxMessageType.IMF, details);
assertFalse(cond.isRelAndTimelyRequired(msg));
}
Aggregations