public class TlvTest {
@Test
public void testTlvWriter() throws Exception {
TagOutputStream out = new TagOutputStream(7);
TypeLengthValueWriter writer = new TypeLengthValueWriter(out);
writer.write(new NdefMessageTlv(new byte[] { 0x01, 0x02, 0x03, 0x04 }));
writer.close();
byte[] writtenData = out.getBuffer();
byte[] expectedData = { 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, (byte)0xFE };
assertArrayEquals(expectedData, writtenData);