diff --git a/backend/src/test/java/com/funeat/acceptance/member/MemberAcceptanceTest.java b/backend/src/test/java/com/funeat/acceptance/member/MemberAcceptanceTest.java index efe38d779..fbaf1dc84 100644 --- a/backend/src/test/java/com/funeat/acceptance/member/MemberAcceptanceTest.java +++ b/backend/src/test/java/com/funeat/acceptance/member/MemberAcceptanceTest.java @@ -14,43 +14,69 @@ import com.funeat.member.dto.MemberRequest; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; +import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @SuppressWarnings("NonAsciiCharacters") public class MemberAcceptanceTest extends AcceptanceTest { - @Test - void 사용자_정보를_확인하다() { - // given - final var member = 멤버_멤버1_생성(); - 단일_멤버_저장(member); + @Nested + class getMemberProfile_테스트 { - final var loginCookie = 로그인_쿠키를_얻는다(); + @Nested + class 성공_테스트 { - // when - final var response = 사용자_정보_조회_요청(loginCookie); + @Test + void 사용자_정보를_확인하다() { + // given + final var member = 멤버_멤버1_생성(); + 단일_멤버_저장(member); - // then - STATUS_CODE를_검증한다(response, 정상_처리); - 사용자_정보_조회를_검증하다(response, member); + final var loginCookie = 로그인_쿠키를_얻는다(); + + // when + final var response = 사용자_정보_조회_요청(loginCookie); + + // then + STATUS_CODE를_검증한다(response, 정상_처리); + 사용자_정보_조회를_검증하다(response, member); + } + } + + @Nested + class 실패_테스트 { + } } - @Test - void 사용자_정보를_수정하다() { - // given - final var member = 멤버_멤버1_생성(); - 단일_멤버_저장(member); + @Nested + class putMemberProfile_테스트 { + + @Nested + class 성공_테스트 { - final var loginCookie = 로그인_쿠키를_얻는다(); - final var request = new MemberRequest("after", "http://www.after.com"); + @Test + void 사용자_정보를_수정하다() { + // given + final var member = 멤버_멤버1_생성(); + 단일_멤버_저장(member); - // when - final var response = 사용자_정보_수정_요청(loginCookie, request); + final var loginCookie = 로그인_쿠키를_얻는다(); + final var request = new MemberRequest("after", "http://www.after.com"); - // then - STATUS_CODE를_검증한다(response, 정상_처리); + // when + final var response = 사용자_정보_수정_요청(loginCookie, request); + + // then + STATUS_CODE를_검증한다(response, 정상_처리); + } + } + + @Nested + class 실패_테스트 { + } } + private void 사용자_정보_조회를_검증하다(final ExtractableResponse response, final Member member) { final var expected = MemberProfileResponse.toResponse(member); final var expectedNickname = expected.getNickname(); diff --git a/backend/src/test/java/com/funeat/acceptance/product/CategoryAcceptanceTest.java b/backend/src/test/java/com/funeat/acceptance/product/CategoryAcceptanceTest.java index e1e646ed4..0e0be9e11 100644 --- a/backend/src/test/java/com/funeat/acceptance/product/CategoryAcceptanceTest.java +++ b/backend/src/test/java/com/funeat/acceptance/product/CategoryAcceptanceTest.java @@ -16,26 +16,40 @@ import io.restassured.response.Response; import java.util.List; import java.util.stream.Collectors; +import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @SuppressWarnings("NonAsciiCharacters") public class CategoryAcceptanceTest extends AcceptanceTest { - @Test - void 공통_상품_카테고리의_목록을_조회한다() { - // given - final var 간편식사 = 카테고리_간편식사_생성(); - final var 즉석조리 = 카테고리_즉석조리_생성(); - final var 과자류 = 카테고리_과자류_생성(); - final var CU = 카테고리_CU_생성(); - 복수_카테고리_저장(간편식사, 즉석조리, 과자류, CU); - - // when - final var response = 공통_상품_카테고리_목록_조회_요청(); - - // then - STATUS_CODE를_검증한다(response, 정상_처리); - 공통_상품_카테고리_목록_조회_결과를_검증한다(response, List.of(간편식사, 즉석조리, 과자류)); + + @Nested + class getAllCategoriesByType_테스트 { + + @Nested + class 성공_테스트 { + + @Test + void 공통_상품_카테고리의_목록을_조회한다() { + // given + final var 간편식사 = 카테고리_간편식사_생성(); + final var 즉석조리 = 카테고리_즉석조리_생성(); + final var 과자류 = 카테고리_과자류_생성(); + final var CU = 카테고리_CU_생성(); + 복수_카테고리_저장(간편식사, 즉석조리, 과자류, CU); + + // when + final var response = 공통_상품_카테고리_목록_조회_요청(); + + // then + STATUS_CODE를_검증한다(response, 정상_처리); + 공통_상품_카테고리_목록_조회_결과를_검증한다(response, List.of(간편식사, 즉석조리, 과자류)); + } + } + + @Nested + class 실패_테스트 { + } } private void 공통_상품_카테고리_목록_조회_결과를_검증한다(final ExtractableResponse response,