[R7] Unit test method for update patient

This commit is contained in:
Mirna Gama 2024-01-10 14:59:48 -03:00 committed by Mirna Gama
parent 569fdc2e90
commit d2c910011e

View File

@ -22,6 +22,7 @@ import com.mirna.hospitalmanagementapi.application.services.PatientServiceImpl;
import com.mirna.hospitalmanagementapi.domain.dtos.AddressDTO;
import com.mirna.hospitalmanagementapi.domain.dtos.patient.PatientDTO;
import com.mirna.hospitalmanagementapi.domain.dtos.patient.PatientPublicDataDTO;
import com.mirna.hospitalmanagementapi.domain.dtos.patient.PatientUpdatedDataDTO;
import com.mirna.hospitalmanagementapi.domain.entities.Patient;
import com.mirna.hospitalmanagementapi.domain.repositories.PatientRepository;
@ -116,4 +117,18 @@ public class PatientServiceTest {
assertEquals(patients.getSize(), 3);
}
/**
* Updates an existing patient by id
*/
@Test
@DisplayName("Should update a valid patient")
public void testUpdatePatient() throws Exception {
PatientUpdatedDataDTO patientUpdatedData = new PatientUpdatedDataDTO(testPatient.getId(), "updated_test", null, null);
Patient patient = patientService.updatePatient(patientUpdatedData);
assertEquals(patientUpdatedData.name(), patient.getName());
}
}