Search in sources :

Example 1 with FragorOchSvar

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);
}
Also used : FragorOchSvar(se.inera.intyg.common.support.modules.support.api.notification.FragorOchSvar) FragaSvarStatus(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvarStatus) Test(org.junit.Test)

Example 2 with FragorOchSvar

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);
}
Also used : FragorOchSvar(se.inera.intyg.common.support.modules.support.api.notification.FragorOchSvar) FragaSvarStatus(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvarStatus) Test(org.junit.Test)

Example 3 with FragorOchSvar

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);
}
Also used : FragorOchSvar(se.inera.intyg.common.support.modules.support.api.notification.FragorOchSvar) FragaSvarStatus(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvarStatus) Test(org.junit.Test)

Example 4 with FragorOchSvar

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);
}
Also used : FragorOchSvar(se.inera.intyg.common.support.modules.support.api.notification.FragorOchSvar) FragaSvarStatus(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvarStatus) Test(org.junit.Test)

Example 5 with FragorOchSvar

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);
}
Also used : FragorOchSvar(se.inera.intyg.common.support.modules.support.api.notification.FragorOchSvar) NotificationMessage(se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage) Utkast(se.inera.intyg.webcert.persistence.utkast.model.Utkast) Test(org.junit.Test)

Aggregations

FragorOchSvar (se.inera.intyg.common.support.modules.support.api.notification.FragorOchSvar)12 Test (org.junit.Test)8 FragaSvarStatus (se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvarStatus)8 NotificationMessage (se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage)3 LocalDateTime (java.time.LocalDateTime)2 Fk7263EntryPoint (se.inera.intyg.common.fk7263.support.Fk7263EntryPoint)1 ArendeCount (se.inera.intyg.common.support.modules.support.api.notification.ArendeCount)1 Utkast (se.inera.intyg.webcert.persistence.utkast.model.Utkast)1