public void testCorrectBuild(){
  Iterator<String> iter=m_Trie.iterator();
  HashSet<String> set=new HashSet<String>();
  while (iter.hasNext())   set.add(iter.next());
  assertEquals("size() does not reflect number of added strings",m_Data.length,m_Trie.size());
  assertEquals("Iterator returns different number of strings",m_Data.length,set.size());
  for (int i=0; i < m_Data.length; i++) {
    if (!set.contains(m_Data[i]))     fail("Cannot find string '" + m_Data[i] + "'");
  }
}

public void testCorrectBuild ( ) { Iterator < String > iter = m_Trie . iterator ( ) ; HashSet < String > set = new HashSet < String > ( ) ; while ( iter . hasNext ( ) ) set . add ( iter . next ( ) ) ; assertEquals ( "size() does not reflect number of added strings" , m_Data . length , m_Trie . size ( ) ) ; assertEquals ( "Iterator returns different number of strings" , m_Data . length , set . size ( ) ) ; for ( int i = 0 ; i < m_Data . length ; i ++ ) { if ( ! set . contains ( m_Data [ i ] ) ) fail ( "Cannot find string '" + m_Data [ i ] + "'" ) ; } }
tests whether all the string the trie got built with can be retrieved again ( tests building and retrieval via iterator ) .
