Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ package com.qonversion.android.sdk.dto
enum class QRemoteConfigurationAssignmentType(val type: String) {
Auto("auto"),
Manual("manual"),
Unknown("unknown");
Unknown("unknown"),
// Appended to preserve the ordinals of the existing public enum values.
Frozen("frozen");

companion object {
fun fromType(type: String): QRemoteConfigurationAssignmentType {
return when (type) {
"auto" -> Auto
"manual" -> Manual
"frozen" -> Frozen
else -> Unknown
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.qonversion.android.sdk.dto

import org.junit.Assert.assertEquals
import org.junit.Test

class QRemoteConfigurationAssignmentTypeTest {
@Test
fun `frozen wire value preserves assignment provenance`() {
assertEquals(
QRemoteConfigurationAssignmentType.Frozen,
QRemoteConfigurationAssignmentType.fromType("frozen")
)
}

@Test
fun `existing enum ordinals and unknown fallback remain compatible`() {
assertEquals(0, QRemoteConfigurationAssignmentType.Auto.ordinal)
assertEquals(1, QRemoteConfigurationAssignmentType.Manual.ordinal)
assertEquals(2, QRemoteConfigurationAssignmentType.Unknown.ordinal)
assertEquals(
QRemoteConfigurationAssignmentType.Unknown,
QRemoteConfigurationAssignmentType.fromType("future")
)
}
}
Loading