NdefMessageEncoder { public byte[] encode(Record... records) { return encode(Arrays.asList(records)); } NdefMessageEncoder(NdefRecordEncoder ndefRecordEncoder); byte[] encodeSingle(Record record); void encodeSingle(Record record, ByteArrayOutputStream out); byte[] encode(Record... records); byte[] encode(Iterable<? extends Record> records); void encode(Iterable<? extends Record> records, ByteArrayOutputStream baos);  }
@Test(expected = RuntimeException.class) public void testEncoderWithUnkownRecord() throws Exception { List<Record> records = new ArrayList<Record>(); records.add(new UnknownRecord()); encoder.encode(records); }
@Test public void testEncodeMultiple() throws Exception { byte[] encode = encoder.encode(new TextRecord("R1", Locale.GERMANY), new TextRecord("R2", Locale.GERMANY)); assertEquals("910108540564652D44455231510108540564652D44455232", NfcUtils.convertBinToASCII(encode)); }