diff options
author | 2020-01-09 15:48:07 +0000 | |
---|---|---|
committer | 2020-01-09 15:48:07 +0000 | |
commit | 1a38683847c91ec6f3861b83582ce7441d3050ca (patch) | |
tree | c89079dd7847bae0977075e5e3c62557e2ec7331 /vid-app-common/src/test/java/org/onap/vid/services/UserParamsContainerTest.kt | |
parent | 2d701e93373c70e33c2f797d7b2c177cfe96bc2e (diff) | |
parent | 6b5dd86a3557e8eed2c4584f5d16df5654cbc57b (diff) |
Merge "Fix the format of supplementary file and user params for aLaCarte requests"
Diffstat (limited to 'vid-app-common/src/test/java/org/onap/vid/services/UserParamsContainerTest.kt')
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/services/UserParamsContainerTest.kt | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/UserParamsContainerTest.kt b/vid-app-common/src/test/java/org/onap/vid/services/UserParamsContainerTest.kt new file mode 100644 index 000000000..511c4e5cb --- /dev/null +++ b/vid-app-common/src/test/java/org/onap/vid/services/UserParamsContainerTest.kt @@ -0,0 +1,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)) + } +}
\ No newline at end of file |