@Test public void toStringShouldListSingleCommand() { WsCommandMessage message = new WsCommandMessage(Command.noop()); String result = message.toString(); assertEquals("COMMAND: [NOOP]", result); }
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append(getKind()); builder.append(": "); Command[] commandsToLog = commands; if (commands.length > 3) { commandsToLog = Arrays.copyOf(commands, 3); } builder.append(Arrays.toString(commandsToLog)); if (commands.length > 3) { builder.append("..."); } return builder.toString(); }
WsCommandMessage extends WsMessage { @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append(getKind()); builder.append(": "); Command[] commandsToLog = commands; if (commands.length > 3) { commandsToLog = Arrays.copyOf(commands, 3); } builder.append(Arrays.toString(commandsToLog)); if (commands.length > 3) { builder.append("..."); } return builder.toString(); } }
WsCommandMessage extends WsMessage { @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append(getKind()); builder.append(": "); Command[] commandsToLog = commands; if (commands.length > 3) { commandsToLog = Arrays.copyOf(commands, 3); } builder.append(Arrays.toString(commandsToLog)); if (commands.length > 3) { builder.append("..."); } return builder.toString(); } WsCommandMessage(Command... commands); }
WsCommandMessage extends WsMessage { @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append(getKind()); builder.append(": "); Command[] commandsToLog = commands; if (commands.length > 3) { commandsToLog = Arrays.copyOf(commands, 3); } builder.append(Arrays.toString(commandsToLog)); if (commands.length > 3) { builder.append("..."); } return builder.toString(); } WsCommandMessage(Command... commands); Command[] getCommands(); @Override Kind getKind(); @Override String toString(); }
WsCommandMessage extends WsMessage { @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append(getKind()); builder.append(": "); Command[] commandsToLog = commands; if (commands.length > 3) { commandsToLog = Arrays.copyOf(commands, 3); } builder.append(Arrays.toString(commandsToLog)); if (commands.length > 3) { builder.append("..."); } return builder.toString(); } WsCommandMessage(Command... commands); Command[] getCommands(); @Override Kind getKind(); @Override String toString(); static final WsMessage NOOP; static final WsMessage RECONNECT; static final WsMessage CLOSE; }