-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PC-555] 매칭 상세화면 API 연결 #63
Conversation
be8861c
to
f85e258
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
태규님 고생하셨습니다!!!!!!!!!!!!!!! 👍 👍
# https://github.com/google/gson | ||
gson = "2.12.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DataStore에 데이터 삽입할때 직렬화/역직렬화를 간단히 하기 위해서 사용하였습니다~
일일이 string 파싱할 수 있는데 유지보수 측면에서 너무 안좋을 것 같아서 채택하였습니다.
Gson을 사용한 이유는 KotlinxSerilization을 사용하려면 DomainModel에 @Serilizable 어노테이션을 붙여야하는데,
Gson은 리플렉션 기반이라서 별다른 어노테이션을 붙이지 않아도 사용 가능합니다...!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그럼 DataStroe에 삽입할 때만 쓰는 건가요?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 맞습니다~~
객체를 하나의 키로 저장할때 사용해요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
태규님!! 고생하셨습니다 👍 👍
import com.puzzle.domain.model.profile.OpponentProfile | ||
import com.puzzle.domain.repository.MatchingRepository | ||
|
||
class SpyMatchingRepository : MatchingRepository { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
질문이 하나 있어요!! spy랑 fake랑 차이가 뭔지 궁금합니다!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fake는 값만을 내려주는 스텁 객체에요.
우리가 개발에서 쓰는 Dummy데이터의 Dummy도 스텁이에요!
Spy는 스텁 기능에 더해서 호출된 횟수 등과 같은 상호작용까지 감시할 수 있어요.
원래는 Mock이 이런 기능을 하는데 Mock 라이브러리를 사용하지 않고 직접 구현한 것이 Spy입니다!!
로컬 메서드 호출 횟수를 측정하려고 Fake가 아닌 Spy를 썻습니다~~~
} | ||
|
||
@Test | ||
fun `로컬에서 데이터를 성공적으로 불러올 경우 서버 요청을 하지 않는다`() = runTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
헉... 테스트 코드까지.... 🫨 |
사소해~~~~~~~ |
1. ⭐️ 변경된 내용
4. 📌 이 부분은 꼭 봐주세요!
GetOpponentProfileUseCase에서 케싱된 데이터가 있으면 해당 데이터를 사용하고,
없을경우 서버에 호출한 데이터를 사용합니다.
테스트 코드 꼼꼼히 작성하였으니 테스트 코드에 적혀져있는 명세 참고하시고 궁금한 부분 코멘트주세요!!!