use of se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionResponseType in project webcert by sklintyg.
the class ReceiveQuestionResponderImpl method receiveMedicalCertificateQuestion.
@Override
public ReceiveMedicalCertificateQuestionResponseType receiveMedicalCertificateQuestion(AttributedURIType logicalAddress, ReceiveMedicalCertificateQuestionType request) {
ReceiveMedicalCertificateQuestionResponseType response = new ReceiveMedicalCertificateQuestionResponseType();
// Validate incoming request
List<String> validationMessages = QuestionAnswerValidator.validate(request);
if (!validationMessages.isEmpty()) {
response.setResult(ResultOfCallUtil.failResult(Joiner.on(",").join(validationMessages)));
return response;
}
// Transform to a FragaSvar object
FragaSvar fragaSvar = converter.convert(request.getQuestion());
// Notify stakeholders
sendNotification(processQuestion(fragaSvar));
// Set result and send response back to caller
response.setResult(ResultOfCallUtil.okResult());
return response;
}
use of se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionResponseType in project webcert by sklintyg.
the class ReceiveQuestionResponderImplTest method testReceiveQuestionValidationError.
@Test
public void testReceiveQuestionValidationError() {
ReceiveMedicalCertificateQuestionType request = createRequest("RecieveQuestionAnswerResponders/question-from-fk-integrated.xml");
// invalid
request.getQuestion().setAmne(null);
ReceiveMedicalCertificateQuestionResponseType response = receiveQuestionResponder.receiveMedicalCertificateQuestion(null, request);
verifyZeroInteractions(mockNotificationService);
verifyZeroInteractions(mockFragaSvarService);
assertNotNull(response);
assertEquals(ResultCodeEnum.ERROR, response.getResult().getResultCode());
assertEquals(ErrorIdEnum.VALIDATION_ERROR, response.getResult().getErrorId());
assertEquals("Amne är felaktigt", response.getResult().getErrorText());
}
use of se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionResponseType in project webcert by sklintyg.
the class ReceiveQuestionResponderImplTest method testReceiveQuestionOK.
@Test
public void testReceiveQuestionOK() {
FragaSvar fraga = buildFraga(INTEGRERAD_ENHET, Status.PENDING_INTERNAL_ACTION);
when(mockFragaSvarService.processIncomingQuestion(any(FragaSvar.class))).thenReturn(fraga);
ReceiveMedicalCertificateQuestionType request = createRequest("RecieveQuestionAnswerResponders/question-from-fk-integrated.xml");
ReceiveMedicalCertificateQuestionResponseType response = receiveQuestionResponder.receiveMedicalCertificateQuestion(null, request);
// should place notification on queue
verify(mockNotificationService).sendNotificationForQuestionReceived(any(FragaSvar.class));
assertNotNull(response);
assertEquals(ResultCodeEnum.OK, response.getResult().getResultCode());
}
Aggregations