aboutsummaryrefslogtreecommitdiffstats
path: root/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/test/java/org/openecomp/config/ConfigurationUtilsTest.java
blob: b770d8677bd42d0642db4c3d27baae6161d1d0fa (plain)
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
package org.openecomp.config;

import org.junit.Test;

import java.util.Arrays;
import java.util.List;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

public class ConfigurationUtilsTest {
    @Test
    public void testCommaList() {
        List list = Arrays.asList("1", "2", 3);
        String commaSeparatedList = ConfigurationUtils.getCommaSeparatedList(list);
        list.forEach(o -> assertTrue(commaSeparatedList.contains(o.toString())));
    }

    @Test
    public void testCommaListWithNullAndEmptyStrings() {
        List list = Arrays.asList(null, "", " ");
        String commaSeparatedList = ConfigurationUtils.getCommaSeparatedList(list);
        assertTrue(commaSeparatedList.isEmpty());
    }

    @Test
    public void testGetArrayClassFunction() {
        assertEquals(String[].class , ConfigurationUtils.getArrayClass(String.class));
        assertNull(ConfigurationUtils.getArrayClass(ConfigurationUtilsTest.class));
    }
}