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