### Question:
DN2ID extends AbstractTree { EntryID get(ReadableTransaction txn, DN dn) throws StorageRuntimeException { final ByteString value = txn.read(getName(), toKey(dn)); return value != null ? new EntryID(value) : null; } DN2ID(TreeName treeName, DN baseDN); @Override String keyToString(ByteString key); @Override String valueToString(ByteString value); @Override ByteString generateKey(String key);  }### Answer:
@Test public void testCanAddDN() throws Exception { populate(); assertThat(get("dc=example,dc=com")).isEqualTo(id(1)); assertThat(get("ou=People,dc=example,dc=com")).isEqualTo(id(4)); assertThat(get("cn=dev1,cn=bar,ou=People,dc=example,dc=com")).isEqualTo(id(10)); }
@Test public void testGetNonExistingDNReturnNull() throws Exception { assertThat(get("dc=non,dc=existing")).isNull(); }
@Test public void testTraverseChildren() throws Exception { populate(); assertThat(traverseChildren("ou=People,dc=example,dc=com")) .containsExactly( get("cn=bar,ou=People,dc=example,dc=com"), get("cn=barbar,ou=People,dc=example,dc=com"), get("cn=foo,ou=People,dc=example,dc=com"), get("cn=foofoo,ou=People,dc=example,dc=com")); }
@Test public void testTraverseSubordinates() throws Exception { populate(); assertThat(traverseSubordinates("ou=People,dc=example,dc=com")) .containsExactly( get("cn=bar,ou=People,dc=example,dc=com"), get("cn=dev0,cn=bar,ou=People,dc=example,dc=com"), get("cn=dev1,cn=bar,ou=People,dc=example,dc=com"), get("cn=barbar,ou=People,dc=example,dc=com"), get("cn=foo,ou=People,dc=example,dc=com"), get("cn=foofoo,ou=People,dc=example,dc=com")); }