AlertMessage extends ProtocolMessage { @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("AlertMessage:"); sb.append("\n Level: "); if (level != null) { if (AlertLevel.getAlertLevel(level.getValue()) == AlertLevel.UNDEFINED) { sb.append(level.getValue()); } else { sb.append(AlertLevel.getAlertLevel(level.getValue())); } } else { sb.append("null"); } sb.append("\n Description: "); if (description != null) { if (AlertDescription.getAlertDescription(description.getValue()) == null) { sb.append(description.getValue()); } else { sb.append(AlertDescription.getAlertDescription(description.getValue())); } } else { sb.append("null"); } return sb.toString(); } AlertMessage();  AlertMessage(Config tlsConfig); ModifiableByte getLevel(); void setLevel(byte level); void setLevel(ModifiableByte level); ModifiableByte getDescription(); void setDescription(byte description); void setDescription(ModifiableByte description); byte[] getConfig(); void setConfig(byte[] config); void setConfig(AlertLevel level, AlertDescription description); @Override String toString(); @Override String toCompactString(); @Override boolean equals(Object obj); @Override int hashCode(); @Override ProtocolMessageHandler getHandler(TlsContext context);  }
@Test public void testToString() { byte testBytes = (byte) 199; StringBuilder sb = new StringBuilder(); sb.append("AlertMessage:"); sb.append("\n Level: ").append("null"); sb.append("\n Description: ").append("null"); assertEquals(sb.toString(), message.toString()); message.setDescription(testBytes); message.setLevel(testBytes); sb.setLength(0); sb.append("AlertMessage:"); sb.append("\n Level: ").append(testBytes); sb.append("\n Description: ").append(testBytes); assertEquals(sb.toString(), message.toString()); }