Skip to content

Commit

Permalink
refactor: 리뷰 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
wugawuga committed Oct 18, 2023
1 parent d7c357d commit c367561
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.funeat.acceptance.banner;

import static com.funeat.acceptance.banner.BannerSteps.배너_조회_요청;
import static com.funeat.acceptance.banner.BannerSteps.배너_목록_조회_요청;
import static com.funeat.acceptance.common.CommonSteps.STATUS_CODE_검증한다;
import static com.funeat.acceptance.common.CommonSteps.정상_처리;
import static com.funeat.fixture.BannerFixture.배너1_생성;
Expand Down Expand Up @@ -36,26 +36,27 @@ class getBanners_성공_테스트 {
final var 배너4 = 배너4_생성();
final var 배너5 = 배너5_생성();
final var 생성할_배너_리스트 = Arrays.asList(배너1, 배너2, 배너3, 배너4, 배너5);
bannerRepository.saveAllAndFlush(생성할_배너_리스트);
bannerRepository.saveAll(생성할_배너_리스트);

// when
final var 응답 = 배너_조회_요청();
final var 응답 = 배너_목록_조회_요청();

// then
STATUS_CODE_검증한다(응답, 정상_처리);
배너_조회_결과를_검증한다(응답, 생성할_배너_리스트);
}
}

private void 배너_조회_결과를_검증한다(final ExtractableResponse<Response> response, final List<Banner> expected) {
private void 배너_조회_결과를_검증한다(final ExtractableResponse<Response> response,
final List<Banner> expected) {
List<BannerResponse> expectedResponse = new ArrayList<>();
for (int i = expected.size() - 1; i >= 0; i--) {
expectedResponse.add(BannerResponse.toResponse(expected.get(i)));
}

final List<BannerResponse> result = response.jsonPath().getList("$", BannerResponse.class);
assertThat(result).usingRecursiveComparison()
.ignoringFields("id")
.isEqualTo(expectedResponse);
.ignoringFields("id")
.isEqualTo(expectedResponse);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
@SuppressWarnings("NonAsciiCharacters")
public class BannerSteps {

public static ExtractableResponse<Response> 배너_조회_요청() {
public static ExtractableResponse<Response> 배너_목록_조회_요청() {
return RestAssured.given()
.when()
.get("/api/banners")
.then()
.extract();
.when()
.get("/api/banners")
.then()
.extract();
}
}
1 change: 0 additions & 1 deletion backend/src/test/java/com/funeat/common/ServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ public abstract class ServiceTest {
productRecipeRepository.saveAll(productRecipes);
}


protected void 복수_배너_저장(final Banner... bannerToSave) {
final List<Banner> banners = List.of(bannerToSave);

Expand Down

0 comments on commit c367561

Please sign in to comment.