-
Notifications
You must be signed in to change notification settings - Fork 7
/
BaseUrlLocalConfigTest.kt
36 lines (30 loc) · 1.11 KB
/
BaseUrlLocalConfigTest.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package io.embrace.android.embracesdk.config.local
import io.embrace.android.embracesdk.deserializeEmptyJsonString
import io.embrace.android.embracesdk.deserializeJsonFromResource
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Test
internal class BaseUrlLocalConfigTest {
@Test
fun testDefaults() {
val cfg = BaseUrlLocalConfig()
verifyDefaults(cfg)
}
@Test
fun testDeserialization() {
val obj = deserializeJsonFromResource<BaseUrlLocalConfig>("base_url_config.json")
assertEquals("https://config.example.com", obj.config)
assertEquals("https://data.example.com", obj.data)
assertEquals("https://images.example.com", obj.images)
}
@Test
fun testEmptyObject() {
val obj = deserializeEmptyJsonString<BaseUrlLocalConfig>()
verifyDefaults(obj)
}
private fun verifyDefaults(obj: BaseUrlLocalConfig) {
assertNull("https://config.emb-api.com", obj.config)
assertNull("https://data.emb-api.com", obj.data)
assertNull("https://images.emb-api.com", obj.images)
}
}