### Question:
DnNode { public synchronized DnNode<N> add( Dn dn ) throws LdapException { return add( dn, null ); } DnNode();  DnNode( N element );  DnNode( Dn dn, N element ); synchronized boolean isLeaf(); synchronized boolean isLeaf( Dn dn ); synchronized int size(); synchronized N getElement(); synchronized N getElement( Dn dn ); synchronized boolean hasElement(); synchronized boolean hasElement( Dn dn ); synchronized boolean hasDescendantElement( Dn dn ); synchronized List<N> getDescendantElements( Dn dn ); synchronized boolean hasChildren(); synchronized boolean hasChildren( Dn dn ); synchronized Map<String, DnNode<N>> getChildren(); synchronized DnNode<N> getParent(); synchronized boolean hasParent(); synchronized boolean hasParent( Dn dn ); synchronized DnNode<N> add( Dn dn ); synchronized DnNode<N> add( Dn dn, N element ); synchronized void remove( Dn dn ); synchronized boolean contains( Rdn rdn ); synchronized DnNode<N> getChild( Rdn rdn ); synchronized Rdn getRdn(); synchronized DnNode<N> getNode( Dn dn ); synchronized boolean hasParentElement( Dn dn ); synchronized DnNode<N> getParentWithElement( Dn dn ); synchronized DnNode<N> getParentWithElement(); synchronized void rename( Rdn newRdn ); synchronized void move( Dn newParent ); @Override String toString(); synchronized Dn getDn();  }### Answer:
@Test public void testAddNullDNNoElem() throws LdapException { DnNode<Dn> tree = new DnNode<Dn>(); assertThrows( LdapUnwillingToPerformException.class, () -> { tree.add( null ); } ); }
@Test public void testAdd2EqualDNsNoElem() throws LdapException { DnNode<Dn> tree = new DnNode<Dn>(); Dn dn1 = new Dn( "dc=b,dc=a" ); Dn dn2 = new Dn( "dc=b,dc=a" ); tree.add( dn1 ); assertThrows( LdapUnwillingToPerformException.class, () -> { tree.add( dn2 ); } ); }
@Test public void testAddNullDN() throws LdapException { DnNode<Dn> tree = new DnNode<Dn>(); assertThrows( LdapUnwillingToPerformException.class, () -> { tree.add( ( Dn ) null, null ); } ); }
@Test public void testAdd2EqualDNs() throws LdapException { DnNode<Dn> tree = new DnNode<Dn>(); Dn dn1 = new Dn( "dc=b,dc=a" ); Dn dn2 = new Dn( "dc=b,dc=a" ); tree.add( dn1, dn1 ); assertThrows( LdapUnwillingToPerformException.class, () -> { tree.add( dn2, dn2 ); } ); }