use of se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionType in project webcert by sklintyg.
the class ReceiveQuestionResponderImplTest method createRequest.
private ReceiveMedicalCertificateQuestionType createRequest(String questionFile) {
ReceiveMedicalCertificateQuestionType request = new ReceiveMedicalCertificateQuestionType();
QuestionFromFkType question = inflateQuestion(questionFile);
if (question == null) {
throw new RuntimeException("Could not inflate file");
}
request.setQuestion(question);
return request;
}
use of se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionType 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.ReceiveMedicalCertificateQuestionType 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());
}
use of se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionType in project webcert by sklintyg.
the class QuestionAnswerValidatorTest method createValidQuestionRequest.
private ReceiveMedicalCertificateQuestionType createValidQuestionRequest() {
ReceiveMedicalCertificateQuestionType request = new ReceiveMedicalCertificateQuestionType();
try {
JAXBContext jaxbContext = JAXBContext.newInstance(QuestionFromFkType.class);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
QuestionFromFkType question = unmarshaller.unmarshal(new StreamSource(new ClassPathResource("QuestionAnswerValidator/valid-question-from-fk.xml").getInputStream()), QuestionFromFkType.class).getValue();
request.setQuestion(question);
return request;
} catch (Exception e) {
throw new RuntimeException("Failed to load QuestionRequest template");
}
}
use of se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionType in project webcert by sklintyg.
the class QuestionAnswerValidatorTest method testQVCatchesMissingHsaPersonIdRoot.
@Test
public void testQVCatchesMissingHsaPersonIdRoot() {
// Arrange
ReceiveMedicalCertificateQuestionType request = createValidQuestionRequest();
request.getQuestion().getAdressVard().getHosPersonal().getPersonalId().setRoot(null);
// Act
final List<String> result = QuestionAnswerValidator.validate(request);
// Assert
assertEquals(1, result.size());
}
Aggregations