### Question:
AddDataMessage extends BroadcastMessage { @Override public protobuf.NetworkEnvelope toProtoNetworkEnvelope() { protobuf.StorageEntryWrapper.Builder builder = protobuf.StorageEntryWrapper.newBuilder(); final Message message = protectedStorageEntry.toProtoMessage(); if (protectedStorageEntry instanceof ProtectedMailboxStorageEntry) builder.setProtectedMailboxStorageEntry((protobuf.ProtectedMailboxStorageEntry) message); else builder.setProtectedStorageEntry((protobuf.ProtectedStorageEntry) message); return getNetworkEnvelopeBuilder() .setAddDataMessage(protobuf.AddDataMessage.newBuilder() .setEntry(builder)) .build(); } AddDataMessage(ProtectedStorageEntry protectedStorageEntry); private  AddDataMessage(ProtectedStorageEntry protectedStorageEntry, int messageVersion); @Override protobuf.NetworkEnvelope toProtoNetworkEnvelope(); static AddDataMessage fromProto(protobuf.AddDataMessage proto, NetworkProtoResolver resolver, int messageVersion);  }### Answer:
@Test public void toProtoBuf() throws Exception { SealedAndSigned sealedAndSigned = new SealedAndSigned(RandomUtils.nextBytes(10), RandomUtils.nextBytes(10), RandomUtils.nextBytes(10), keyRing1.getPubKeyRing().getSignaturePubKey()); PrefixedSealedAndSignedMessage prefixedSealedAndSignedMessage = new PrefixedSealedAndSignedMessage(new NodeAddress("host", 1000), sealedAndSigned, RandomUtils.nextBytes(10), UUID.randomUUID().toString()); MailboxStoragePayload mailboxStoragePayload = new MailboxStoragePayload(prefixedSealedAndSignedMessage, keyRing1.getPubKeyRing().getSignaturePubKey(), keyRing1.getPubKeyRing().getSignaturePubKey()); ProtectedStorageEntry protectedStorageEntry = new ProtectedMailboxStorageEntry(mailboxStoragePayload, keyRing1.getSignatureKeyPair().getPublic(), 1, RandomUtils.nextBytes(10), keyRing1.getPubKeyRing().getSignaturePubKey(), Clock.systemDefaultZone()); AddDataMessage dataMessage1 = new AddDataMessage(protectedStorageEntry); protobuf.NetworkEnvelope envelope = dataMessage1.toProtoNetworkEnvelope(); }