Skip to content

Commit

Permalink
test: 중복 애노테이션 제거 및 스타일 수정 (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdkdhoho committed Jul 26, 2023
1 parent fdb7af2 commit 34a2df1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,8 @@

import com.celuveat.acceptance.common.AcceptanceTest;
import com.celuveat.celeb.domain.Celeb;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.DisplayNameGeneration;
import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores;
import org.junit.jupiter.api.Test;

@DisplayName("Admin 인수테스트")
@DisplayNameGeneration(ReplaceUnderscores.class)
class AdminAcceptanceTest extends AcceptanceTest {

private static final String 줄바꿈 = System.lineSeparator();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.celuveat.admin.application;


import static com.celuveat.acceptance.admin.AdminAcceptanceSteps.요청_생성;
import static com.celuveat.acceptance.admin.AdminAcceptanceSteps.입력_생성;
import static com.celuveat.celeb.fixture.CelebFixture.셀럽;
Expand Down Expand Up @@ -48,22 +47,14 @@ class AdminServiceTest {
@Autowired
private VideoRepository videoRepository;

private Celeb 셀럽_저장(Celeb 셀럽) {
return celebRepository.save(셀럽);
}

private Restaurant 음식점_저장(Restaurant 음식점) {
return restaurantRepository.save(음식점);
}

@Test
void 저장되어_있지_않은_셀럽으로_데이터를_저장하면_예외가_발생한다() {
// given
String input = 입력_생성("도기", "국민연금");
List<SaveDataRequest> 요청 = 요청_생성(input);

// then
assertThatThrownBy(() -> adminService.save(요청))
assertThatThrownBy(() -> adminService.saveData(요청))
.isInstanceOf(AdminException.class);
}

Expand All @@ -79,7 +70,7 @@ class AdminServiceTest {
List<SaveDataRequest> 요청 = 요청_생성(input);

// when
adminService.save(요청);
adminService.saveData(요청);

// then
assertThat(celebRepository.count()).isEqualTo(1);
Expand All @@ -101,7 +92,7 @@ class AdminServiceTest {
List<SaveDataRequest> 요청 = 요청_생성(input);

// when
adminService.save(요청);
adminService.saveData(요청);

// then
assertThat(celebRepository.count()).isEqualTo(2);
Expand All @@ -119,12 +110,20 @@ class AdminServiceTest {
List<SaveDataRequest> 요청 = 요청_생성(input);

// when
adminService.save(요청);
adminService.saveData(요청);

// then
assertThat(celebRepository.count()).isEqualTo(1);
assertThat(restaurantRepository.count()).isEqualTo(1);
assertThat(restaurantImageRepository.count()).isEqualTo(1);
assertThat(videoRepository.count()).isEqualTo(1);
}

private Celeb 셀럽_저장(Celeb 셀럽) {
return celebRepository.save(셀럽);
}

private Restaurant 음식점_저장(Restaurant 음식점) {
return restaurantRepository.save(음식점);
}
}

0 comments on commit 34a2df1

Please sign in to comment.