|
11 | 11 | import org.openmrs.module.appointments.dao.AppointmentDao;
|
12 | 12 | import org.openmrs.module.appointments.helper.DateHelper;
|
13 | 13 | import org.openmrs.module.appointments.model.Appointment;
|
| 14 | +import org.openmrs.module.appointments.model.AppointmentStatus; |
14 | 15 |
|
15 | 16 | import java.util.Arrays;
|
16 | 17 | import java.util.Collections;
|
@@ -54,6 +55,26 @@ public void shouldReturnDoubleBookingConflictWithSameTime() {
|
54 | 55 | assertEquals(patientAppointment,appointments.get(0));
|
55 | 56 | }
|
56 | 57 |
|
| 58 | + @Test |
| 59 | + public void shouldNotConflictWithCancelledAppointmentOnSameTime() { |
| 60 | + Patient patient = new Patient(); |
| 61 | + patient.setId(1); |
| 62 | + Appointment patientAppointment = new Appointment(); |
| 63 | + patientAppointment.setStartDateTime(DateHelper.getDate(2119,8,1,11,0,0)); |
| 64 | + patientAppointment.setEndDateTime(DateHelper.getDate(2119,8,1,12,0,0)); |
| 65 | + patientAppointment.setStatus(AppointmentStatus.Cancelled); |
| 66 | + |
| 67 | + Appointment appointment = new Appointment(); |
| 68 | + appointment.setPatient(patient); |
| 69 | + appointment.setStartDateTime(DateHelper.getDate(2119,8,1,11,0,0)); |
| 70 | + appointment.setEndDateTime(DateHelper.getDate(2119,8,1,12,0,0)); |
| 71 | + when(appointmentDao.getAppointmentsForPatient(1)).thenReturn(Collections.singletonList(patientAppointment)); |
| 72 | + |
| 73 | + List<Appointment> appointments = patientDoubleBookingConflict.getConflicts(Collections.singletonList(appointment)); |
| 74 | + |
| 75 | + assertNotNull(appointments); |
| 76 | + assertEquals(0,appointments.size()); |
| 77 | + } |
57 | 78 |
|
58 | 79 | @Test
|
59 | 80 | public void shouldReturnAppointmentWithOverlapping() {
|
|
0 commit comments