1 package org.onap.vid.aai.util;
3 import org.testng.annotations.DataProvider;
4 import org.testng.annotations.Test;
6 import java.util.Arrays;
9 import static org.hamcrest.Matchers.is;
10 import static org.hamcrest.MatcherAssert.assertThat;
11 import static org.onap.vid.aai.util.CacheProvider.compileKey;
12 import static org.onap.vid.aai.util.CacheProvider.decompileKey;
14 public class CacheProviderTest {
15 @Test(dataProvider = "aaiClientCompileDecompileKeySameData")
16 public void compileDecompileKeySameTest(List<String> args) {
17 assertThat(decompileKey(compileKey(args)), is(args.toArray()));
20 @Test(dataProvider = "aaiClientCompileDecompileKeyDifferentData")
21 public void compileDecompileKeyDifferentTest(List<String> expectedResult, List<String> args) {
22 assertThat(decompileKey(compileKey(args)), is(expectedResult.toArray()));
26 public static Object[][] aaiClientCompileDecompileKeySameData() {
27 return new Object[][] {
28 {Arrays.asList( "a", "b", "c")},
30 {Arrays.asList("a!", "@#?b")},
31 {Arrays.asList("a", "", "c")}
36 public static Object[][] aaiClientCompileDecompileKeyDifferentData() {
37 return new Object[][] {
38 {Arrays.asList("a", "", "c"), Arrays.asList("a", null, "c")}