catch ( DecoderException de )
{
fail( de.getMessage() );
}
AdIfRelevant adIfRelevant = adIfRelevantContainer.getAdIfRelevant();
assertNotNull( adIfRelevant.getAuthorizationData().size() );
assertEquals( 2, adIfRelevant.getAuthorizationData().size() );
String[] expected = new String[]{ "abcdef", "ghijkl" };
int i = 0;
for ( AuthorizationDataEntry ad : adIfRelevant.getAuthorizationData() )
{
assertEquals( AuthorizationType.AD_INTENDED_FOR_SERVER, ad.getAdType() );
assertTrue( Arrays.equals( Strings.getBytesUtf8(expected[i++]), ad.getAdData() ) );
}
// Check the encoding
ByteBuffer bb = ByteBuffer.allocate( adIfRelevant.computeLength() );
try
{
bb = adIfRelevant.encode( bb );
// Check the length
assertEquals( 0x24, bb.limit() );
String encodedPdu = Strings.dumpBytes(bb.array());