fix(member-info): 구서버 멤버정보 누락 필드 하위 호환을 보장한다

This commit is contained in:
2026-03-28 18:28:09 +09:00
parent 4815cac49b
commit 9dfad913bc
4 changed files with 136 additions and 6 deletions

View File

@@ -0,0 +1,70 @@
package kr.co.vividnext.sodalive.settings.notification
import com.google.gson.Gson
import kr.co.vividnext.sodalive.settings.ContentType
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Test
class GetMemberInfoResponseCompatibilityTest {
private val gson = Gson()
@Test
fun `구서버 응답에서 신규 필드가 없어도 역직렬화된다`() {
val json = """
{
"can": 10,
"point": 120,
"isAuth": true,
"gender": "F",
"signupDate": "2024-01-01, 00:00:00",
"chargeCount": 3,
"role": "USER",
"messageNotice": true,
"followingChannelLiveNotice": false,
"followingChannelUploadContentNotice": true,
"auditionNotice": false
}
""".trimIndent()
val response = gson.fromJson(json, GetMemberInfoResponse::class.java)
assertEquals(10, response.can)
assertEquals(120, response.point)
assertTrue(response.isAuth)
assertEquals(MemberRole.USER, response.role)
assertNull(response.countryCode)
assertNull(response.isAdultContentVisible)
assertNull(response.contentType)
}
@Test
fun `신규 필드가 있으면 정상 매핑된다`() {
val json = """
{
"can": 10,
"point": 120,
"isAuth": true,
"gender": "F",
"signupDate": "2024-01-01, 00:00:00",
"chargeCount": 3,
"role": "CREATOR",
"messageNotice": true,
"followingChannelLiveNotice": false,
"followingChannelUploadContentNotice": true,
"auditionNotice": false,
"countryCode": "US",
"isAdultContentVisible": true,
"contentType": "FEMALE"
}
""".trimIndent()
val response = gson.fromJson(json, GetMemberInfoResponse::class.java)
assertEquals("US", response.countryCode)
assertEquals(true, response.isAdultContentVisible)
assertEquals(ContentType.FEMALE, response.contentType)
}
}