### Question:
Rdn implements Cloneable, Externalizable, Iterable<Ava>, Comparable<Rdn> { @Override public Iterator<Ava> iterator() { if ( nbAvas < 2 ) { return new Iterator<Ava>() { private boolean hasMoreElement = nbAvas == 1; @Override public boolean hasNext() { return hasMoreElement; } @Override public Ava next() { Ava obj = ava; hasMoreElement = false; return obj; } @Override public void remove() { } }; } else { return avas.iterator(); } } Rdn();  Rdn( SchemaManager schemaManager );  Rdn( SchemaManager schemaManager, String rdn );  Rdn( String rdn );  Rdn( SchemaManager schemaManager, String upType, String upValue );  Rdn( String upType, String upValue );  Rdn( SchemaManager schemaManager, Ava... avas );  Rdn( Ava... avas );  Rdn( Rdn rdn );  Rdn( SchemaManager schemaManager, Rdn rdn ); Object getValue( String type ); Ava getAva( String type ); @Override Iterator<Ava> iterator(); @Override Rdn clone(); String getName(); String getNormName(); Ava getAva(); Ava getAva( int pos ); String getType(); String getNormType(); String getValue(); @Override boolean equals( Object that ); int size(); static Object unescapeValue( String value ); static String escapeValue( String value ); String getEscaped(); static String escapeValue( byte[] attrValue ); boolean isSchemaAware(); static boolean isValid( String dn ); static boolean isValid( SchemaManager schemaManager, String dn ); @Override int hashCode(); int serialize( byte[] buffer, int pos ); int deserialize( byte[] buffer, int pos ); @Override void writeExternal( ObjectOutput out ); @Override void readExternal( ObjectInput in ); @Override int compareTo( Rdn otherRdn ); @Override String toString(); static final Rdn EMPTY_RDN; static final int UNDEFINED; static final int SUPERIOR; static final int INFERIOR; static final int EQUAL; }### Answer:
@Test public void testMultiValuedIterator() throws LdapException { Rdn rdn = new Rdn( "cn=Kate Bush+sn=Bush" ); Iterator<Ava> iterator = rdn.iterator(); assertNotNull( iterator ); assertTrue( iterator.hasNext() ); assertNotNull( iterator.next() ); assertTrue( iterator.hasNext() ); assertNotNull( iterator.next() ); assertFalse( iterator.hasNext() ); }
@Test public void testSingleValuedIterator() throws LdapException { Rdn rdn = new Rdn( "cn=Kate Bush" ); Iterator<Ava> iterator = rdn.iterator(); assertNotNull( iterator ); assertTrue( iterator.hasNext() ); assertNotNull( iterator.next() ); assertFalse( iterator.hasNext() ); }
@Test public void testEmptyIterator() { Rdn rdn = new Rdn(); Iterator<Ava> iterator = rdn.iterator(); assertNotNull( iterator ); assertFalse( iterator.hasNext() ); }
@Test public void testIterator() throws LdapException { Rdn rdn = new Rdn( "cn=John + sn=Doe" ); String[] expected = new String[] { "cn=John ", " sn=Doe" }; int i = 0; for ( Ava ava : rdn ) { assertEquals( expected[i], ava.getName() ); i++; } }