Search in sources :

Example 1 with FragaSvar

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());
}
Also used : FragaSvar(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar) Test(org.junit.Test)

Example 2 with FragaSvar

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());
}
Also used : FragaSvar(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar) Test(org.junit.Test)

Example 3 with FragaSvar

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());
}
Also used : Filter(se.inera.intyg.webcert.persistence.model.Filter) FragaSvar(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar) Test(org.junit.Test)

Example 4 with FragaSvar

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());
}
Also used : Filter(se.inera.intyg.webcert.persistence.model.Filter) FragaSvar(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar) Test(org.junit.Test)

Example 5 with FragaSvar

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;
}
Also used : Vardperson(se.inera.intyg.webcert.persistence.fragasvar.model.Vardperson) FragaSvar(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar)

Aggregations

FragaSvar (se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar)71 Test (org.junit.Test)42 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)14 IntygsReferens (se.inera.intyg.webcert.persistence.fragasvar.model.IntygsReferens)11 Vardperson (se.inera.intyg.webcert.persistence.fragasvar.model.Vardperson)11 Produces (javax.ws.rs.Produces)7 AttributedURIType (org.w3.wsaddressing10.AttributedURIType)7 Path (javax.ws.rs.Path)6 Filter (se.inera.intyg.webcert.persistence.model.Filter)6 LocalDateTime (java.time.LocalDateTime)5 Consumes (javax.ws.rs.Consumes)5 WebCertUser (se.inera.intyg.webcert.web.service.user.dto.WebCertUser)5 ArendeListItem (se.inera.intyg.webcert.web.web.controller.api.dto.ArendeListItem)5 ArrayList (java.util.ArrayList)4 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)4 SendMedicalCertificateAnswerResponseType (se.inera.ifv.insuranceprocess.healthreporting.sendmedicalcertificateanswerresponder.v1.SendMedicalCertificateAnswerResponseType)4 SendMedicalCertificateAnswerType (se.inera.ifv.insuranceprocess.healthreporting.sendmedicalcertificateanswerresponder.v1.SendMedicalCertificateAnswerType)4 SendMedicalCertificateQuestionType (se.inera.ifv.insuranceprocess.healthreporting.sendmedicalcertificatequestionresponder.v1.SendMedicalCertificateQuestionType)4 WebCertServiceException (se.inera.intyg.webcert.common.service.exception.WebCertServiceException)4 Amne (se.inera.intyg.webcert.persistence.fragasvar.model.Amne)4