Search in sources :

Example 6 with ReceiveMedicalCertificateQuestionType

use of se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionType in project webcert by sklintyg.

the class QuestionAnswerValidatorTest method testQVCatchesMissingHsaPersonIdExtension.

@Test
public void testQVCatchesMissingHsaPersonIdExtension() {
    // Arrange
    ReceiveMedicalCertificateQuestionType request = createValidQuestionRequest();
    request.getQuestion().getAdressVard().getHosPersonal().getPersonalId().setExtension(null);
    // Act
    final List<String> result = QuestionAnswerValidator.validate(request);
    // Assert
    assertEquals(1, result.size());
}
Also used : ReceiveMedicalCertificateQuestionType(se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionType) Test(org.junit.Test)

Example 7 with ReceiveMedicalCertificateQuestionType

use of se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionType in project webcert by sklintyg.

the class QuestionAnswerValidatorTest method testQVCatchesInvalidHsaPersonIdRoot.

@Test
public void testQVCatchesInvalidHsaPersonIdRoot() {
    // Arrange
    ReceiveMedicalCertificateQuestionType request = createValidQuestionRequest();
    request.getQuestion().getAdressVard().getHosPersonal().getPersonalId().setRoot("INVALID");
    // Act
    final List<String> result = QuestionAnswerValidator.validate(request);
    // Assert
    assertEquals(1, result.size());
}
Also used : ReceiveMedicalCertificateQuestionType(se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionType) Test(org.junit.Test)

Example 8 with ReceiveMedicalCertificateQuestionType

use of se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionType in project webcert by sklintyg.

the class QuestionAnswerValidatorTest method testQVCatchesMissingVardgivarIdExtension.

@Test
public void testQVCatchesMissingVardgivarIdExtension() {
    // Arrange
    ReceiveMedicalCertificateQuestionType request = createValidQuestionRequest();
    request.getQuestion().getAdressVard().getHosPersonal().getEnhet().getVardgivare().getVardgivareId().setExtension(null);
    // Act
    final List<String> result = QuestionAnswerValidator.validate(request);
    // Assert
    assertEquals(1, result.size());
}
Also used : ReceiveMedicalCertificateQuestionType(se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionType) Test(org.junit.Test)

Example 9 with ReceiveMedicalCertificateQuestionType

use of se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionType in project webcert by sklintyg.

the class QuestionAnswerValidatorTest method testQVPassesValidRequest.

@Test
public void testQVPassesValidRequest() {
    ReceiveMedicalCertificateQuestionType request = createValidQuestionRequest();
    assertEquals(0, QuestionAnswerValidator.validate(request).size());
}
Also used : ReceiveMedicalCertificateQuestionType(se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionType) Test(org.junit.Test)

Example 10 with ReceiveMedicalCertificateQuestionType

use of se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionType 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;
}
Also used : FragaSvar(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar) ReceiveMedicalCertificateQuestionResponseType(se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionResponseType)

Aggregations

ReceiveMedicalCertificateQuestionType (se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionType)21 Test (org.junit.Test)19 ReceiveMedicalCertificateQuestionResponseType (se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.ReceiveMedicalCertificateQuestionResponseType)3 QuestionFromFkType (se.inera.ifv.insuranceprocess.healthreporting.receivemedicalcertificatequestionsponder.v1.QuestionFromFkType)2 JAXBContext (javax.xml.bind.JAXBContext)1 Unmarshaller (javax.xml.bind.Unmarshaller)1 StreamSource (javax.xml.transform.stream.StreamSource)1 ClassPathResource (org.springframework.core.io.ClassPathResource)1 FragaSvar (se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar)1