### Question:
TransmitException extends CommunicationException { @Override public String getMessage() { String message = super.getMessage(); if (message == null) message = ""; if (transmitStatus != null) { if (message.length() > 0) message = message + " > "; message = message + transmitStatus.toString(); } return message; } TransmitException(XBeeTransmitStatus transmitStatus);  TransmitException(String message, XBeeTransmitStatus transmitStatus);  TransmitException(String message, Throwable cause, XBeeTransmitStatus transmitStatus); XBeeTransmitStatus getTransmitStatus(); String getTransmitStatusMessage(); @Override String getMessage();  }### Answer:
@Test public final void testGetMessageOnlyTransmitStatus() { XBeeTransmitStatus transmitStatus = XBeeTransmitStatus.UNKNOWN; TransmitException e = new TransmitException(transmitStatus); String result = e.getMessage(); assertThat("Created 'TransmitException' does not return the expected message", result, is(equalTo("There was a problem transmitting the XBee API packet. > " + transmitStatus.toString()))); }
@Test public final void testGetMessageOnlyTransmitStatusNull() { XBeeTransmitStatus transmitStatus = null; TransmitException e = new TransmitException(transmitStatus); String result = e.getMessage(); assertThat("Created 'TransmitException' does not return the expected message", result, is(equalTo("There was a problem transmitting the XBee API packet."))); }
@Test public final void testGetMessageOnlyTransmitStatusAndMessage() { XBeeTransmitStatus transmitStatus = XBeeTransmitStatus.WIFI_PHYSICAL_ERROR; String message = "This is the message"; TransmitException e = new TransmitException(message, transmitStatus); String result = e.getMessage(); assertThat("Created 'TransmitException' does not return the expected message", result, is(equalTo(message + " > " + transmitStatus.toString()))); }
@Test public final void testGetMessageOnlyTransmitStatusNullAndMessage() { XBeeTransmitStatus transmitStatus = null; String message = "This is the message"; TransmitException e = new TransmitException(message, transmitStatus); String result = e.getMessage(); assertThat("Created 'TransmitException' does not return the expected message", result, is(equalTo(message))); }
@Test public final void testGetMessageOnlyTransmitStatusAndMessageNull() { XBeeTransmitStatus transmitStatus = XBeeTransmitStatus.WIFI_PHYSICAL_ERROR; String message = null; TransmitException e = new TransmitException(message, transmitStatus); String result = e.getMessage(); assertThat("Created 'TransmitException' does not return the expected message", result, is(equalTo(transmitStatus.toString()))); }
@Test public final void testGetMessageOnlyTransmitStatusAndMessageBothNull() { XBeeTransmitStatus transmitStatus = null; String message = null; TransmitException e = new TransmitException(message, transmitStatus); String result = e.getMessage(); assertThat("Created 'TransmitException' does not return the expected message", result, is(equalTo(""))); }