Skip to content

Commit 9213b3d

Browse files
authored
Add a unit test for creating an M8 model (#8)
1 parent 0b25575 commit 9213b3d

File tree

2 files changed

+44
-17
lines changed

2 files changed

+44
-17
lines changed

app/src/test/java/com/fivegmag/a5gmscommonlibrary/ExampleUnitTest.kt

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.fivegmag.a5gmscommonlibrary
2+
3+
import com.fivegmag.a5gmscommonlibrary.models.EntryPoint
4+
import com.fivegmag.a5gmscommonlibrary.models.M8Model
5+
import com.fivegmag.a5gmscommonlibrary.models.ServiceListEntry
6+
import org.junit.Test
7+
8+
import org.junit.Assert.*
9+
10+
class M8ModelUnitTest {
11+
12+
@Test
13+
fun createModel() {
14+
var profiles = ArrayList<String>()
15+
profiles.add("profile1");
16+
17+
var firstEntryPoint = EntryPoint("locator1", "contentType1", profiles)
18+
var firstEntryPointList = ArrayList<EntryPoint>()
19+
firstEntryPointList.add(firstEntryPoint)
20+
21+
var secondEntryPoint = EntryPoint("locator2", "contentType2", profiles)
22+
var secondEntryPointList = ArrayList<EntryPoint>()
23+
secondEntryPointList.add(secondEntryPoint)
24+
25+
var firstServiceListEntry = ServiceListEntry("id1", "name1", firstEntryPointList)
26+
var secondServiceListEntry = ServiceListEntry("id2", "name2", secondEntryPointList)
27+
var serviceList = ArrayList<ServiceListEntry>()
28+
serviceList.add(firstServiceListEntry)
29+
serviceList.add(secondServiceListEntry)
30+
31+
var m5BaseUrl = "m5BaseUrl"
32+
var m8Model = M8Model(m5BaseUrl, serviceList)
33+
34+
assertEquals(m5BaseUrl, m8Model.m5BaseUrl)
35+
assertEquals("id1", m8Model.serviceList.get(0).provisioningSessionId)
36+
assertEquals("id2", m8Model.serviceList.get(1).provisioningSessionId)
37+
assertEquals("name1", m8Model.serviceList.get(0).name)
38+
assertEquals("name2", m8Model.serviceList.get(1).name)
39+
assertEquals("locator1", m8Model.serviceList.get(0).entryPoints?.get(0)?.locator ?: "fail")
40+
assertEquals("contentType1", m8Model.serviceList.get(0).entryPoints?.get(0)?.contentType ?: "fail")
41+
assertEquals("locator2", m8Model.serviceList.get(1).entryPoints?.get(0)?.locator ?: "fail")
42+
assertEquals("contentType2", m8Model.serviceList.get(1).entryPoints?.get(0)?.contentType ?: "fail")
43+
}
44+
}

0 commit comments

Comments
 (0)