public void testCharBasedCollisions(){
  CharsToNameCanonicalizer sym=CharsToNameCanonicalizer.createRoot();
  try {
    int firstHash=0;
    for (    String str : CHAR_COLLISIONS) {
      int hash=sym.calcHash(str);
      if (firstHash == 0) {
        firstHash=hash;
      }
 else {
        assertEquals(firstHash,hash);
      }
      sym.findSymbol(str.toCharArray(),0,str.length(),hash);
    }
    fail("Should have thrown exception");
  }
 catch (  IllegalStateException e) {
    verifyException(e,"exceeds maximum");
    assertEquals(CharsToNameCanonicalizer.MAX_COLL_CHAIN_LENGTH + 1,sym.maxCollisionLength());
    assertEquals(CharsToNameCanonicalizer.MAX_COLL_CHAIN_LENGTH + 1,sym.collisionCount());
    assertEquals(CharsToNameCanonicalizer.MAX_COLL_CHAIN_LENGTH + 2,sym.size());
  }
}

public void testCharBasedCollisions ( ) { CharsToNameCanonicalizer sym = CharsToNameCanonicalizer . createRoot ( ) ; try { int firstHash = 0 ; for ( String str : CHAR_COLLISIONS ) { int hash = sym . calcHash ( str ) ; if ( firstHash == 0 ) { firstHash = hash ; } else { assertEquals ( firstHash , hash ) ; } sym . findSymbol ( str . toCharArray ( ) , 0 , str . length ( ) , hash ) ; } fail ( "Should have thrown exception" ) ; } catch ( IllegalStateException e ) { verifyException ( e , "exceeds maximum" ) ; assertEquals ( CharsToNameCanonicalizer . MAX_COLL_CHAIN_LENGTH + 1 , sym . maxCollisionLength ( ) ) ; assertEquals ( CharsToNameCanonicalizer . MAX_COLL_CHAIN_LENGTH + 1 , sym . collisionCount ( ) ) ; assertEquals ( CharsToNameCanonicalizer . MAX_COLL_CHAIN_LENGTH + 2 , sym . size ( ) ) ; } }
test to see what happens with pre - computed collisions ; should get an exception .
