### Question:
TransferTransaction extends Transaction implements RecipientTransaction { @Override public UnresolvedAddress getRecipient() { return recipient; } TransferTransaction(TransferTransactionFactory factory); @Override UnresolvedAddress getRecipient(); List<Mosaic> getMosaics(); Optional<Message> getMessage();  }### Answer:
@Test @DisplayName("Serialization-public-namespace-recipient") void serializationNamespaceRecipient() { String expected = "C4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001905441000000000000000001000000000000009151776168D24257D80000000000000000000000000000001400010000000000672B0000CE560000640000000000000000536F6D65204D65737361676520E6BCA2E5AD97"; NamespaceId recipient = NamespaceId.createFromName("nem.owner"); Assertions.assertEquals("D85742D268617751", recipient.getIdAsHex()); Assertions.assertEquals( "9151776168D24257D8000000000000000000000000000000", recipient.encoded(networkType)); TransferTransaction transaction = TransferTransactionFactory.create( networkType, recipient, Collections.singletonList( new Mosaic( new MosaicId(new BigInteger("95442763262823")), BigInteger.valueOf(100)))) .message(new PlainMessage("Some Message 漢字")) .deadline(new FakeDeadline()) .build(); Assertions.assertEquals( recipient.encoded(networkType), transaction.getRecipient().encoded(networkType)); assertSerialization(expected, transaction); }
@Test void serializeNamespaceTransaction() { NamespaceId namespaceId = NamespaceId.createFromName("testaccount2"); Assertions.assertEquals("E7CA7E22727DDD88", namespaceId.getIdAsHex()); TransferTransaction transaction = TransferTransactionFactory.create( networkType, namespaceId, Collections.singletonList( NetworkCurrency.CAT_CURRENCY.createAbsolute(BigInteger.ONE))) .message(new PlainMessage("test-message")) .deadline(new Deadline(BigInteger.ONE)) .build(); byte[] payload = transaction.serialize(); String payloadHex = ConvertUtils.toHex(payload); TransferTransaction newTransaction = (TransferTransaction) new BinarySerializationImpl().deserialize(payload); String newPayloadHex = ConvertUtils.toHex(newTransaction.serialize()); Assertions.assertEquals( transaction.getRecipient().encoded(networkType), newTransaction.getRecipient().encoded(networkType)); Assertions.assertEquals(payloadHex, newPayloadHex); }