Search in sources :

Example 1 with FragaSvarStatus

use of se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvarStatus 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 FragaSvarStatus

use of se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvarStatus 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 FragaSvarStatus

use of se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvarStatus 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 FragaSvarStatus

use of se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvarStatus 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 FragaSvarStatus

use of se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvarStatus in project webcert by sklintyg.

the class FragorOchSvarCreatorImpl method performFragorCount.

private Pair<ArendeCount, ArendeCount> performFragorCount(List<FragaSvarStatus> fsStatuses) {
    int skickadeFragorTotalt = 0;
    int skickadeFragorBesvarade = 0;
    int skickadeFragorEjBesvarade = 0;
    int skickadeFragorHanterade = 0;
    int mottagnaFragorTotalt = 0;
    int mottagnaFragorBesvarade = 0;
    int mottagnaFragorEjBesvarade = 0;
    int mottagnaFragorHanterade = 0;
    for (FragaSvarStatus fsStatus : fsStatuses) {
        if (isFromWebcert(fsStatus)) {
            skickadeFragorTotalt++;
            if (fsStatus.isClosed()) {
                skickadeFragorHanterade++;
            } else if (fsStatus.hasAnswerSet()) {
                skickadeFragorBesvarade++;
            } else {
                skickadeFragorEjBesvarade++;
            }
        } else if (isFromFK(fsStatus)) {
            mottagnaFragorTotalt++;
            if (fsStatus.isClosed()) {
                mottagnaFragorHanterade++;
            } else if (fsStatus.hasAnswerSet()) {
                mottagnaFragorBesvarade++;
            } else {
                mottagnaFragorEjBesvarade++;
            }
        }
    }
    return Pair.of(new ArendeCount(skickadeFragorTotalt, skickadeFragorEjBesvarade, skickadeFragorBesvarade, skickadeFragorHanterade), new ArendeCount(mottagnaFragorTotalt, mottagnaFragorEjBesvarade, mottagnaFragorBesvarade, mottagnaFragorHanterade));
}
Also used : ArendeCount(se.inera.intyg.common.support.modules.support.api.notification.ArendeCount) FragaSvarStatus(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvarStatus) Fk7263EntryPoint(se.inera.intyg.common.fk7263.support.Fk7263EntryPoint)

Aggregations

FragaSvarStatus (se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvarStatus)9 FragorOchSvar (se.inera.intyg.common.support.modules.support.api.notification.FragorOchSvar)8 Test (org.junit.Test)7 Fk7263EntryPoint (se.inera.intyg.common.fk7263.support.Fk7263EntryPoint)2 ArendeCount (se.inera.intyg.common.support.modules.support.api.notification.ArendeCount)1