[R5] Add unit test for find doctor by id as well
This commit is contained in:
parent
8fc3c28c9a
commit
a99213b845
@ -100,6 +100,20 @@ public class DoctorControllerTest {
|
||||
.andExpect(MockMvcResultMatchers.status().isBadRequest()).andDo(MockMvcResultHandlers.print());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get doctor by id
|
||||
*/
|
||||
@Test
|
||||
@DisplayName("Should get doctor by id and return http status OK")
|
||||
public void testGetDoctor() throws Exception {
|
||||
|
||||
Long id = testDoctor.getId();
|
||||
|
||||
mockMvc.perform(MockMvcRequestBuilders.get("/api/v1.0/doctors/{id}", id).contentType(MediaType.APPLICATION_JSON)
|
||||
.characterEncoding("UTF-8"))
|
||||
.andExpect(MockMvcResultMatchers.status().isOk()).andDo(MockMvcResultHandlers.print());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get doctors with pagination
|
||||
*/
|
||||
|
||||
@ -96,6 +96,19 @@ public class DoctorServiceTest {
|
||||
assertThrows(ConstraintViolationException.class, () -> doctorService.addDoctor(doctorDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds a doctor by provided id.
|
||||
*/
|
||||
@Test
|
||||
@DisplayName("Should find doctor by id")
|
||||
public void testFindPatientById() throws Exception {
|
||||
|
||||
Doctor doctor = doctorService.findDoctorById(testDoctor.getId());
|
||||
|
||||
assertNotNull(doctor);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds doctors stored in the database with pagination
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user