0x04, 0x03, 'a', 'b', 'c', // cookie syncCookie OPTIONAL,
0x01, 0x01, (byte)0x00 // refreshDone BOOLEAN DEFAULT TRUE
} );
bb.flip();
SyncInfoValue decorator = new SyncInfoValueDecorator( codec );
decorator.setType( SynchronizationInfoEnum.REFRESH_PRESENT );
SyncInfoValue syncInfoValue = (SyncInfoValue)((SyncInfoValueDecorator)decorator).decode( bb.array() );
assertEquals( SynchronizationInfoEnum.REFRESH_PRESENT, syncInfoValue.getType() );
assertEquals( "abc", Strings.utf8ToString(syncInfoValue.getCookie()) );
assertFalse( syncInfoValue.isRefreshDone() );
// Check the encoding
try
{
ByteBuffer encoded = ((SyncInfoValueDecorator)syncInfoValue).encode( ByteBuffer.allocate( ((SyncInfoValueDecorator)syncInfoValue).computeLength() ) );