@Test public void shouldNotAutoClosePNCCaseWhenMotherDoesNotExist() { DateTime currentTime = DateUtil.now(); mockCurrentDate(currentTime); when(allMothers.findByCaseId("MOTHER-CASE-1")).thenReturn(null); service.autoClosePNCCase("MOTHER-CASE-1"); verify(allMothers, times(0)).close("MOTHER-CASE-1"); verifyZeroInteractions(actionService); }
@Test public void shouldAutoClosePNCCaseWhenMotherExists() { DateTime currentTime = DateUtil.now(); mockCurrentDate(currentTime); when(allMothers.findByCaseId("MOTHER-CASE-1")) .thenReturn(new Mother("MOTHER-CASE-1", "EC-CASE-1", "TC1").withAnm("ANM 1")); service.autoClosePNCCase("MOTHER-CASE-1"); verify(allMothers).close("MOTHER-CASE-1"); verify(actionService).markAllAlertsAsInactive("MOTHER-CASE-1"); verify(actionService).closeMother("MOTHER-CASE-1", "ANM 1", "Auto Close PNC"); verifyZeroInteractions(motherReportingService); }