@Test public void answerIsAccepted() { AttributedURIType address = new AttributedURIType(); address.setValue(SEND_ANSWER_STUB_ADDRESS); SendMedicalCertificateAnswerType parameters = createAnswer("Message"); SendMedicalCertificateAnswerResponseType answer = stub.sendMedicalCertificateAnswer(address, parameters); assertEquals(answer.getResult().getErrorText(), ResultCodeEnum.OK, answer.getResult().getResultCode()); }
@Override public SendMedicalCertificateAnswerResponseType sendMedicalCertificateAnswer(AttributedURIType logicalAddress, SendMedicalCertificateAnswerType parameters) { SendMedicalCertificateAnswerResponseType response = new SendMedicalCertificateAnswerResponseType(); if (logicalAddress == null) { response.setResult(ResultOfCallUtil.failResult("Ingen LogicalAddress är satt")); } else if (!LOGICAL_ADDRESS.equals(logicalAddress.getValue())) { response.setResult(ResultOfCallUtil .failResult("LogicalAddress '" + logicalAddress.getValue() + "' är inte samma som '" + LOGICAL_ADDRESS + "'")); } else if ("error".equalsIgnoreCase(parameters.getAnswer().getSvar().getMeddelandeText())) { response.setResult(ResultOfCallUtil.failResult("Du ville ju få ett fel")); } else { AnswerToFkType answerType = parameters.getAnswer(); SendMedicalCertificateAnswerValidator validator = new SendMedicalCertificateAnswerValidator(answerType); try { validator.validateAndCorrect(); response.setResult(ResultOfCallUtil.okResult()); } catch (ValidationException e) { response.setResult(ResultOfCallUtil.failResult(e.getMessage())); } questionAnswerStore.addAnswer(parameters.getAnswer()); } return response; }
SendAnswerStub implements SendMedicalCertificateAnswerResponderInterface { @Override public SendMedicalCertificateAnswerResponseType sendMedicalCertificateAnswer(AttributedURIType logicalAddress, SendMedicalCertificateAnswerType parameters) { SendMedicalCertificateAnswerResponseType response = new SendMedicalCertificateAnswerResponseType(); if (logicalAddress == null) { response.setResult(ResultOfCallUtil.failResult("Ingen LogicalAddress är satt")); } else if (!LOGICAL_ADDRESS.equals(logicalAddress.getValue())) { response.setResult(ResultOfCallUtil .failResult("LogicalAddress '" + logicalAddress.getValue() + "' är inte samma som '" + LOGICAL_ADDRESS + "'")); } else if ("error".equalsIgnoreCase(parameters.getAnswer().getSvar().getMeddelandeText())) { response.setResult(ResultOfCallUtil.failResult("Du ville ju få ett fel")); } else { AnswerToFkType answerType = parameters.getAnswer(); SendMedicalCertificateAnswerValidator validator = new SendMedicalCertificateAnswerValidator(answerType); try { validator.validateAndCorrect(); response.setResult(ResultOfCallUtil.okResult()); } catch (ValidationException e) { response.setResult(ResultOfCallUtil.failResult(e.getMessage())); } questionAnswerStore.addAnswer(parameters.getAnswer()); } return response; } }
SendAnswerStub implements SendMedicalCertificateAnswerResponderInterface { @Override public SendMedicalCertificateAnswerResponseType sendMedicalCertificateAnswer(AttributedURIType logicalAddress, SendMedicalCertificateAnswerType parameters) { SendMedicalCertificateAnswerResponseType response = new SendMedicalCertificateAnswerResponseType(); if (logicalAddress == null) { response.setResult(ResultOfCallUtil.failResult("Ingen LogicalAddress är satt")); } else if (!LOGICAL_ADDRESS.equals(logicalAddress.getValue())) { response.setResult(ResultOfCallUtil .failResult("LogicalAddress '" + logicalAddress.getValue() + "' är inte samma som '" + LOGICAL_ADDRESS + "'")); } else if ("error".equalsIgnoreCase(parameters.getAnswer().getSvar().getMeddelandeText())) { response.setResult(ResultOfCallUtil.failResult("Du ville ju få ett fel")); } else { AnswerToFkType answerType = parameters.getAnswer(); SendMedicalCertificateAnswerValidator validator = new SendMedicalCertificateAnswerValidator(answerType); try { validator.validateAndCorrect(); response.setResult(ResultOfCallUtil.okResult()); } catch (ValidationException e) { response.setResult(ResultOfCallUtil.failResult(e.getMessage())); } questionAnswerStore.addAnswer(parameters.getAnswer()); } return response; }  }
SendAnswerStub implements SendMedicalCertificateAnswerResponderInterface { @Override public SendMedicalCertificateAnswerResponseType sendMedicalCertificateAnswer(AttributedURIType logicalAddress, SendMedicalCertificateAnswerType parameters) { SendMedicalCertificateAnswerResponseType response = new SendMedicalCertificateAnswerResponseType(); if (logicalAddress == null) { response.setResult(ResultOfCallUtil.failResult("Ingen LogicalAddress är satt")); } else if (!LOGICAL_ADDRESS.equals(logicalAddress.getValue())) { response.setResult(ResultOfCallUtil .failResult("LogicalAddress '" + logicalAddress.getValue() + "' är inte samma som '" + LOGICAL_ADDRESS + "'")); } else if ("error".equalsIgnoreCase(parameters.getAnswer().getSvar().getMeddelandeText())) { response.setResult(ResultOfCallUtil.failResult("Du ville ju få ett fel")); } else { AnswerToFkType answerType = parameters.getAnswer(); SendMedicalCertificateAnswerValidator validator = new SendMedicalCertificateAnswerValidator(answerType); try { validator.validateAndCorrect(); response.setResult(ResultOfCallUtil.okResult()); } catch (ValidationException e) { response.setResult(ResultOfCallUtil.failResult(e.getMessage())); } questionAnswerStore.addAnswer(parameters.getAnswer()); } return response; }  @Override SendMedicalCertificateAnswerResponseType sendMedicalCertificateAnswer(AttributedURIType logicalAddress,
        SendMedicalCertificateAnswerType parameters); }
SendAnswerStub implements SendMedicalCertificateAnswerResponderInterface { @Override public SendMedicalCertificateAnswerResponseType sendMedicalCertificateAnswer(AttributedURIType logicalAddress, SendMedicalCertificateAnswerType parameters) { SendMedicalCertificateAnswerResponseType response = new SendMedicalCertificateAnswerResponseType(); if (logicalAddress == null) { response.setResult(ResultOfCallUtil.failResult("Ingen LogicalAddress är satt")); } else if (!LOGICAL_ADDRESS.equals(logicalAddress.getValue())) { response.setResult(ResultOfCallUtil .failResult("LogicalAddress '" + logicalAddress.getValue() + "' är inte samma som '" + LOGICAL_ADDRESS + "'")); } else if ("error".equalsIgnoreCase(parameters.getAnswer().getSvar().getMeddelandeText())) { response.setResult(ResultOfCallUtil.failResult("Du ville ju få ett fel")); } else { AnswerToFkType answerType = parameters.getAnswer(); SendMedicalCertificateAnswerValidator validator = new SendMedicalCertificateAnswerValidator(answerType); try { validator.validateAndCorrect(); response.setResult(ResultOfCallUtil.okResult()); } catch (ValidationException e) { response.setResult(ResultOfCallUtil.failResult(e.getMessage())); } questionAnswerStore.addAnswer(parameters.getAnswer()); } return response; }  @Override SendMedicalCertificateAnswerResponseType sendMedicalCertificateAnswer(AttributedURIType logicalAddress,
        SendMedicalCertificateAnswerType parameters);  }