diff --git a/backend/emm-sale/src/test/java/com/emmsale/member/MemberFixture.java b/backend/emm-sale/src/test/java/com/emmsale/member/MemberFixture.java index 7e969a425..31f1cf589 100644 --- a/backend/emm-sale/src/test/java/com/emmsale/member/MemberFixture.java +++ b/backend/emm-sale/src/test/java/com/emmsale/member/MemberFixture.java @@ -45,4 +45,8 @@ public static Member create( member.updateName(name); return member; } + + public static Member newMember() { + return new Member(1313L, "imageUrl", "amaama"); + } } diff --git a/backend/emm-sale/src/test/java/com/emmsale/member/application/InterestTagServiceTest.java b/backend/emm-sale/src/test/java/com/emmsale/member/application/InterestTagServiceTest.java index 9dc0208c7..8275dd660 100644 --- a/backend/emm-sale/src/test/java/com/emmsale/member/application/InterestTagServiceTest.java +++ b/backend/emm-sale/src/test/java/com/emmsale/member/application/InterestTagServiceTest.java @@ -1,5 +1,6 @@ package com.emmsale.member.application; +import static com.emmsale.member.MemberFixture.newMember; import static com.emmsale.tag.TagFixture.IOS; import static com.emmsale.tag.TagFixture.백엔드; import static com.emmsale.tag.TagFixture.안드로이드; @@ -51,7 +52,7 @@ class InterestTagServiceTest extends ServiceIntegrationTestHelper { @BeforeEach void init() { 사용자 = memberRepository.findById(1L).get(); - 새로운_사용자 = memberRepository.findById(3L).get(); + 새로운_사용자 = memberRepository.save(newMember()); 백엔드 = tagRepository.save(백엔드()); 프론트엔드 = tagRepository.save(프론트엔드()); diff --git a/backend/emm-sale/src/test/java/com/emmsale/member/application/MemberActivityCommandServiceTest.java b/backend/emm-sale/src/test/java/com/emmsale/member/application/MemberActivityCommandServiceTest.java index dd71a024a..b4c1e58aa 100644 --- a/backend/emm-sale/src/test/java/com/emmsale/member/application/MemberActivityCommandServiceTest.java +++ b/backend/emm-sale/src/test/java/com/emmsale/member/application/MemberActivityCommandServiceTest.java @@ -1,5 +1,6 @@ package com.emmsale.member.application; +import static com.emmsale.member.MemberFixture.newMember; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; @@ -14,6 +15,7 @@ import com.emmsale.member.exception.MemberExceptionType; import java.util.List; import java.util.stream.Collectors; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -23,15 +25,17 @@ class MemberActivityCommandServiceTest extends ServiceIntegrationTestHelper { @Autowired private MemberActivityCommandService memberActivityCommandService; - @Autowired - private MemberCommandService memberCommandService; - @Autowired private MemberRepository memberRepository; @Autowired private MemberActivityRepository memberActivityRepository; + @BeforeEach + void init() { + memberRepository.save(newMember()); + } + @Test @DisplayName("Activity의 id를 통해서, 사용자의 Activity를 등록할 수 있다.") void registerActivities() throws Exception { diff --git a/backend/emm-sale/src/test/java/com/emmsale/member/application/MemberQueryServiceTest.java b/backend/emm-sale/src/test/java/com/emmsale/member/application/MemberQueryServiceTest.java index 5a7909059..de995f6c0 100644 --- a/backend/emm-sale/src/test/java/com/emmsale/member/application/MemberQueryServiceTest.java +++ b/backend/emm-sale/src/test/java/com/emmsale/member/application/MemberQueryServiceTest.java @@ -45,7 +45,7 @@ void findOrCreateMemberTest() { @DisplayName("사용자를 조회하고 존재하지 않으므로 새로 생성하고 생성한 결과를 반환한다.") void findOrCreateMemberTestWithNewMember() { //given - final MemberQueryResponse expectResponse = new MemberQueryResponse(4L, false); + final MemberQueryResponse expectResponse = new MemberQueryResponse(3L, false); final GithubProfileResponse githubProfileFromGithub = new GithubProfileResponse("0", "name", "username", "https://imageUrl.com"); diff --git a/backend/emm-sale/src/test/resources/data-test.sql b/backend/emm-sale/src/test/resources/data-test.sql index 3d36462f5..d444322e1 100644 --- a/backend/emm-sale/src/test/resources/data-test.sql +++ b/backend/emm-sale/src/test/resources/data-test.sql @@ -46,11 +46,6 @@ insert into member(id, name, image_url, open_profile_url, github_id, github_user values (2, 'member2', 'https://imageurl.com', 'https://openprofileurl.com', 2, 'amaran-th22', CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()); -insert into member(id, name, image_url, open_profile_url, github_id, github_username, created_at, - updated_at) -values (3, null, 'https://imageurl.com', 'https://openprofileurl.com', 33, 'amaran-th333', - CURRENT_TIMESTAMP(), - CURRENT_TIMESTAMP()); insert into member_activity(id, activity_id, member_id, created_at, updated_at) values (1, 1, 1, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP());