1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.crypto.utils;
19
20 import static org.junit.jupiter.api.Assertions.assertEquals;
21
22 import java.util.Arrays;
23 import java.util.Collections;
24 import java.util.List;
25 import java.util.Properties;
26
27 import org.junit.jupiter.api.Test;
28
29
30 public class UtilsTest {
31 @Test
32 public void testGetProperties() {
33 final Properties props = new Properties();
34 props.setProperty(
35 "garbage.in",
36 "out");
37 final Properties allprops = Utils.getProperties(props);
38 assertEquals(allprops.getProperty("garbage.in"), "out");
39 }
40
41 @Test
42 public void testSplitNull() {
43 assertEquals(Collections.<String> emptyList(), Utils.splitClassNames(null, ","));
44 }
45
46 @Test
47 public void testSplitOmitEmptyLine() {
48 List<String> clazzNames = Utils.splitClassNames("", ",");
49 assertEquals(Collections.<String> emptyList(), clazzNames);
50
51 clazzNames = Utils.splitClassNames("a,b", ",");
52 assertEquals(Arrays.asList("a", "b"), clazzNames);
53 clazzNames = Utils.splitClassNames("a,b,", ",");
54 assertEquals(Arrays.asList("a", "b"), clazzNames);
55 clazzNames = Utils.splitClassNames("a, b,", ",");
56 assertEquals(Arrays.asList("a", "b"), clazzNames);
57 }
58 }