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);
}
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);
}
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);
}
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);
}
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));
}
Aggregations