Search in sources :

Example 1 with Utkast

use of se.inera.intyg.webcert.persistence.utkast.model.Utkast in project webcert by sklintyg.

the class UtkastRepositoryTest method testGetIntygsStatus.

@Test
public void testGetIntygsStatus() {
    Utkast intyg3 = utkastRepository.save(UtkastTestUtil.buildUtkast(UtkastTestUtil.ENHET_3_ID, UtkastStatus.DRAFT_COMPLETE));
    UtkastStatus status = utkastRepository.getIntygsStatus(intyg3.getIntygsId());
    assertThat(status, is(UtkastStatus.DRAFT_COMPLETE));
}
Also used : UtkastStatus(se.inera.intyg.webcert.common.model.UtkastStatus) Utkast(se.inera.intyg.webcert.persistence.utkast.model.Utkast) Test(org.junit.Test)

Example 2 with Utkast

use of se.inera.intyg.webcert.persistence.utkast.model.Utkast in project webcert by sklintyg.

the class UtkastRepositoryTest method testFindOneWithSignature.

@Test
public void testFindOneWithSignature() {
    Utkast utkast = UtkastTestUtil.buildUtkast(UtkastTestUtil.ENHET_1_ID);
    String intygsId = utkast.getIntygsId();
    utkast.setSignatur(UtkastTestUtil.buildSignatur(intygsId, "A", LocalDateTime.now()));
    Utkast saved = utkastRepository.save(utkast);
    Utkast read = utkastRepository.findOne(intygsId);
    assertThat(read.getIntygsId(), is(equalTo(saved.getIntygsId())));
    assertThat(read.getSignatur(), is(notNullValue()));
}
Also used : Utkast(se.inera.intyg.webcert.persistence.utkast.model.Utkast) Test(org.junit.Test)

Example 3 with Utkast

use of se.inera.intyg.webcert.persistence.utkast.model.Utkast in project webcert by sklintyg.

the class UtkastRepositoryTest method testSaveRelation.

@Test
public void testSaveRelation() {
    final String relationIntygsId = "relationIntygsId";
    final RelationKod relationKod = RelationKod.FRLANG;
    Utkast saved = utkastRepository.save(UtkastTestUtil.buildUtkast(UtkastTestUtil.ENHET_1_ID, relationIntygsId, relationKod));
    Utkast read = utkastRepository.findOne(saved.getIntygsId());
    assertEquals(UtkastTestUtil.ENHET_1_ID, read.getEnhetsId());
    assertEquals(relationIntygsId, read.getRelationIntygsId());
    assertEquals(relationKod, read.getRelationKod());
}
Also used : Utkast(se.inera.intyg.webcert.persistence.utkast.model.Utkast) RelationKod(se.inera.intyg.common.support.common.enumerations.RelationKod) Test(org.junit.Test)

Example 4 with Utkast

use of se.inera.intyg.webcert.persistence.utkast.model.Utkast in project webcert by sklintyg.

the class UtkastRepositoryTest method testFindByEnhetsIdDontReturnSigned.

@Test
public void testFindByEnhetsIdDontReturnSigned() {
    Utkast utkast1 = utkastRepository.save(UtkastTestUtil.buildUtkast(UtkastTestUtil.ENHET_1_ID, UtkastStatus.DRAFT_COMPLETE));
    Utkast utkast2 = utkastRepository.save(UtkastTestUtil.buildUtkast(UtkastTestUtil.ENHET_1_ID, UtkastStatus.DRAFT_COMPLETE));
    Utkast utkast3 = utkastRepository.save(UtkastTestUtil.buildUtkast(UtkastTestUtil.ENHET_3_ID, UtkastStatus.DRAFT_COMPLETE));
    utkastRepository.save(UtkastTestUtil.buildUtkast(UtkastTestUtil.ENHET_1_ID, UtkastStatus.SIGNED));
    utkastRepository.save(UtkastTestUtil.buildUtkast(UtkastTestUtil.ENHET_2_ID, UtkastStatus.SIGNED));
    List<Utkast> result = utkastRepository.findByEnhetsIdsAndStatuses(Arrays.asList(UtkastTestUtil.ENHET_1_ID, UtkastTestUtil.ENHET_3_ID), Arrays.asList(UtkastStatus.DRAFT_COMPLETE));
    assertThat(result.size(), is(3));
    assertThat(utkast1, isIn(result));
    assertThat(utkast2, isIn(result));
    assertThat(utkast3, isIn(result));
}
Also used : Utkast(se.inera.intyg.webcert.persistence.utkast.model.Utkast) Test(org.junit.Test)

Example 5 with Utkast

use of se.inera.intyg.webcert.persistence.utkast.model.Utkast in project webcert by sklintyg.

the class UtkastRepositoryTest method testFindOneByIntygsIdAndIntygsTyp.

@Test
public void testFindOneByIntygsIdAndIntygsTyp() {
    final String intygsId = "intygsId";
    final String intygsTyp = "intygsTyp";
    Utkast utkast = UtkastTestUtil.buildUtkast(UtkastTestUtil.ENHET_1_ID);
    utkast.setIntygsId(intygsId);
    utkast.setIntygsTyp(intygsTyp);
    utkastRepository.save(utkast);
    Utkast res = utkastRepository.findOneByIntygsIdAndIntygsTyp(intygsId, intygsTyp);
    assertNotNull(res);
}
Also used : Utkast(se.inera.intyg.webcert.persistence.utkast.model.Utkast) Test(org.junit.Test)

Aggregations

Utkast (se.inera.intyg.webcert.persistence.utkast.model.Utkast)171 Test (org.junit.Test)88 WebCertServiceException (se.inera.intyg.webcert.common.service.exception.WebCertServiceException)34 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)24 Personnummer (se.inera.intyg.schemas.contract.Personnummer)21 Signatur (se.inera.intyg.webcert.persistence.utkast.model.Signatur)21 VardpersonReferens (se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens)21 LogRequest (se.inera.intyg.webcert.web.service.log.dto.LogRequest)18 WebCertUser (se.inera.intyg.webcert.web.service.user.dto.WebCertUser)17 Arende (se.inera.intyg.webcert.persistence.arende.model.Arende)16 Utlatande (se.inera.intyg.common.support.model.common.internal.Utlatande)14 CreateNewDraftRequest (se.inera.intyg.webcert.web.service.utkast.dto.CreateNewDraftRequest)13 Patient (se.inera.intyg.common.support.model.common.internal.Patient)12 ModuleException (se.inera.intyg.common.support.modules.support.api.exception.ModuleException)12 ListIntygEntry (se.inera.intyg.webcert.web.web.controller.api.dto.ListIntygEntry)12 Transactional (org.springframework.transaction.annotation.Transactional)11 ModuleNotFoundException (se.inera.intyg.common.support.modules.registry.ModuleNotFoundException)11 MedicinsktArende (se.inera.intyg.webcert.persistence.arende.model.MedicinsktArende)11 CopyUtkastBuilderResponse (se.inera.intyg.webcert.web.service.utkast.dto.CopyUtkastBuilderResponse)10 ArrayList (java.util.ArrayList)9