use of se.inera.intyg.webcert.web.service.intyg.dto.IntygServiceResult in project webcert by sklintyg.
the class IntygServiceSendTest method testSendIntygReturnsInfo.
@Test
public void testSendIntygReturnsInfo() throws Exception {
final String completionMeddelandeId = "meddelandeId";
SendCertificateToRecipientResponseType response = new SendCertificateToRecipientResponseType();
response.setResult(ResultTypeUtil.infoResult("Info text"));
WebCertUser webCertUser = createUser();
Utlatande completionUtlatande = utlatande;
completionUtlatande.getGrundData().setRelation(new Relation());
completionUtlatande.getGrundData().getRelation().setRelationKod(RelationKod.KOMPLT);
completionUtlatande.getGrundData().getRelation().setMeddelandeId(completionMeddelandeId);
when(moduleFacade.getUtlatandeFromInternalModel(isNull(), anyString())).thenReturn(completionUtlatande);
when(webCertUserService.isAuthorizedForUnit(anyString(), anyString(), anyBoolean())).thenReturn(true);
when(patientDetailsResolver.getSekretessStatus(any(Personnummer.class))).thenReturn(SekretessStatus.FALSE);
when(webCertUserService.getUser()).thenReturn(webCertUser);
when(intygRepository.findOne(INTYG_ID)).thenReturn(getUtkast(INTYG_ID));
IntygServiceResult res = intygService.sendIntyg(INTYG_ID, INTYG_TYP_FK, "FKASSA", false);
assertEquals(IntygServiceResult.OK, res);
verify(logService).logSendIntygToRecipient(any(LogRequest.class));
verify(certificateSenderService).sendCertificate(anyString(), any(Personnummer.class), anyString(), anyString(), eq(false));
verify(intygRepository, times(2)).findOne(INTYG_ID);
verify(intygRepository).save(any(Utkast.class));
}
use of se.inera.intyg.webcert.web.service.intyg.dto.IntygServiceResult in project webcert by sklintyg.
the class IntygServiceStoreTest method testStoreIntyg.
@Test
public void testStoreIntyg() throws Exception {
IntygServiceResult res = intygService.storeIntyg(createUtkast());
assertEquals(IntygServiceResult.OK, res);
verify(certificateSenderService, times(1)).storeCertificate(INTYG_ID, INTYG_TYP_FK, json);
verify(monitoringService).logIntygRegistered(INTYG_ID, INTYG_TYP_FK);
}
Aggregations