use of se.inera.intyg.common.support.modules.support.api.notification.FragorOchSvar in project webcert by sklintyg.
the class FragorOchSvarCreatorTest method testPerformCountHan7.
@Test
public void testPerformCountHan7() {
when(fragaSvarRepository.findFragaSvarStatusesForIntyg(INTYG_ID)).thenReturn(Collections.singletonList(new FragaSvarStatus(1L, FRAGESTALLARE_WEBCERT, "Ett svar från FK", Status.ANSWERED)));
FragorOchSvar fos = fsCreator.createFragorOchSvar(INTYG_ID);
assertNotNull(fos);
assertEquals(0, fos.getAntalFragor());
assertEquals(0, fos.getAntalHanteradeFragor());
assertEquals(1, fos.getAntalSvar());
assertEquals(0, fos.getAntalHanteradeSvar());
verify(fragaSvarRepository).findFragaSvarStatusesForIntyg(INTYG_ID);
verifyNoMoreInteractions(fragaSvarRepository);
verifyNoMoreInteractions(arendeRepository);
}
use of se.inera.intyg.common.support.modules.support.api.notification.FragorOchSvar in project webcert by sklintyg.
the class FragorOchSvarCreatorTest method testPerformCountHan10.
@Test
public void testPerformCountHan10() {
when(fragaSvarRepository.findFragaSvarStatusesForIntyg(INTYG_ID)).thenReturn(Collections.singletonList(new FragaSvarStatus(1L, FRAGESTALLARE_WEBCERT, "Ett svar från FK", Status.CLOSED)));
FragorOchSvar fos = fsCreator.createFragorOchSvar(INTYG_ID);
assertNotNull(fos);
assertEquals(0, fos.getAntalFragor());
assertEquals(0, fos.getAntalHanteradeFragor());
assertEquals(1, fos.getAntalSvar());
assertEquals(1, fos.getAntalHanteradeSvar());
verify(fragaSvarRepository).findFragaSvarStatusesForIntyg(INTYG_ID);
verifyNoMoreInteractions(fragaSvarRepository);
verifyNoMoreInteractions(arendeRepository);
}
use of se.inera.intyg.common.support.modules.support.api.notification.FragorOchSvar in project webcert by sklintyg.
the class FragorOchSvarCreatorTest method testPerformCountHan9Answered.
@Test
public void testPerformCountHan9Answered() {
when(fragaSvarRepository.findFragaSvarStatusesForIntyg(INTYG_ID)).thenReturn(Collections.singletonList(new FragaSvarStatus(1L, FRAGESTALLARE_FK, "Ett svar från WC", Status.CLOSED)));
FragorOchSvar fos = fsCreator.createFragorOchSvar(INTYG_ID);
assertNotNull(fos);
assertEquals(1, fos.getAntalFragor());
assertEquals(1, fos.getAntalHanteradeFragor());
assertEquals(0, fos.getAntalSvar());
assertEquals(0, fos.getAntalHanteradeSvar());
verify(fragaSvarRepository).findFragaSvarStatusesForIntyg(INTYG_ID);
verifyNoMoreInteractions(fragaSvarRepository);
verifyNoMoreInteractions(arendeRepository);
}
use of se.inera.intyg.common.support.modules.support.api.notification.FragorOchSvar in project webcert by sklintyg.
the class FragorOchSvarCreatorTest method testPerformCountHan6.
@Test
public void testPerformCountHan6() {
when(fragaSvarRepository.findFragaSvarStatusesForIntyg(INTYG_ID)).thenReturn(Collections.singletonList(new FragaSvarStatus(1L, FRAGESTALLARE_FK, null, Status.PENDING_INTERNAL_ACTION)));
FragorOchSvar fos = fsCreator.createFragorOchSvar(INTYG_ID);
assertNotNull(fos);
assertEquals(1, fos.getAntalFragor());
assertEquals(0, fos.getAntalHanteradeFragor());
assertEquals(0, fos.getAntalSvar());
assertEquals(0, fos.getAntalHanteradeSvar());
verify(fragaSvarRepository).findFragaSvarStatusesForIntyg(INTYG_ID);
verifyNoMoreInteractions(fragaSvarRepository);
verifyNoMoreInteractions(arendeRepository);
}
use of se.inera.intyg.common.support.modules.support.api.notification.FragorOchSvar in project webcert by sklintyg.
the class NotificationMessageFactoryTest method testCreateNotificationMessageForUsesFragorOchSvarSchemaVersion1.
@Test
public void testCreateNotificationMessageForUsesFragorOchSvarSchemaVersion1() {
when(mockFragorOchSvarCreator.createFragorOchSvar(INTYGS_ID)).thenReturn(new FragorOchSvar(1, 1, 1, 1));
Utkast utkast = createUtkast(INTYGS_ID);
final String reference = "ref";
NotificationMessage msg = notificationMessageFactory.createNotificationMessage(utkast, HandelsekodEnum.NYFRFM, SchemaVersion.VERSION_1, reference, null, null);
assertNotNull(msg);
assertNotNull(msg.getHandelse());
assertEquals(HandelsekodEnum.NYFRFM, msg.getHandelse());
assertNotNull(msg.getHandelseTid());
assertEquals(INTYGS_ID, msg.getIntygsId());
assertEquals(INTYGS_TYP, msg.getIntygsTyp());
assertEquals("SE12345678-1000", msg.getLogiskAdress());
assertEquals("{model}", msg.getUtkast());
assertEquals(SchemaVersion.VERSION_1, msg.getVersion());
assertEquals(reference, msg.getReference());
assertNotNull(msg.getFragaSvar());
assertEquals(1, msg.getFragaSvar().getAntalFragor());
assertEquals(1, msg.getFragaSvar().getAntalHanteradeFragor());
assertEquals(1, msg.getFragaSvar().getAntalHanteradeSvar());
assertEquals(1, msg.getFragaSvar().getAntalSvar());
assertNull(msg.getSkickadeFragor());
assertNull(msg.getMottagnaFragor());
assertNull(msg.getAmne());
assertNull(msg.getSistaSvarsDatum());
verify(mockFragorOchSvarCreator).createFragorOchSvar(INTYGS_ID);
verifyNoMoreInteractions(mockFragorOchSvarCreator);
}
Aggregations