@Test public void shouldHaveToString() { assertThat(error.toString(), is("ERROR: (1) " + message.text("message") + " Resource=\"" + resource + "\" At \"" + location + "\" (threw " + throwable.getLocalizedMessage() + ")")); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(this.getStatus()).append(": "); if (this.getCode() != DEFAULT_CODE) { sb.append("(").append(this.getCode()).append(") "); } sb.append(this.getMessageString()); if (this.getResource() != null) { sb.append(" Resource=\"").append(this.getResource()).append("\""); } if (this.getLocation() != null) { sb.append(" At \"").append(this.getLocation()).append("\""); } if (this.getThrowable() != null) { sb.append(" (threw ").append(this.getThrowable().getLocalizedMessage()).append(")"); } return sb.toString(); }
Problem { @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(this.getStatus()).append(": "); if (this.getCode() != DEFAULT_CODE) { sb.append("(").append(this.getCode()).append(") "); } sb.append(this.getMessageString()); if (this.getResource() != null) { sb.append(" Resource=\"").append(this.getResource()).append("\""); } if (this.getLocation() != null) { sb.append(" At \"").append(this.getLocation()).append("\""); } if (this.getThrowable() != null) { sb.append(" (threw ").append(this.getThrowable().getLocalizedMessage()).append(")"); } return sb.toString(); } }
Problem { @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(this.getStatus()).append(": "); if (this.getCode() != DEFAULT_CODE) { sb.append("(").append(this.getCode()).append(") "); } sb.append(this.getMessageString()); if (this.getResource() != null) { sb.append(" Resource=\"").append(this.getResource()).append("\""); } if (this.getLocation() != null) { sb.append(" At \"").append(this.getLocation()).append("\""); } if (this.getThrowable() != null) { sb.append(" (threw ").append(this.getThrowable().getLocalizedMessage()).append(")"); } return sb.toString(); } Problem( Status status,
                    int code,
                    I18n message,
                    Object[] params,
                    String resource,
                    String location,
                    Throwable throwable ); }
Problem { @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(this.getStatus()).append(": "); if (this.getCode() != DEFAULT_CODE) { sb.append("(").append(this.getCode()).append(") "); } sb.append(this.getMessageString()); if (this.getResource() != null) { sb.append(" Resource=\"").append(this.getResource()).append("\""); } if (this.getLocation() != null) { sb.append(" At \"").append(this.getLocation()).append("\""); } if (this.getThrowable() != null) { sb.append(" (threw ").append(this.getThrowable().getLocalizedMessage()).append(")"); } return sb.toString(); } Problem( Status status,
                    int code,
                    I18n message,
                    Object[] params,
                    String resource,
                    String location,
                    Throwable throwable ); int getCode(); String getLocation(); String getMessageString(); I18n getMessage(); Object[] getParameters(); String getResource(); Status getStatus(); Throwable getThrowable(); @Override int hashCode(); @Override boolean equals( Object obj ); @Override String toString(); }
Problem { @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(this.getStatus()).append(": "); if (this.getCode() != DEFAULT_CODE) { sb.append("(").append(this.getCode()).append(") "); } sb.append(this.getMessageString()); if (this.getResource() != null) { sb.append(" Resource=\"").append(this.getResource()).append("\""); } if (this.getLocation() != null) { sb.append(" At \"").append(this.getLocation()).append("\""); } if (this.getThrowable() != null) { sb.append(" (threw ").append(this.getThrowable().getLocalizedMessage()).append(")"); } return sb.toString(); } Problem( Status status,
                    int code,
                    I18n message,
                    Object[] params,
                    String resource,
                    String location,
                    Throwable throwable ); int getCode(); String getLocation(); String getMessageString(); I18n getMessage(); Object[] getParameters(); String getResource(); Status getStatus(); Throwable getThrowable(); @Override int hashCode(); @Override boolean equals( Object obj ); @Override String toString(); static final int DEFAULT_CODE; }