use of se.inera.intyg.schemas.contract.Personnummer in project webcert by sklintyg.
the class ArendeServiceTest method testFilterArendeFiltersOutNonVerifiedSekretessPatients.
@Test
@SuppressWarnings("unchecked")
public void testFilterArendeFiltersOutNonVerifiedSekretessPatients() {
WebCertUser webCertUser = createUser();
Map<Personnummer, SekretessStatus> map = mock(Map.class);
when(map.get(any(Personnummer.class))).thenReturn(SekretessStatus.UNDEFINED);
doReturn(map).when(patientDetailsResolver).getSekretessStatusForList(anyList());
when(webcertUserService.getUser()).thenReturn(webCertUser);
when(webcertUserService.isAuthorizedForUnit(any(), eq(true))).thenReturn(true);
List<Arende> queryResults = new ArrayList<>();
queryResults.add(buildArende(UUID.randomUUID().toString(), LocalDateTime.now(), null));
queryResults.add(buildArende(UUID.randomUUID().toString(), LocalDateTime.now().minusDays(1), null));
when(arendeRepository.filterArende(any(Filter.class))).thenReturn(queryResults);
QueryFragaSvarResponse fsResponse = new QueryFragaSvarResponse();
fsResponse.setResults(new ArrayList<>());
fsResponse.setTotalCount(0);
when(fragaSvarService.filterFragaSvar(any(Filter.class))).thenReturn(fsResponse);
QueryFragaSvarParameter params = new QueryFragaSvarParameter();
params.setEnhetId(webCertUser.getValdVardenhet().getId());
QueryFragaSvarResponse response = service.filterArende(params);
verify(patientDetailsResolver, times(1)).getSekretessStatusForList(anyList());
verify(webcertUserService).isAuthorizedForUnit(anyString(), eq(true));
verify(arendeRepository).filterArende(any(Filter.class));
verify(fragaSvarService).filterFragaSvar(any(Filter.class));
assertEquals(0, response.getResults().size());
}
use of se.inera.intyg.schemas.contract.Personnummer in project webcert by sklintyg.
the class CertificateSenderServiceImplTest method sendCertificateTest.
@Test
public void sendCertificateTest() throws Exception {
final String intygsId = "intygsId";
final Personnummer personId = createPnr("19121212-1212");
final String jsonBody = "jsonBody";
final String recipientId = "recipientId";
service.sendCertificate(intygsId, personId, jsonBody, recipientId);
ArgumentCaptor<MessageCreator> messageCaptor = ArgumentCaptor.forClass(MessageCreator.class);
verify(template).send(messageCaptor.capture());
Message res = messageCaptor.getValue().createMessage(session);
assertEquals(Constants.SEND_MESSAGE, res.getStringProperty(Constants.MESSAGE_TYPE));
assertEquals(intygsId, res.getStringProperty(Constants.INTYGS_ID));
assertEquals(personId.getPersonnummer(), res.getStringProperty(Constants.PERSON_ID));
assertEquals(recipientId, res.getStringProperty(Constants.RECIPIENT));
assertEquals(LOGICAL_ADDRESS, res.getStringProperty(Constants.LOGICAL_ADDRESS));
assertNull(res.getStringProperty(Constants.DELAY_MESSAGE));
assertEquals(jsonBody, ((TextMessage) res).getText());
}
use of se.inera.intyg.schemas.contract.Personnummer in project webcert by sklintyg.
the class ElegWebCertUserDetailsServiceTest method buildPersonSvar.
private PersonSvar buildPersonSvar(boolean sekretessMarkerad, PersonSvar.Status status) {
Personnummer personnummer = Personnummer.createPersonnummer(PERSON_ID).get();
Person person = new Person(personnummer, sekretessMarkerad, false, "fornamn", "", "Efternamn", "gatan", "12345", "postort");
return new PersonSvar(person, status);
}
use of se.inera.intyg.schemas.contract.Personnummer in project webcert by sklintyg.
the class IntygDraftsConverterTest method testConvertIntygToListEntries.
@Test
public void testConvertIntygToListEntries() {
LocalDateTime modfied = LocalDateTime.parse("2014-01-01T10:00:00");
String id = "123";
String type = "type";
String updatedSignedBy = "Dr Dengroth";
String updatedSignedByHsaId = "HSA1234";
Personnummer patientId = Personnummer.createPersonnummer("19121212-1212").get();
List<Utkast> utkastList = Collections.singletonList(TestIntygFactory.createUtkast(id, modfied, type, updatedSignedBy, updatedSignedByHsaId, UtkastStatus.DRAFT_COMPLETE, patientId));
List<ListIntygEntry> res = IntygDraftsConverter.convertUtkastsToListIntygEntries(utkastList);
assertNotNull(res);
assertEquals(1, res.size());
ListIntygEntry ref = res.get(0);
assertEquals(id, ref.getIntygId());
assertEquals(type, ref.getIntygType());
assertEquals("DRAFT_COMPLETE", ref.getStatus());
assertEquals(updatedSignedBy, ref.getUpdatedSignedBy());
assertEquals(modfied, ref.getLastUpdatedSigned());
}
use of se.inera.intyg.schemas.contract.Personnummer in project webcert by sklintyg.
the class ArendeViewConverterTest method buildGrundData.
private GrundData buildGrundData(String enhetsId, String enhetsNamn, String patientPersonId, String skapadavPersonId, LocalDateTime timeStamp) {
GrundData grundData = new GrundData();
HoSPersonal skapadAv = new HoSPersonal();
Vardenhet vardenhet = new Vardenhet();
vardenhet.setEnhetsid(enhetsId);
vardenhet.setEnhetsnamn(enhetsNamn);
Vardgivare vardgivare = new Vardgivare();
vardgivare.setVardgivarid("vardgivarid");
vardgivare.setVardgivarnamn("vardgivarnamn");
vardenhet.setVardgivare(vardgivare);
skapadAv.setVardenhet(vardenhet);
skapadAv.setFullstandigtNamn(skapadavPersonId);
skapadAv.setPersonId(skapadavPersonId);
grundData.setSkapadAv(skapadAv);
Patient patient = new Patient();
Personnummer personId = Personnummer.createPersonnummer(patientPersonId).get();
patient.setPersonId(personId);
grundData.setPatient(patient);
grundData.setSigneringsdatum(timeStamp);
return grundData;
}
Aggregations