} );
bb.flip();
PasswordPolicyDecorator control = new PasswordPolicyDecorator( codec, true );
PasswordPolicy passwordPolicy = ( PasswordPolicy ) control.decode( bb.array() );
assertTrue( passwordPolicy.hasResponse() );
assertEquals( 1, passwordPolicy.getResponse().getTimeBeforeExpiration() );
assertEquals( 1, passwordPolicy.getResponse().getPasswordPolicyError().getValue() );
ByteBuffer encoded = ( ( PasswordPolicyDecorator ) passwordPolicy ).encode(
ByteBuffer.allocate( ( ( PasswordPolicyDecorator ) passwordPolicy ).computeLength() ) );
assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array() ) );
}