[R8] Unit test method for deactivate patient in service class

This commit is contained in:
Mirna Gama 2024-01-10 17:45:19 -03:00 committed by Mirna Gama
parent f4794bf08d
commit 9c27831992

View File

@ -1,6 +1,7 @@
package com.mirna.hospitalmanagementapi.unit.application.service;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
@ -131,4 +132,18 @@ public class PatientServiceTest {
assertEquals(patientUpdatedData.name(), patient.getName());
}
/**
* Deactivates an existing patient by id
*/
@Test
@DisplayName("Should deactivate a patient")
public void testDeactivatePatient() throws Exception {
Long id = testPatient.getId();
Patient patient = patientService.deactivatePatient(id);
assertFalse(patient.getActive());
}
}