본문 바로가기
반응형

Test Code4

AppointmentCommandService Class - Test Code I wrote test code per one class. I chose AppointmentCommandService to write test code. Before wrtting test code, I put data in database. I classified into 3 categories in one method. "given, when, then" given: something is given. when: something is done. then: verification @Test void appointmentStatusTest() throws Exception { //given Appointment appointment1 = appointmentRepository.findById(1L)... 2022. 11. 11.
AppointmenCommandService 클래스 - 테스트 코드 단일 클래스에 대해 짰으며 AppointmenCommandService 클래스에 대해 테스트 코드를 짜보았다. 데이터를 디비에 이미 넣어둔 상태로 테스트 코드를 작성을 진행하였다. 테스트코드는 given, when, then으로 나누어 작성하였다. given: 00이 주어짐 when: 00한 경우 then: 검증 @Test void appointmentStatusTest() throws Exception { //given Appointment appointment1 = appointmentRepository.findById(1L).get(); //when appointmentCommandService.updateAppointmentStatus(appointment1.getId(), AppointmentS.. 2022. 11. 11.
AppointmentQueryService Class - Test Code I wrote test code per one class. I chose AppointmentQueryService to write test code. Before wrtting test code, I put data in database. I classified into 3 categories in one method. "given, when, then" given: something is given. when: something is done. then: verification @Test void findAllAppointmentEntityListTest() throws Exception { //given Doctor doctor = doctorRepository.findById(5L).get(); .. 2022. 11. 10.
AppointmentQueryService 클래스 - 테스트 코드 단일 클래스에 대해 짰으며 AppointmentQueryService 클래스에 대해 테스트 코드를 짜보았다. 데이터를 디비에 이미 넣어둔 상태로 테스트 코드를 작성을 진행하였다. 테스트코드는 given, when, then으로 나누어 작성하였다. given: 00이 주어짐 when: 00한 경우 then: 검증 @Test void findAllAppointmentEntityListTest() throws Exception { //given Doctor doctor = doctorRepository.findById(5L).get(); //when List appointments = appointmentRepository.findByDoctorId(doctor.getId()); //then assertTha.. 2022. 11. 10.

반응형
반응형