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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
package org.onap.vid.services
import org.hamcrest.CoreMatchers.equalTo
import org.hamcrest.MatcherAssert
import org.onap.vid.mso.model.ServiceInstantiationRequestDetails.UserParamNameAndValue
import org.testng.annotations.DataProvider
import org.testng.annotations.Test
class UserParamsContainerTest {
@DataProvider
fun userParamsDataProvider(): Array<Array<Any?>>? {
return arrayOf(
arrayOf<Any?>(
mapOf("a" to "b", "c" to "d"),
listOf(UserParamNameAndValue("e", "f"), UserParamNameAndValue("g", "h")),
mapOf("c" to "d", "a" to "b", "e" to "f", "g" to "h")
),
arrayOf<Any?>(
mapOf("a" to "b", "c" to "g"),
listOf(UserParamNameAndValue("c", "d") , UserParamNameAndValue("e", "f")),
mapOf("c" to "d", "a" to "b", "e" to "f")
),
arrayOf<Any?>(
emptyMap<String,String>(),
listOf(UserParamNameAndValue("c", "d"), UserParamNameAndValue("e", "f")),
mapOf("c" to "d", "e" to "f")
),
arrayOf<Any?>(
mapOf("a" to "b", "c" to "d"),
emptyList<UserParamNameAndValue>(),
mapOf("a" to "b", "c" to "d")
),
arrayOf<Any?>(
emptyMap<String,String>(),
emptyList<UserParamNameAndValue>(),
emptyMap<String,String>()
),
arrayOf(
null,
emptyList<UserParamNameAndValue>(),
emptyMap<String,String>()
),
arrayOf<Any?>(
emptyMap<String,String>(),
null,
emptyMap<String,String>()
)
)
}
@Test(dataProvider = "userParamsDataProvider")
fun testUserParamsConvertorCtor(instanceParams: Map<String, String>?, suppParams: List<UserParamNameAndValue>?, expected: Map<String, String>) {
val aggParams: Map<String, String> = UserParamsContainer(instanceParams, suppParams).params
MatcherAssert.assertThat("Aggregated params are not as expected", aggParams, equalTo(expected))
}
}
|