throws Exception
{
final int A_BYTES = 0x41414141; // "AAAA"
final int B_BYTES = 0x42424242; // "BBBB"
BytesToNameCanonicalizer nc = BytesToNameCanonicalizer.createRoot()
.makeChild(JsonFactory.Feature.collectDefaults());
assertNull(nc.findName(A_BYTES));
assertNull(nc.findName(A_BYTES, B_BYTES));
nc.addName("AAAA", new int[] { A_BYTES }, 1);
Name n1 = nc.findName(A_BYTES);
assertNotNull(n1);
assertEquals("AAAA", n1.getName());
nc.addName("AAAABBBB", new int[] { A_BYTES, B_BYTES }, 2);
Name n2 = nc.findName(A_BYTES, B_BYTES);
assertEquals("AAAABBBB", n2.getName());
assertNotNull(n2);
/* and let's then just exercise this method so it gets covered;
* it's only used for debugging.
*/
assertNotNull(nc.toString());
}