CommitCommand extends BaseCommand { protected static void writeCommitResponse(TXCommitMessage response, Message origMsg, ServerConnection servConn) throws IOException { Message responseMsg = servConn.getResponseMessage(); responseMsg.setMessageType(MessageType.RESPONSE); responseMsg.setTransactionId(origMsg.getTransactionId()); responseMsg.setNumberOfParts(1); if (response != null) { response.setClientVersion(servConn.getClientVersion()); } responseMsg.addObjPart(response, false); servConn.getCache().getCancelCriterion().checkCancelInProgress(null); if (logger.isDebugEnabled()) { logger.debug("TX: sending a nonNull response for transaction: {}", new TXId((InternalDistributedMember) servConn.getProxyID().getDistributedMember(), origMsg.getTransactionId())); } responseMsg.send(servConn); origMsg.clearParts(); } private  CommitCommand(); static Command getCommand(); @Override void cmdExecute(final Message clientMessage, final ServerConnection serverConnection,
      final SecurityService securityService, long start);  }
@Test public void testWriteNullResponse() throws Exception { InternalCache cache = mock(InternalCache.class); Message origMsg = mock(Message.class); ServerConnection servConn = mock(ServerConnection.class); when(servConn.getResponseMessage()).thenReturn(mock(Message.class)); when(servConn.getCache()).thenReturn(cache); when(cache.getCancelCriterion()).thenReturn(mock(CancelCriterion.class)); CommitCommand.writeCommitResponse(null, origMsg, servConn); }