### Question:
DN2ID extends AbstractTree { static boolean isChild(ByteSequence parent, ByteSequence child) { if (!child.startsWith(parent)) { return false; } int nbSeparator = 0; for (int i = parent.length() ; i < child.length(); i++) { if (child.byteAt(i) == DN.NORMALIZED_RDN_SEPARATOR) { nbSeparator++; if (nbSeparator > 1) { return false; } } } return nbSeparator == 1; } DN2ID(TreeName treeName, DN baseDN); @Override String keyToString(ByteString key); @Override String valueToString(ByteString value); @Override ByteString generateKey(String key);  }### Answer:
@Test public void testIsChild() throws DirectoryException, Exception { put(dn("dc=example,dc=com"), 1); put(dn("ou=People,dc=example,dc=com"), 2); put(dn("uid=user.0,ou=People,dc=example,dc=com"), 3); put(dn("uid=user.1,ou=People,dc=example,dc=com"), 4); put(dn("uid=user.10,ou=People,dc=example,dc=com"), 5); storage.read(new ReadOperation<Void>() { @Override public Void run(ReadableTransaction txn) throws Exception { try (final Cursor<ByteString, ByteString> cursor = txn.openCursor(dn2ID.getName())) { cursor.next(); final ByteString rootDN = cursor.getKey(); cursor.next(); final ByteString parentDN = cursor.getKey(); cursor.next(); assertThat(DN2ID.isChild(rootDN, parentDN)).isTrue(); final ByteString childDN = cursor.getKey(); assertThat(DN2ID.isChild(parentDN, childDN)).isTrue(); cursor.next(); final ByteString otherChildDN = cursor.getKey(); assertThat(DN2ID.isChild(parentDN, otherChildDN)).isTrue(); assertThat(DN2ID.isChild(childDN, otherChildDN)).isFalse(); final ByteString lastChildDN = cursor.getKey(); assertThat(DN2ID.isChild(parentDN, lastChildDN)).isTrue(); assertThat(DN2ID.isChild(otherChildDN, lastChildDN)).isFalse(); assertThat(DN2ID.isChild(childDN, lastChildDN)).isFalse(); } return null; } }); }