@Test public void shouldGetMessageWithCodeAndParams() { OpenLmisMessage openLmisMessage = new OpenLmisMessage("code", "1", "2", "3"); assertThat(openLmisMessage.toString(), is("code: code, params: { 1; 2; 3 }")); }
@Override public String toString() { if (params.length == 0) return code; StringBuilder messageBuilder = new StringBuilder("code: " + code + ", params: { "); for (String param : params) { messageBuilder.append("; ").append(param); } messageBuilder.append(" }"); return messageBuilder.toString().replaceFirst("; ", ""); }
OpenLmisMessage { @Override public String toString() { if (params.length == 0) return code; StringBuilder messageBuilder = new StringBuilder("code: " + code + ", params: { "); for (String param : params) { messageBuilder.append("; ").append(param); } messageBuilder.append(" }"); return messageBuilder.toString().replaceFirst("; ", ""); } }
OpenLmisMessage { @Override public String toString() { if (params.length == 0) return code; StringBuilder messageBuilder = new StringBuilder("code: " + code + ", params: { "); for (String param : params) { messageBuilder.append("; ").append(param); } messageBuilder.append(" }"); return messageBuilder.toString().replaceFirst("; ", ""); } OpenLmisMessage(String code);  OpenLmisMessage(String code, String... params); }
OpenLmisMessage { @Override public String toString() { if (params.length == 0) return code; StringBuilder messageBuilder = new StringBuilder("code: " + code + ", params: { "); for (String param : params) { messageBuilder.append("; ").append(param); } messageBuilder.append(" }"); return messageBuilder.toString().replaceFirst("; ", ""); } OpenLmisMessage(String code);  OpenLmisMessage(String code, String... params); @Override String toString(); }
OpenLmisMessage { @Override public String toString() { if (params.length == 0) return code; StringBuilder messageBuilder = new StringBuilder("code: " + code + ", params: { "); for (String param : params) { messageBuilder.append("; ").append(param); } messageBuilder.append(" }"); return messageBuilder.toString().replaceFirst("; ", ""); } OpenLmisMessage(String code);  OpenLmisMessage(String code, String... params); @Override String toString();  }