1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.collections4;
18
19 import static org.junit.jupiter.api.Assertions.assertSame;
20 import static org.junit.jupiter.api.Assertions.assertThrows;
21 import static org.junit.jupiter.api.Assertions.assertTrue;
22
23 import org.apache.commons.collections4.trie.PatriciaTrie;
24 import org.apache.commons.collections4.trie.UnmodifiableTrie;
25 import org.junit.jupiter.api.Test;
26
27
28
29
30 public class TrieUtilsTest {
31
32 @Test
33 public void testUnmodifiableTrie() {
34 final Trie<String, Object> trie = TrieUtils.unmodifiableTrie(new PatriciaTrie<>());
35 assertTrue(trie instanceof UnmodifiableTrie, "Returned object should be an UnmodifiableTrie.");
36
37 assertThrows(NullPointerException.class, () -> TrieUtils.unmodifiableTrie(null));
38
39 assertSame(trie, TrieUtils.unmodifiableTrie(trie), "UnmodifiableTrie shall not be decorated");
40 }
41
42 }
43