use of se.inera.intyg.webcert.common.service.exception.WebCertServiceException in project webcert by sklintyg.
the class ArendeServiceTest method createQuestionInvalidCertificateTypeTest.
@Test
public void createQuestionInvalidCertificateTypeTest() {
Utkast utkast = new Utkast();
utkast.setSignatur(new Signatur());
utkast.setIntygsTyp("fk7263");
when(utkastRepository.findOne(anyString())).thenReturn(utkast);
try {
service.createMessage(INTYG_ID, ArendeAmne.KONTKT, "rubrik", "meddelande");
fail("should throw exception");
} catch (WebCertServiceException e) {
assertEquals(WebCertServiceErrorCodeEnum.INVALID_STATE, e.getErrorCode());
verifyZeroInteractions(arendeRepository);
verifyZeroInteractions(notificationService);
verifyZeroInteractions(arendeDraftService);
}
}
use of se.inera.intyg.webcert.common.service.exception.WebCertServiceException in project webcert by sklintyg.
the class ArendeServiceTest method createQuestionCertificateNotSignedTest.
@Test
public void createQuestionCertificateNotSignedTest() {
when(utkastRepository.findOne(anyString())).thenReturn(new Utkast());
try {
service.createMessage(INTYG_ID, ArendeAmne.KONTKT, "rubrik", "meddelande");
fail("should throw exception");
} catch (WebCertServiceException e) {
assertEquals(WebCertServiceErrorCodeEnum.INVALID_STATE, e.getErrorCode());
verifyZeroInteractions(arendeRepository);
verifyZeroInteractions(notificationService);
verifyZeroInteractions(arendeDraftService);
}
}
use of se.inera.intyg.webcert.common.service.exception.WebCertServiceException in project webcert by sklintyg.
the class ArendeServiceTest method testCreateQuestionIfCertificateIsRevoked.
@Test
public void testCreateQuestionIfCertificateIsRevoked() throws WebCertServiceException {
Utkast utkast = buildUtkast();
utkast.setAterkalladDatum(LocalDateTime.now());
when(utkastRepository.findOne(anyString())).thenReturn(utkast);
try {
service.createMessage(INTYG_ID, ArendeAmne.KONTKT, "rubrik", "meddelande");
fail("Should throw");
} catch (WebCertServiceException e) {
assertEquals(WebCertServiceErrorCodeEnum.CERTIFICATE_REVOKED, e.getErrorCode());
verify(arendeRepository, never()).save(any(Arende.class));
verifyZeroInteractions(notificationService);
verifyZeroInteractions(arendeDraftService);
}
}
use of se.inera.intyg.webcert.common.service.exception.WebCertServiceException in project webcert by sklintyg.
the class ArendeServiceTest method testProcessIncomingMessageCertificateNotFound.
@Test
public void testProcessIncomingMessageCertificateNotFound() {
try {
service.processIncomingMessage(new Arende());
fail("Should throw");
} catch (WebCertServiceException e) {
assertEquals(WebCertServiceErrorCodeEnum.DATA_NOT_FOUND, e.getErrorCode());
verify(arendeRepository, never()).save(any(Arende.class));
verifyZeroInteractions(notificationService);
verifyZeroInteractions(arendeDraftService);
}
}
use of se.inera.intyg.webcert.common.service.exception.WebCertServiceException in project webcert by sklintyg.
the class ArendeServiceTest method testProcessIncomingMessageCertificateNotSigned.
@Test
public void testProcessIncomingMessageCertificateNotSigned() {
when(utkastRepository.findOne(isNull())).thenReturn(new Utkast());
try {
service.processIncomingMessage(new Arende());
fail("Should throw");
} catch (WebCertServiceException e) {
assertEquals(WebCertServiceErrorCodeEnum.INVALID_STATE, e.getErrorCode());
verify(arendeRepository, never()).save(any(Arende.class));
verifyZeroInteractions(notificationService);
verifyZeroInteractions(arendeDraftService);
}
}
Aggregations