### Question:
ATCommandException extends CommunicationException { @Override public String getMessage() { String message = super.getMessage(); if (message == null) message = ""; if (atCommandStatus != null) { if (message.length() > 0) message = message + " > "; message = message + atCommandStatus.getDescription(); } return message; } ATCommandException(ATCommandStatus atCommandStatus);  ATCommandException(String message, ATCommandStatus atCommandStatus);  ATCommandException(String message, Throwable cause, ATCommandStatus atCommandStatus); ATCommandStatus getCommandStatus(); String getCommandStatusMessage(); @Override String getMessage();  }### Answer:
@Test public final void testGetMessageOnlyCommandStatus() { ATCommandStatus atCommandStatus = ATCommandStatus.UNKNOWN; ATCommandException e = new ATCommandException(atCommandStatus); String result = e.getMessage(); assertThat("Created 'ATCommandException' does not return the expected message", result, is(equalTo("There was a problem sending the AT command packet. > " + atCommandStatus.toString()))); }
@Test public final void testGetMessageOnlyCommandStatusNull() { ATCommandStatus atCommandStatus = null; ATCommandException e = new ATCommandException(atCommandStatus); String result = e.getMessage(); assertThat("Created 'ATCommandException' does not return the expected message", result, is(equalTo("There was a problem sending the AT command packet."))); }
@Test public final void testGetMessageOnlyCommandStatusAndMessage() { ATCommandStatus atCommandStatus = ATCommandStatus.OK; String message = "This is the message"; ATCommandException e = new ATCommandException(message, atCommandStatus); String result = e.getMessage(); assertThat("Created 'ATCommandException' does not return the expected message", result, is(equalTo(message + " > " + atCommandStatus.toString()))); }
@Test public final void testGetMessageOnlyCommandStatusNullAndMessage() { ATCommandStatus atCommandStatus = null; String message = "This is the message"; ATCommandException e = new ATCommandException(message, atCommandStatus); String result = e.getMessage(); assertThat("Created 'ATCommandException' does not return the expected message", result, is(equalTo(message))); }
@Test public final void testGetMessageOnlyCommandStatusAndMessageNull() { ATCommandStatus atCommandStatus = ATCommandStatus.TX_FAILURE; String message = null; ATCommandException e = new ATCommandException(message, atCommandStatus); String result = e.getMessage(); assertThat("Created 'ATCommandException' does not return the expected message", result, is(equalTo(atCommandStatus.toString()))); }
@Test public final void testGetMessageOnlyCommandStatusAndMessageBothNull() { ATCommandStatus atCommandStatus = null; String message = null; ATCommandException e = new ATCommandException(message, atCommandStatus); String result = e.getMessage(); assertThat("Created 'ATCommandException' does not return the expected message", result, is(equalTo(""))); }