반응형 stub1 ⑥Service Junit 테스트 - 4 검색 수정 junit테스트 1. book 검색 테스트 @Test public void bookSearchTest() { //given Long id = 1L; //stub Book book = new Book(1L, "junit-1", "coding-1"); Optional bookOP = Optional.of(book); when(bookRepository.findById(id)).thenReturn(bookOP); //when BookRespDto bookRespDto = bookService.booksSearch(id); //then assertThat(bookRespDto.getTitle()).isEqualTo(book.getTitle()); assertThat(bookRespDto.getAuthor()).isEqualTo.. 2022. 10. 20. 이전 1 다음 반응형