Attention une mise à jour du serveur va être effectuée le lundi 17 mai entre 13h et 13h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit 42748545 authored by Nicolas Bailliet's avatar Nicolas Bailliet

PATREG-79 | Patient Feed Client and Server coverage added on UT

parent bc6afd6f
Pipeline #132982 passed with stages
in 8 minutes and 33 seconds
......@@ -2,6 +2,7 @@ package net.ihe.gazelle.app.patientregistryfeedclient.adapter;
import net.ihe.gazelle.app.patientregistryapi.application.PatientFeedException;
import net.ihe.gazelle.app.patientregistryapi.business.Patient;
import net.ihe.gazelle.lib.annotations.Covers;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
......@@ -31,6 +32,7 @@ public class PatientFeedClientTest {
* @throws PatientFeedException
*/
@Test
@Covers(requirements = {"PATREG-20","PATREG-21","PATREG-22","PATREG-23","PATREG-24"})
public void feed_With_Success() throws PatientFeedException {
Patient patient = new Patient();
patient.setUuid("TEST-uuid1");
......@@ -42,6 +44,7 @@ public class PatientFeedClientTest {
* Test Feed client getting a response with no report
*/
@Test
@Covers(requirements = "PATREG-114")
public void feed_With_Success_missing_report() {
testProcessingService.setResponseToReturn(TestProcessingService.ResponseTypes.MISSING_REPORT);
Patient patient = new Patient();
......@@ -56,6 +59,7 @@ public class PatientFeedClientTest {
* Test Feed client getting a response with failed report
*/
@Test
@Covers(requirements = "PATREG-115")
public void feed_With_Success_failed_report() {
testProcessingService.setResponseToReturn(TestProcessingService.ResponseTypes.FAILED_REPORT);
Patient patient = new Patient();
......@@ -69,6 +73,7 @@ public class PatientFeedClientTest {
* Test Feed client getting a response with multiple outputs
*/
@Test
@Covers(requirements = "PATREG-116")
public void feed_With_Success_multiple_output() {
testProcessingService.setResponseToReturn(TestProcessingService.ResponseTypes.MULTIPLE_OUTPUT);
Patient patient = new Patient();
......@@ -83,6 +88,7 @@ public class PatientFeedClientTest {
* Test Feed client getting a response with invalid output (not a String)
*/
@Test
@Covers(requirements = "PATREG-28")
public void feed_With_Success_invalid_output() {
testProcessingService.setResponseToReturn(TestProcessingService.ResponseTypes.INVALID_OUTPUT);
Patient patient = new Patient();
......@@ -97,6 +103,7 @@ public class PatientFeedClientTest {
* Test Feed client getting a null response
*/
@Test
@Covers(requirements = "PATREG-25")
public void feed_null_response() {
testProcessingService.setResponseToReturn(TestProcessingService.ResponseTypes.NULL_RESPONSE);
Patient patient = new Patient();
......@@ -110,6 +117,7 @@ public class PatientFeedClientTest {
* Test Feed client getting a response with an unexpected status
*/
@Test
@Covers(requirements = "PATREG-25")
public void feed_unexpected_processing_status() {
testProcessingService.setResponseToReturn(TestProcessingService.ResponseTypes.UNEXPECTED_STATUS);
Patient patient = new Patient();
......@@ -124,6 +132,7 @@ public class PatientFeedClientTest {
* Test Feed client getting a response with no error report in report
*/
@Test
@Covers(requirements = "PATREG-26")
public void feed_no_reports_in_report() {
testProcessingService.setResponseToReturn(TestProcessingService.ResponseTypes.NO_REPORTS_IN_REPORT);
Patient patient = new Patient();
......@@ -137,6 +146,7 @@ public class PatientFeedClientTest {
* Test Feed client getting a response with no error in a failure report
*/
@Test
@Covers(requirements = "PATREG-26")
public void feed_no_error_in_failure_report() {
testProcessingService.setResponseToReturn(TestProcessingService.ResponseTypes.NO_ERROR_IN_FAILURE_REPORT);
Patient patient = new Patient();
......@@ -150,6 +160,7 @@ public class PatientFeedClientTest {
* Test Feed client getting a response with an error with no description
*/
@Test
@Covers(requirements = "PATREG-27")
public void feed_no_error_description() {
testProcessingService.setResponseToReturn(TestProcessingService.ResponseTypes.NO_ERROR_DESCRIPTION);
Patient patient = new Patient();
......@@ -163,6 +174,7 @@ public class PatientFeedClientTest {
* Test Feed client getting an IllegalArgumentException
*/
@Test
@Covers(requirements = "PATREG-29")
public void feed_illegalArgumentException() {
testProcessingService.setResponseToReturn(TestProcessingService.ResponseTypes.ILLEGAL_ARGUMENT_EXCEPTION);
Patient patient = new Patient();
......@@ -176,6 +188,7 @@ public class PatientFeedClientTest {
* Test Feed client getting an UnsupportedOperationException
*/
@Test
@Covers(requirements = "PATREG-117")
public void feed_unsupportedOperationException() {
testProcessingService.setResponseToReturn(TestProcessingService.ResponseTypes.UNSUPPORTED_OPERATION_EXCEPTION);
Patient patient = new Patient();
......
......@@ -10,6 +10,7 @@ import net.ihe.gazelle.app.patientregistryapi.adapter.ws.PatientRegistryGITBWebs
import net.ihe.gazelle.app.patientregistryapi.business.Patient;
import net.ihe.gazelle.app.patientregistryapi.business.PersonName;
import net.ihe.gazelle.app.patientregistryservice.application.TestPatientFeedServiceImpl;
import net.ihe.gazelle.lib.annotations.Covers;
import net.ihe.gazelle.lib.gitbutils.adapter.MapperObjectToAnyContent;
import net.ihe.gazelle.lib.gitbutils.adapter.MappingException;
import org.junit.jupiter.api.BeforeEach;
......@@ -35,6 +36,7 @@ public class PatientFeedProcessingServiceTest {
* Test Processing a patient feed, nominal case.
*/
@Test
@Covers(requirements = {"PATREG-30","PATREG-36","PATREG-37","PATREG-39"})
public void process() {
Patient patient = new Patient();
PersonName personName = new PersonName();
......@@ -67,6 +69,7 @@ public class PatientFeedProcessingServiceTest {
* Test Processing a patient feed, service throwing an exception.
*/
@Test
@Covers(requirements = {"PATREG-35","PATREG-38","PATREG-39"})
public void process_with_exception() {
testPatientFeedServiceImpl.setFeedResult(TestPatientFeedServiceImpl.FeedResult.KO);
Patient patient = new Patient();
......@@ -99,6 +102,7 @@ public class PatientFeedProcessingServiceTest {
* Test Processing a patient feed, service returning null.
*/
@Test
@Covers(requirements = {"PATREG-31"})
public void process_with_null_return() {
testPatientFeedServiceImpl.setFeedResult(TestPatientFeedServiceImpl.FeedResult.NULL);
Patient patient = new Patient();
......@@ -122,10 +126,11 @@ public class PatientFeedProcessingServiceTest {
* Test Processing a patient feed, error case using and AnyContent input that is not convertible to a Patient.
*/
@Test
@Covers(requirements = {"PATREG-32","PATREG-33"})
public void process_Incorrect_Patient() {
AnyContent anyContent = new AnyContent();
anyContent.setName("Test");
anyContent.setValue("TarteAuxPommesDuVergerDeMonEnfance");
anyContent.setValue("TarteAuxPoiresDuVergerDeMonAdolescence");
anyContent.setEmbeddingMethod(ValueEmbeddingEnumeration.STRING);
anyContent.setType("string");
ProcessRequest processRequest = new ProcessRequest();
......@@ -138,6 +143,7 @@ public class PatientFeedProcessingServiceTest {
* Test Processing a patient feed, error case using no input in ProcessRequest
*/
@Test
@Covers(requirements = {"PATREG-33","PATREG-34"})
public void process_no_input() {
ProcessRequest processRequest = new ProcessRequest();
processRequest.setOperation(PatientRegistryGITBWebserviceConstants.PATIENT_FEED_OPERATION);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment