woowacourse-teams / 2020-seller-lee-company

🐳 조직 내에서 중고 거래를! 직고래
https://sites.google.com/woowahan.com/wooteco-demo/%EC%A7%81%EA%B3%A0%EB%9E%98
48 stars 12 forks source link

[게시글조직, 평가] 테스트 코드 작성 및 사용하지 않는 클래스 제거 #413

Closed jnsorn closed 4 years ago

jnsorn commented 4 years ago

상세 내용

jnsorn commented 4 years ago

update 관련 이슈 public void update(Article article, List organizations) { deleteAllByArticleId(article.getId()); create(article, organizations);

    // // 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);
}
jnsorn commented 4 years ago
// @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);
//
// }