반응형 coding3 ⑩Junit Controller Test bookList, Search, delete, update Test 2. BookList Test @Sql("classpath:db/tableInit.sql") @Test public void getBookList_test() { //given //when HttpEntity request = new HttpEntity(null, headers); ResponseEntity response = rt.exchange("/api/v1/book", HttpMethod.GET, request, String.class); //then DocumentContext dc = JsonPath.parse(response.getBody()); Integer code = dc.read("$.code"); String title = dc.read("$.body.items[0].title");.. 2022. 10. 23. ⑤Service Junit 테스트 - 3 등록과 리스트 junit테스트 Junit 초기 설정 //@DataJpaTest //Tranjectional あるため、テスト後ロールバックします。 @ExtendWith(MockitoExtension.class) public class BookServiceTest { @InjectMocks private BookService bookService; @Mock private BookRepository bookRepository; @Mock private MailSender mailSender; //@Autowired //private BookRepository bookRepository; // 気になる… サービスだけテストしたいけど、レポジトリもテストになる Mockito使用 @ExtendWith(MockitoExtension.class) : M.. 2022. 10. 19. ②Junit 에 대해서 공부하자.! bookList, booksearch, bookdelete 일본에서 일하는 외노자 로써 내용이 일본어가 포함될 수 있습니다. Junit에 대해서 공부공부.. Test본코드는 전 게시물을 확인해주시기 바랍니다. https://seodev.tistory.com/m/2 bookList 테스트 // 2. book リスト @Test public void bookList_test() { //given String title = "junit"; String author = "coding"; //when List booksPS = bookRepository.findAll(); //then assertEquals(title , booksPS.get(0).getTitle()); assertEquals(author, booksPS.get(0).getAuthor()); } 등록된 데.. 2022. 10. 18. 이전 1 다음 반응형