use of se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar in project webcert by sklintyg.
the class FragaSvarRepositoryTest method testFilterFragaSvarFiltersOutNoIntygsTyp.
@Test
public void testFilterFragaSvarFiltersOutNoIntygsTyp() {
fragasvarRepository.save(buildFragaSvarFraga(ENHET_1_ID, Status.PENDING_INTERNAL_ACTION, HSA_1_ID, HSA_1_NAMN));
Filter filter = new Filter();
filter.getEnhetsIds().add(ENHET_1_ID);
List<FragaSvar> fragaSvar = fragasvarRepository.filterFragaSvar(filter);
assertEquals(0, fragaSvar.size());
}
use of se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar in project webcert by sklintyg.
the class FragaSvarRepositoryTest method testFindByExternReferens.
@Test
public void testFindByExternReferens() {
FragaSvar saved = buildFragaSvarFraga("Enhet-1-id", Status.PENDING_EXTERNAL_ACTION);
fragasvarRepository.save(saved);
FragaSvar read = fragasvarRepository.findByExternReferens(saved.getExternReferens());
assertEquals(read.getInternReferens(), saved.getInternReferens());
}
use of se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar in project webcert by sklintyg.
the class FragaSvarRepositoryTest method testFindByIntygsReferens.
@Test
public void testFindByIntygsReferens() {
FragaSvar saved = buildFragaSvarFraga(ENHET_1_ID);
saved.setIntygsReferens(new IntygsReferens("non-existing-intygs-id", "fk", Personnummer.createPersonnummer("19121212-1212").get(), "Sven Persson", FRAGA_SENT_DATE));
fragasvarRepository.save(saved);
fragasvarRepository.save(buildFragaSvarFraga(ENHET_3_ID));
fragasvarRepository.save(buildFragaSvarFraga(ENHET_4_ID));
List<FragaSvar> result = fragasvarRepository.findByIntygsReferensIntygsId(INTYGS_REFERENS.getIntygsId());
assertEquals(2, result.size());
}
use of se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar in project webcert by sklintyg.
the class FragaSvarRepositoryTest method buildFragaSvarFraga.
private FragaSvar buildFragaSvarFraga(String enhetsId, Status status, String frageStallare, boolean answered) {
FragaSvar f = new FragaSvar();
f.setExternaKontakter(new HashSet<>(Arrays.asList("KONTAKT1", "KONTAKT2", "KONTAKT3")));
f.setAmne(Amne.AVSTAMNINGSMOTE);
f.setExternReferens("externReferens");
f.setFrageSigneringsDatum(FRAGA_SIGN_DATE);
f.setFrageSkickadDatum(FRAGA_SENT_DATE);
f.setFrageStallare(frageStallare);
Vardperson vardperson = new Vardperson();
vardperson.setEnhetsId(enhetsId);
vardperson.setEnhetsnamn(enhetsId + "-namnet");
f.setVardperson(vardperson);
f.setFrageText("Detta var ju otydligt formulerat!");
f.setIntygsReferens(INTYGS_REFERENS);
f.setStatus(status);
if (answered) {
f.setSvarsText("Ett svar på frågan");
}
return f;
}
use of se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar in project webcert by sklintyg.
the class FragaSvarModuleApiController method closeQAsAsHandled.
@PUT
@Path("/stang")
@Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET)
public List<FragaSvar> closeQAsAsHandled(List<QARequest> qas) {
List<FragaSvar> fragaSvars = new ArrayList<>();
for (QARequest qa : qas) {
abortIfFragaSvarNotActive(qa.getIntygsTyp());
fragaSvars.add(fragaSvarService.closeQuestionAsHandled(qa.getFragaSvarId()));
}
return fragaSvars;
}
Aggregations