protected String getTapsCommonPrefix( FlowProcess<? extends Config> flowProcess ) { if( commonPrefix == null ) commonPrefix = getTapPrefixMap( flowProcess ).getCommonPrefix(); return commonPrefix; }
@Test public void testGetCommonPrefixNone() { Trie<String> trie = new Trie<>(); trie.put( "a", "a" ); trie.put( "b", "a" ); trie.put( "c", "a" ); trie.put( "e", "a" ); trie.put( "f", "a" ); assertEquals( "", trie.getCommonPrefix() ); } }
@Test public void testGetCommonPrefix() { Trie<String> trie = new Trie<>(); trie.put( "a", "a" ); trie.put( "aa", "aa" ); trie.put( "aaa", "aaa" ); trie.put( "aabb", "aabb" ); trie.put( "aaabb", "aaabb" ); trie.put( "aacbb", "aacbb" ); assertEquals( "aa", trie.getCommonPrefix() ); }