use of se.inera.intyg.infra.security.exception.MissingMedarbetaruppdragException in project webcert by sklintyg.
the class CreateDraftCertificateResponderImplTest method testCreateDraftCertificateHsaException.
@Test
public void testCreateDraftCertificateHsaException() {
when(webcertUserDetailsService.loadUserByHsaId(USER_HSAID)).thenThrow(new MissingMedarbetaruppdragException(USER_HSAID));
CreateDraftCertificateType certificateType = createCertificateType();
CreateDraftCertificateResponseType response = responder.createDraftCertificate(LOGICAL_ADDR, certificateType);
verifyZeroInteractions(mockUtkastService);
verifyZeroInteractions(mockIntegreradeEnheterService);
verify(monitoringLogService).logMissingMedarbetarUppdrag(USER_HSAID, UNIT_HSAID);
assertNotNull(response);
assertEquals(response.getResult().getResultCode(), ResultCodeType.ERROR);
assertEquals(ErrorIdType.VALIDATION_ERROR, response.getResult().getErrorId());
assertEquals("No valid MIU was found for person SE1234567890 on unit SE0987654321, can not create draft!", response.getResult().getResultText());
}
Aggregations