From 65c4f16f18a011c4eba8e0d93186f8715f2e8fdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A7=84=EC=A3=BC=EC=9B=90?= <84346055+jinjoo-lab@users.noreply.github.com> Date: Thu, 23 Nov 2023 15:30:58 +0900 Subject: [PATCH 1/5] [FIX] Position Fix --- .../com/twtw/backend/domain/path/dto/client/car/Position.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/Position.java b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/Position.java index dcf895bb..f447bebb 100644 --- a/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/Position.java +++ b/backend/src/main/java/com/twtw/backend/domain/path/dto/client/car/Position.java @@ -8,6 +8,6 @@ @NoArgsConstructor @AllArgsConstructor public class Position { - Double x; - Double y; + private Double x; + private Double y; } From 4c187f09eebbc14798d9872cb28ea79f47488885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A7=84=EC=A3=BC=EC=9B=90?= <84346055+jinjoo-lab@users.noreply.github.com> Date: Thu, 23 Nov 2023 19:39:23 +0900 Subject: [PATCH 2/5] =?UTF-8?q?[FIX]=20Kakao,Apple=20=EA=B0=80=EC=9E=85?= =?UTF-8?q?=EC=9D=B4=20=EC=88=98=ED=96=89=EB=90=98=EB=8A=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/service/AuthServiceTest.java | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 backend/src/test/java/com/twtw/backend/domain/member/service/AuthServiceTest.java diff --git a/backend/src/test/java/com/twtw/backend/domain/member/service/AuthServiceTest.java b/backend/src/test/java/com/twtw/backend/domain/member/service/AuthServiceTest.java new file mode 100644 index 00000000..99212594 --- /dev/null +++ b/backend/src/test/java/com/twtw/backend/domain/member/service/AuthServiceTest.java @@ -0,0 +1,66 @@ +package com.twtw.backend.domain.member.service; + +import com.twtw.backend.domain.member.dto.request.MemberSaveRequest; +import com.twtw.backend.domain.member.dto.request.OAuthRequest; +import com.twtw.backend.domain.member.dto.response.AfterLoginResponse; +import com.twtw.backend.domain.member.entity.AuthStatus; +import com.twtw.backend.domain.member.entity.AuthType; +import com.twtw.backend.domain.member.repository.MemberRepository; +import com.twtw.backend.domain.member.repository.RefreshTokenRepository; +import com.twtw.backend.support.database.DatabaseTest; +import org.junit.jupiter.api.DisplayName; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import static org.assertj.core.api.Assertions.assertThat; + +@DatabaseTest +@DisplayName("AuthService의") +public class AuthServiceTest { + + @Autowired private AuthService authService; + + @Autowired private MemberRepository memberRepository; + + @Autowired private RefreshTokenRepository refreshTokenRepository; + + + @Test + @DisplayName("Kakao 회원 가입이 수행되는가") + void saveMemberKakao(){ + // given + MemberSaveRequest kakaoRequest = new MemberSaveRequest( + "JinJooWon_Kakao", + "TEST_PROFILE_IMAGE", + new OAuthRequest( + "TEST_KAKAO_TOKEN", + AuthType.KAKAO + ) + ); + // when + AfterLoginResponse response = authService.saveMember(kakaoRequest); + // then + assertThat(response.getStatus().equals(AuthStatus.SIGNIN)); + } + + @Test + @DisplayName("Apple 회원 가입이 수행되는가") + void saveMemberApple(){ + //given + MemberSaveRequest appleRequest = new MemberSaveRequest( + "JinJooWon_Apple", + "TEST_PROFILE_IMAGE", + new OAuthRequest( + "TEST_APPLE_TOKEN", + AuthType.APPLE + ) + ); + // when + AfterLoginResponse response = authService.saveMember(appleRequest); + // then + assertThat(response.getStatus().equals(AuthStatus.SIGNIN)); + } + + +} From 445503dc583a9bf0b8218557cbdba9806aeb30b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A7=84=EC=A3=BC=EC=9B=90?= <84346055+jinjoo-lab@users.noreply.github.com> Date: Thu, 23 Nov 2023 19:48:56 +0900 Subject: [PATCH 3/5] [FEAT] Auth Test : SIGN_IN , SIGN_UP --- .../member/service/AuthServiceTest.java | 20 ++++++++++++++++++- .../member/service/MemberServiceTest.java | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/backend/src/test/java/com/twtw/backend/domain/member/service/AuthServiceTest.java b/backend/src/test/java/com/twtw/backend/domain/member/service/AuthServiceTest.java index 99212594..a4c8cad7 100644 --- a/backend/src/test/java/com/twtw/backend/domain/member/service/AuthServiceTest.java +++ b/backend/src/test/java/com/twtw/backend/domain/member/service/AuthServiceTest.java @@ -5,8 +5,10 @@ import com.twtw.backend.domain.member.dto.response.AfterLoginResponse; import com.twtw.backend.domain.member.entity.AuthStatus; import com.twtw.backend.domain.member.entity.AuthType; +import com.twtw.backend.domain.member.entity.Member; import com.twtw.backend.domain.member.repository.MemberRepository; import com.twtw.backend.domain.member.repository.RefreshTokenRepository; +import com.twtw.backend.fixture.member.MemberEntityFixture; import com.twtw.backend.support.database.DatabaseTest; import org.junit.jupiter.api.DisplayName; @@ -16,7 +18,7 @@ import static org.assertj.core.api.Assertions.assertThat; @DatabaseTest -@DisplayName("AuthService의") +@DisplayName("AuthService의 ") public class AuthServiceTest { @Autowired private AuthService authService; @@ -62,5 +64,21 @@ void saveMemberApple(){ assertThat(response.getStatus().equals(AuthStatus.SIGNIN)); } + @Test + @DisplayName("로그인 후 회원에 대해 토큰이 재발급되는가") + void getTokenByOAuthSuccess(){ + // given + final Member member = memberRepository.save(MemberEntityFixture.FIRST_MEMBER.toEntity()); + final OAuthRequest request = new OAuthRequest( + member.getOauthInfo().getClientId(), + member.getOauthInfo().getAuthType() + ); + + // when + AfterLoginResponse response = authService.getTokenByOAuth(request); + + // then + assertThat(response.getStatus().equals(AuthStatus.SIGNIN)); + } } diff --git a/backend/src/test/java/com/twtw/backend/domain/member/service/MemberServiceTest.java b/backend/src/test/java/com/twtw/backend/domain/member/service/MemberServiceTest.java index c0e68851..b5728360 100644 --- a/backend/src/test/java/com/twtw/backend/domain/member/service/MemberServiceTest.java +++ b/backend/src/test/java/com/twtw/backend/domain/member/service/MemberServiceTest.java @@ -55,4 +55,6 @@ void getResponseByMember() { // then assertThat(memberResponse.getId()).isEqualTo(member.getId()); } + + } From 9c017557873086260a6f058e3e5dff075d7c3006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A7=84=EC=A3=BC=EC=9B=90?= <84346055+jinjoo-lab@users.noreply.github.com> Date: Thu, 23 Nov 2023 22:15:22 +0900 Subject: [PATCH 4/5] [FEAT] Auth Test : SIGN_IN , SIGN_UP --- .../domain/member/repository/MemberRepository.java | 3 ++- .../domain/member/service/AuthServiceTest.java | 13 +++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/com/twtw/backend/domain/member/repository/MemberRepository.java b/backend/src/main/java/com/twtw/backend/domain/member/repository/MemberRepository.java index 9e3ff987..a482fbbf 100644 --- a/backend/src/main/java/com/twtw/backend/domain/member/repository/MemberRepository.java +++ b/backend/src/main/java/com/twtw/backend/domain/member/repository/MemberRepository.java @@ -5,6 +5,7 @@ import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; import java.util.Optional; import java.util.UUID; @@ -17,5 +18,5 @@ public interface MemberRepository extends JpaRepository { @Query( "SELECT m FROM Member m WHERE m.oauthInfo.clientId = :oAuthId AND" + " m.oauthInfo.authType = :authType") - Optional findByOAuthIdAndAuthType(String oAuthId, AuthType authType); + Optional findByOAuthIdAndAuthType(@Param("oAuthId") String oAuthId, @Param("authType") AuthType authType); } diff --git a/backend/src/test/java/com/twtw/backend/domain/member/service/AuthServiceTest.java b/backend/src/test/java/com/twtw/backend/domain/member/service/AuthServiceTest.java index a4c8cad7..c37c3bef 100644 --- a/backend/src/test/java/com/twtw/backend/domain/member/service/AuthServiceTest.java +++ b/backend/src/test/java/com/twtw/backend/domain/member/service/AuthServiceTest.java @@ -10,6 +10,7 @@ import com.twtw.backend.domain.member.repository.RefreshTokenRepository; import com.twtw.backend.fixture.member.MemberEntityFixture; import com.twtw.backend.support.database.DatabaseTest; +import com.twtw.backend.support.exclude.ExcludeTest; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -19,7 +20,7 @@ @DatabaseTest @DisplayName("AuthService의 ") -public class AuthServiceTest { +public class AuthServiceTest extends ExcludeTest { @Autowired private AuthService authService; @@ -40,10 +41,12 @@ void saveMemberKakao(){ AuthType.KAKAO ) ); + // when AfterLoginResponse response = authService.saveMember(kakaoRequest); + // then - assertThat(response.getStatus().equals(AuthStatus.SIGNIN)); + assertThat(response.getStatus().equals(AuthStatus.SIGNIN)).isTrue(); } @Test @@ -58,10 +61,12 @@ void saveMemberApple(){ AuthType.APPLE ) ); + // when AfterLoginResponse response = authService.saveMember(appleRequest); + // then - assertThat(response.getStatus().equals(AuthStatus.SIGNIN)); + assertThat(response.getStatus().equals(AuthStatus.SIGNIN)).isTrue(); } @Test @@ -79,6 +84,6 @@ void getTokenByOAuthSuccess(){ AfterLoginResponse response = authService.getTokenByOAuth(request); // then - assertThat(response.getStatus().equals(AuthStatus.SIGNIN)); + assertThat(response.getStatus().equals(AuthStatus.SIGNIN)).isTrue(); } } From 65bd663359910a0a8fbb695b07bd726e68c9c1fc Mon Sep 17 00:00:00 2001 From: github-actions <> Date: Thu, 23 Nov 2023 13:15:59 +0000 Subject: [PATCH 5/5] Google Java Format --- .../member/repository/MemberRepository.java | 3 +- .../member/service/AuthServiceTest.java | 48 ++++++++----------- .../member/service/MemberServiceTest.java | 2 - 3 files changed, 22 insertions(+), 31 deletions(-) diff --git a/backend/src/main/java/com/twtw/backend/domain/member/repository/MemberRepository.java b/backend/src/main/java/com/twtw/backend/domain/member/repository/MemberRepository.java index a482fbbf..85dc6a10 100644 --- a/backend/src/main/java/com/twtw/backend/domain/member/repository/MemberRepository.java +++ b/backend/src/main/java/com/twtw/backend/domain/member/repository/MemberRepository.java @@ -18,5 +18,6 @@ public interface MemberRepository extends JpaRepository { @Query( "SELECT m FROM Member m WHERE m.oauthInfo.clientId = :oAuthId AND" + " m.oauthInfo.authType = :authType") - Optional findByOAuthIdAndAuthType(@Param("oAuthId") String oAuthId, @Param("authType") AuthType authType); + Optional findByOAuthIdAndAuthType( + @Param("oAuthId") String oAuthId, @Param("authType") AuthType authType); } diff --git a/backend/src/test/java/com/twtw/backend/domain/member/service/AuthServiceTest.java b/backend/src/test/java/com/twtw/backend/domain/member/service/AuthServiceTest.java index c37c3bef..c5ce7d0c 100644 --- a/backend/src/test/java/com/twtw/backend/domain/member/service/AuthServiceTest.java +++ b/backend/src/test/java/com/twtw/backend/domain/member/service/AuthServiceTest.java @@ -1,5 +1,7 @@ package com.twtw.backend.domain.member.service; +import static org.assertj.core.api.Assertions.assertThat; + import com.twtw.backend.domain.member.dto.request.MemberSaveRequest; import com.twtw.backend.domain.member.dto.request.OAuthRequest; import com.twtw.backend.domain.member.dto.response.AfterLoginResponse; @@ -11,13 +13,11 @@ import com.twtw.backend.fixture.member.MemberEntityFixture; import com.twtw.backend.support.database.DatabaseTest; import com.twtw.backend.support.exclude.ExcludeTest; -import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import static org.assertj.core.api.Assertions.assertThat; - @DatabaseTest @DisplayName("AuthService의 ") public class AuthServiceTest extends ExcludeTest { @@ -28,19 +28,15 @@ public class AuthServiceTest extends ExcludeTest { @Autowired private RefreshTokenRepository refreshTokenRepository; - @Test @DisplayName("Kakao 회원 가입이 수행되는가") - void saveMemberKakao(){ + void saveMemberKakao() { // given - MemberSaveRequest kakaoRequest = new MemberSaveRequest( - "JinJooWon_Kakao", - "TEST_PROFILE_IMAGE", - new OAuthRequest( - "TEST_KAKAO_TOKEN", - AuthType.KAKAO - ) - ); + MemberSaveRequest kakaoRequest = + new MemberSaveRequest( + "JinJooWon_Kakao", + "TEST_PROFILE_IMAGE", + new OAuthRequest("TEST_KAKAO_TOKEN", AuthType.KAKAO)); // when AfterLoginResponse response = authService.saveMember(kakaoRequest); @@ -51,16 +47,13 @@ void saveMemberKakao(){ @Test @DisplayName("Apple 회원 가입이 수행되는가") - void saveMemberApple(){ - //given - MemberSaveRequest appleRequest = new MemberSaveRequest( - "JinJooWon_Apple", - "TEST_PROFILE_IMAGE", - new OAuthRequest( - "TEST_APPLE_TOKEN", - AuthType.APPLE - ) - ); + void saveMemberApple() { + // given + MemberSaveRequest appleRequest = + new MemberSaveRequest( + "JinJooWon_Apple", + "TEST_PROFILE_IMAGE", + new OAuthRequest("TEST_APPLE_TOKEN", AuthType.APPLE)); // when AfterLoginResponse response = authService.saveMember(appleRequest); @@ -71,14 +64,13 @@ void saveMemberApple(){ @Test @DisplayName("로그인 후 회원에 대해 토큰이 재발급되는가") - void getTokenByOAuthSuccess(){ + void getTokenByOAuthSuccess() { // given final Member member = memberRepository.save(MemberEntityFixture.FIRST_MEMBER.toEntity()); - final OAuthRequest request = new OAuthRequest( - member.getOauthInfo().getClientId(), - member.getOauthInfo().getAuthType() - ); + final OAuthRequest request = + new OAuthRequest( + member.getOauthInfo().getClientId(), member.getOauthInfo().getAuthType()); // when AfterLoginResponse response = authService.getTokenByOAuth(request); diff --git a/backend/src/test/java/com/twtw/backend/domain/member/service/MemberServiceTest.java b/backend/src/test/java/com/twtw/backend/domain/member/service/MemberServiceTest.java index b5728360..c0e68851 100644 --- a/backend/src/test/java/com/twtw/backend/domain/member/service/MemberServiceTest.java +++ b/backend/src/test/java/com/twtw/backend/domain/member/service/MemberServiceTest.java @@ -55,6 +55,4 @@ void getResponseByMember() { // then assertThat(memberResponse.getId()).isEqualTo(member.getId()); } - - }