Skip to content

Commit

Permalink
test: Admin 인수테스트 한글로 읽을 수 있게끔 수정 (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdkdhoho committed Jul 26, 2023
1 parent c59faca commit fdb7af2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class AdminAcceptanceSteps {
return given()
.contentType(TEXT.withCharset("UTF-8"))
.body(data)
.when().post("/api/admin/save")
.when().post("/api/admin/data")
.then().log().all()
.extract();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import static org.assertj.core.api.Assertions.assertThat;

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;
Expand All @@ -15,33 +16,55 @@
@DisplayNameGeneration(ReplaceUnderscores.class)
class AdminAcceptanceTest extends AcceptanceTest {

private static final String 줄바꿈 = System.lineSeparator();

@Test
void 엑셀_스프레드_시트에서_긁은_데이터를_DB_저장한다() {
// given
celebRepository.save(셀럽("도기"));
celebRepository.save(셀럽("로이스"));
celebRepository.save(셀럽("말랑"));
celebRepository.save(셀럽("오도"));
셀럽_저장(셀럽("도기"));
셀럽_저장(셀럽("로이스"));
셀럽_저장(셀럽("말랑"));
셀럽_저장(셀럽("오도"));

String 입력_데이터 = 입력_생성("도기", "국민연금")
+ System.lineSeparator()
+ 줄바꿈
+ 입력_생성("도기", "농민백암순대")
+ System.lineSeparator()
+ 줄바꿈
+ 입력_생성("로이스", "신천직화")
+ System.lineSeparator()
+ 줄바꿈
+ 입력_생성("오도", "국민연금")
+ System.lineSeparator()
+ 줄바꿈
+ 입력_생성("말랑", "바스버거")
+ System.lineSeparator()
+ 줄바꿈
+ 입력_생성("말랑", "신천직화");

// when
데이터_저장_요청(입력_데이터);

// then
assertThat(celebRepository.count()).isEqualTo(4);
assertThat(restaurantRepository.count()).isEqualTo(4);
assertThat(restaurantImageRepository.count()).isEqualTo(6);
assertThat(videoRepository.count()).isEqualTo(6);
셀럽__검증(4);
음식점__검증(4);
음식점_이미지__검증(6);
영상__검증(6);
}

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

private void 셀럽__검증(int expected) {
assertThat(celebRepository.count()).isEqualTo(expected);
}

private void 음식점__검증(int expected) {
assertThat(restaurantRepository.count()).isEqualTo(expected);
}

private void 음식점_이미지__검증(int expected) {
assertThat(restaurantImageRepository.count()).isEqualTo(expected);
}

private void 영상__검증(int expected) {
assertThat(videoRepository.count()).isEqualTo(expected);
}
}

0 comments on commit fdb7af2

Please sign in to comment.