### Question:
TrieMap implements Iterable<T> { public void put(CharSequence seq, T value) { int length = seq.length(); if (length == 0) { throw new IllegalArgumentException("Must not put empty sequence into trie"); } if (root == null) { synchronized (this) { if (root == null) { root = new Node<T>(seq.charAt(0)); } } } root.put(seq, 0, value); }  void put(CharSequence seq, T value); Iterator<T> iterator(); void putPrefix(CharSequence seq, T value); States<T> get(CharSequence seq); States<T> get(CharSequence seq, State<T> stateInfo);  }### Answer:
@Test public void testThatMapDoesNotAcceptEmptySequence() throws Exception { TrieMap<Integer> map = new TrieMap<>(); try { map.put("", 1); fail("put() must not accept an empty char sequence"); } catch (IllegalArgumentException e) { } }
@Test public void testValueIteratorTwoValuesOneCharDeep() throws Exception { TrieMap<Integer> map = new TrieMap<Integer>(); map.put("1", 1); map.put("2", 2); List<Integer> values = new LinkedList<Integer>(); for (Integer v: map) { values.add(v); } assertThat(values, containsInAnyOrder((Integer) 1, (Integer) 2)); }
@Test public void testValueIteratorTwoValuesTwoCharsDeepOverlap() throws Exception { TrieMap<Integer> map = new TrieMap<Integer>(); map.put("11", 1); map.put("12", 2); List<Integer> values = new LinkedList<Integer>(); for (Integer v: map) { values.add(v); } assertThat(values, containsInAnyOrder((Integer) 1, (Integer) 2)); }