private String formatMessage(final Message message, final int id) { final StringBuilder buffer = new StringBuilder(); buffer.append(formatId(id)); buffer.append(formatUnread(message)); buffer.append(formatFrom(message)); buffer.append(message.getBody()); return buffer.toString(); }
private void showMessage() { final Token idToken = getArguments().get(0); final int id = validateId(idToken); final Message message = getInbox().get(id); println(String.format("Id: %d", id)); println(String.format("From: %s", message.getFrom().toString())); println(String.format("Body: %s", message.getBody())); println(); message.markAsRead(); }