use of se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar in project webcert by sklintyg.
the class FragaSvarRepositoryTest method testFragaSenasteHandelse.
@Test
public void testFragaSenasteHandelse() {
FragaSvar saved = buildFragaSvarFraga("Enhet-1-id", Status.PENDING_EXTERNAL_ACTION);
fragasvarRepository.save(saved);
FragaSvar read = fragasvarRepository.findByExternReferens(saved.getExternReferens());
assertEquals(read.getFrageSkickadDatum(), read.getSenasteHandelse());
read.setSvarsText("svarstext");
read.setSvarSkickadDatum(SVAR_SENT_DATE);
read.setSvarSigneringsDatum(SVAR_SIGN_DATE);
FragaSvar svar2 = fragasvarRepository.save(read);
FragaSvar read2 = fragasvarRepository.findByExternReferens(svar2.getExternReferens());
assertEquals(read2.getSvarSkickadDatum(), read2.getSenasteHandelse());
}
use of se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar in project webcert by sklintyg.
the class FragaSvarRepositoryTest method testFindOne.
@Test
public void testFindOne() {
FragaSvar saved = buildFragaSvarFraga(ENHET_1_ID);
fragasvarRepository.save(saved);
FragaSvar read = fragasvarRepository.findOne(saved.getInternReferens());
assertEquals(read.getInternReferens(), saved.getInternReferens());
assertEquals(read.getAmne(), saved.getAmne());
assertEquals(read.getExternReferens(), saved.getExternReferens());
assertEquals(read.getFrageSigneringsDatum(), saved.getFrageSigneringsDatum());
assertEquals(read.getFrageSkickadDatum(), saved.getFrageSkickadDatum());
assertEquals(read.getFrageStallare(), saved.getFrageStallare());
assertEquals(read.getFrageText(), saved.getFrageText());
assertEquals(read.getIntygsReferens(), saved.getIntygsReferens());
}
use of se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar in project webcert by sklintyg.
the class FragaSvarRepositoryTest method testFilterFragaSvarFiltersOutByIntygsTyp.
@Test
public void testFilterFragaSvarFiltersOutByIntygsTyp() {
fragasvarRepository.save(buildFragaSvarFraga(ENHET_1_ID, Status.PENDING_INTERNAL_ACTION, HSA_1_ID, HSA_1_NAMN));
Filter filter = new Filter();
filter.getIntygsTyper().add("annan-typ");
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 testFilterFragaSvarMatchesOnIntygsTyp.
@Test
public void testFilterFragaSvarMatchesOnIntygsTyp() {
fragasvarRepository.save(buildFragaSvarFraga(ENHET_1_ID, Status.PENDING_INTERNAL_ACTION, HSA_1_ID, HSA_1_NAMN));
Filter filter = new Filter();
filter.getIntygsTyper().add("fk7263");
filter.getEnhetsIds().add(ENHET_1_ID);
List<FragaSvar> fragaSvar = fragasvarRepository.filterFragaSvar(filter);
assertEquals(1, fragaSvar.size());
}
use of se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar in project webcert by sklintyg.
the class FragaSvarTestUtil method buildFraga.
public static FragaSvar buildFraga(long fragaSvarId, String enhetsId, Status status, Amne amne, String fragestallare, String hsaId, LocalDateTime fragaSkickad, boolean vidarebefordrad) {
FragaSvar f = new FragaSvar();
f.setInternReferens(fragaSvarId);
f.setExternaKontakter(new HashSet<>(Arrays.asList("KONTAKT1", "KONTAKT2", "KONTAKT3")));
if (fragestallare.equalsIgnoreCase("FKASSA")) {
f.setExternReferens("externReferens-" + fragaSvarId);
}
f.setFrageSigneringsDatum(fragaSkickad);
f.setFrageSkickadDatum(fragaSkickad);
f.setAmne((amne != null) ? amne : Amne.OVRIGT);
f.setVidarebefordrad(vidarebefordrad);
f.setFrageStallare(fragestallare);
Vardperson vardperson = new Vardperson();
vardperson.setHsaId(hsaId);
vardperson.setEnhetsId(enhetsId);
vardperson.setEnhetsnamn(enhetsId + "-namnet");
f.setVardperson(vardperson);
f.setFrageText(FRAGA_TEXT);
f.setIntygsReferens(INTYGS_REFERENS);
f.setStatus(status);
return f;
}
Aggregations