-
Notifications
You must be signed in to change notification settings - Fork 7
/
OrientationTest.kt
36 lines (29 loc) · 1.1 KB
/
OrientationTest.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
import android.content.res.Configuration
import io.embrace.android.embracesdk.payload.Orientation
import org.junit.Assert.assertEquals
import org.junit.Test
internal class OrientationTest {
private val testOrientation = Orientation(
"p",
12345678L
)
@Test
fun testSerialization() {
assertJsonMatchesGoldenFile("orientation_expected.json", testOrientation)
}
@Test
fun testDeserialization() {
val obj = deserializeJsonFromResource<Orientation>("orientation_expected.json")
assertEquals("p", obj.orientation)
assertEquals(12345678L, obj.timestamp)
assertEquals(Configuration.ORIENTATION_PORTRAIT, obj.internalOrientation)
}
@Test
fun testInternalOrientation() {
val portraitOrientation = Orientation("p", 1234L)
val landscapeOrientation = Orientation("l", 1234L)
assertEquals(Configuration.ORIENTATION_PORTRAIT, portraitOrientation.internalOrientation)
assertEquals(Configuration.ORIENTATION_LANDSCAPE, landscapeOrientation.internalOrientation)
}
}