### Question:
RpcMessage { public ReplicationWireMessage getWireMessage( long messageId, long from, long to, boolean inReply ) { return new ReplicationWireMessage( messageId, from, to, quorumId, inReply, getRequestVoteMessage(), getRequestVoteReplyMessage(), getAppendMessage(), getAppendReplyMessage(), getPreElectionPollMessage(), getPreElectionReplyMessage() ); } protected  RpcMessage(long to, long from, String quorumId, Message message); protected  RpcMessage(ReplicationWireMessage wireMessage); @Override String toString(); ReplicationWireMessage getWireMessage(
      long messageId,
      long from,
      long to,
      boolean inReply
  ); boolean isAppendMessage(); boolean isRequestVoteMessage(); boolean isPreElectionPollMessage(); boolean isAppendReplyMessage(); boolean isRequestVoteReplyMessage(); boolean isPreElectionReplyMessage(); AppendEntries getAppendMessage(); AppendEntriesReply getAppendReplyMessage(); RequestVote getRequestVoteMessage(); RequestVoteReply getRequestVoteReplyMessage(); PreElectionPoll getPreElectionPollMessage(); PreElectionReply getPreElectionReplyMessage(); final long to; final long from; final String quorumId; final Message message; }### Answer:
@Test public void testGetWireMessageFragment() throws Exception { RequestVote requestVote = new RequestVote(22, 1, 42, 43); RpcMessage msg = new RpcMessage(0, 0, "quorumId", requestVote); ReplicationWireMessage wireMessage = msg.getWireMessage(1, 1, 1, false); assertNotEquals(null, wireMessage.getRequestVote()); assertEquals(null, wireMessage.getAppendEntries()); assertEquals(null, wireMessage.getAppendEntriesReply()); }
@Test public void testGetWireMessageFragment2() throws Exception { AppendEntries appendEntries = new AppendEntries(111, 1, 200, 201, Collections.emptyList(), 111); RpcMessage msg = new RpcMessage(0, 0, "quorumId", appendEntries); ReplicationWireMessage wireMessage = msg.getWireMessage(1, 1, 1, false); assertNotEquals(null, wireMessage.getAppendEntries()); assertEquals(null, wireMessage.getAppendEntriesReply()); assertEquals(null, wireMessage.getRequestVote()); assertEquals(null, wireMessage.getRequestVoteReply()); }