### Question:
BalanceTransferReceipt extends Receipt { @Override public byte[] serialize() { final short version = (short) getVersion().getValue(); final ReceiptTypeDto type = ReceiptTypeDto.rawValueOf((short) getType().getValue()); final MosaicBuilder mosaic = MosaicBuilder.create( new MosaicIdDto(getMosaicId().getIdAsLong()), new AmountDto(getAmount().longValue())); final AddressDto senderAddress = SerializationUtils.toAddressDto(getSenderAddress()); final AddressDto recipientAddress = SerializationUtils.toAddressDto(getRecipientAddress()); return BalanceTransferReceiptBuilder.create( version, type, mosaic, senderAddress, recipientAddress) .serialize(); } BalanceTransferReceipt(
      Address senderAddress,
      Address recipientAddress,
      MosaicId mosaicId,
      BigInteger amount,
      ReceiptType type,
      ReceiptVersion version,
      Optional<Integer> size);  BalanceTransferReceipt(
      Address senderAddress,
      Address recipientAddress,
      MosaicId mosaicId,
      BigInteger amount,
      ReceiptType type,
      ReceiptVersion version); Address getSenderAddress(); Address getRecipientAddress(); MosaicId getMosaicId(); BigInteger getAmount(); @Override byte[] serialize();  }### Answer:
@Test void shouldSerializeTheSameAsTypescript() { Address sender = Address.generateRandom(networkType); Address recipient = Address.generateRandom(networkType); BalanceTransferReceipt balanceTransferReceipt = new BalanceTransferReceipt( sender, recipient, new MosaicId("941299B2B7E1291C"), BigInteger.valueOf(1000), ReceiptType.MOSAIC_RENTAL_FEE, ReceiptVersion.BALANCE_TRANSFER); String hex = ConvertUtils.toHex(balanceTransferReceipt.serialize()); Assertions.assertEquals( "01004D121C29E1B7B2991294E803000000000000" + sender.encoded() + recipient.encoded(), hex.toUpperCase()); }