### Question:
PrivateTransaction { public void writeTo(final RLPOutput out) { out.startList(); out.writeLongScalar(getNonce()); out.writeUInt256Scalar(getGasPrice()); out.writeLongScalar(getGasLimit()); out.writeBytes(getTo().isPresent() ? getTo().get() : Bytes.EMPTY); out.writeUInt256Scalar(getValue()); out.writeBytes(getPayload()); writeSignature(out); out.writeBytes(getPrivateFrom()); getPrivateFor() .ifPresent(privateFor -> out.writeList(privateFor, (bv, rlpO) -> rlpO.writeBytes(bv))); getPrivacyGroupId().ifPresent(out::writeBytes); out.writeBytes(getRestriction().getBytes()); out.endList(); } protected  PrivateTransaction(
      final long nonce,
      final Wei gasPrice,
      final long gasLimit,
      final Optional<Address> to,
      final Wei value,
      final SECP256K1.Signature signature,
      final Bytes payload,
      final Address sender,
      final Optional<BigInteger> chainId,
      final Bytes privateFrom,
      final Optional<List<Bytes>> privateFor,
      final Optional<Bytes> privacyGroupId,
      final Restriction restriction); protected  PrivateTransaction(final PrivateTransaction privateTransaction); static Builder builder(); @SuppressWarnings({"unchecked"}) static PrivateTransaction readFrom(final RLPInput input); boolean isGroupRemovalTransaction(); long getNonce(); Wei getGasPrice(); long getGasLimit(); Optional<Address> getTo(); Wei getValue(); SECP256K1.Signature getSignature(); Bytes getPayload(); Optional<BigInteger> getChainId(); Bytes getPrivateFrom(); Optional<List<Bytes>> getPrivateFor(); Optional<Bytes> getPrivacyGroupId(); Restriction getRestriction(); Address getSender(); void writeTo(final RLPOutput out); BigInteger getR(); BigInteger getS(); BigInteger getV(); @Deprecated(since = "1.4.3") Hash getHash(); boolean isContractCreation(); Wei getUpfrontGasCost(); Wei getUpfrontCost(); Bytes32 determinePrivacyGroupId(); @Override boolean equals(final Object other); @Override int hashCode(); @Override String toString(); Optional<Address> contractAddress();  }### Answer:
@Test public void testWriteTo() { BytesValueRLPOutput bvrlpo = new BytesValueRLPOutput(); VALID_PRIVATE_TRANSACTION.writeTo(bvrlpo); assertThat(bvrlpo.encoded().toString()).isEqualTo(VALID_PRIVATE_TRANSACTION_RLP); }