* @throws Exception If the test failed unexpectedly.
*/
@Test
public void testEncodeDecode() throws Exception
{
ByteStringBuilder builder = new ByteStringBuilder();
ASN1Writer writer = ASN1.getWriter(builder);
ModifyDNRequestProtocolOp modifyEncoded;
ModifyDNRequestProtocolOp modifyDecoded;
modifyEncoded = new ModifyDNRequestProtocolOp(dn, newRdn, true,
newSuperiorDn);
modifyEncoded.write(writer);
ASN1Reader reader = ASN1.getReader(builder.toByteString());
modifyDecoded = (ModifyDNRequestProtocolOp)LDAPReader.readProtocolOp(reader);
assertEquals(modifyEncoded.getEntryDN(), modifyDecoded.getEntryDN());
assertEquals(modifyEncoded.getNewRDN(), modifyDecoded.getNewRDN());
assertEquals(modifyEncoded.getNewSuperior(), modifyDecoded.getNewSuperior());
assertEquals(modifyEncoded.deleteOldRDN(), modifyDecoded.deleteOldRDN());
builder.clear();
modifyEncoded = new ModifyDNRequestProtocolOp(dn, newRdn, true);
modifyEncoded.write(writer);
reader = ASN1.getReader(builder.toByteString());
modifyDecoded = (ModifyDNRequestProtocolOp)LDAPReader.readProtocolOp(reader);
assertEquals(modifyEncoded.getEntryDN(), modifyDecoded.getEntryDN());
assertEquals(modifyEncoded.getNewRDN(), modifyDecoded.getNewRDN());
assertEquals(modifyEncoded.getNewSuperior(), modifyDecoded.getNewSuperior());