Closed jnsorn closed 4 years ago
update 관련 이슈
public void update(Article article, List
// // 1. 기존 ao 구해오기 -> or 추출 ===== QUERY + 1
// List<ArticleOrganization> oldArticleOrganizations = showByArticleId(article.getId());
// List<Organization> oldOrganizations = oldArticleOrganizations.stream()
// .map(ArticleOrganization::getOrganization)
// .collect(
// Collectors.toList());
// // 2. 기존 or 돌면서 필터로 지워져야 하는 것들 리스트 만들기
//
// // 3. 기존 or 딜리트 ===== QUERY + 1
// articleOrganizationRepository.deleteAll(AO);
//
// // 4. 새 or 구하기
//
// // 5. 새 or 세이브 ===== QUERY + 1
// create(article, organizations);
}
// @DisplayName("ArticleOrganization 수정")
// @Test
// void update() {
// List<Organization> organizations = Arrays.asList(직고래, 한성대학교);
// List<ArticleOrganization> articleOrganizations = organizations.stream()
// .map(organization -> new ArticleOrganization(ARTICLE1, organization))
// .collect(Collectors.toList());
// //doNothing().when(articleOrganizationRepository).deleteAllByArticleId(ARTICLE1.getId());
// //when(articleOrganizationRepository.saveAll(articleOrganizations)).thenReturn(articleOrganizations);
// when(articleOrganizationService.showByArticleId(ARTICLE1.getId())).thenReturn(articleOrganizations);
// articleOrganizationService.update(ARTICLE1, organizations);
//
//
// // verify(articleOrganizationService).deleteAllByArticleId(ARTICLE1.getId());
// // verify(articleOrganizationService).create(ARTICLE1, organizations);
//
// // verify(articleOrganizationRepository).deleteAllByArticleId(ARTICLE1.getId());
// // verify(articleOrganizationRepository).saveAll(articleOrganizations);
//
// }
상세 내용