### Question:
Message implements Serializable { @Override public String toString() { StringBuilder buffer = new StringBuilder(); buffer.append(severity.toString()) .append(' ') .append(code) .append('['); int max = invalidProperties.size(); for (int i = 0; i < max; i++) { if (i > 0) { buffer.append(", "); } buffer.append(invalidProperties.get(i).getObject().toString()) .append('.') .append(invalidProperties.get(i).getProperty()); } buffer.append(']') .append('\n') .append(text); return buffer.toString(); } Message(@CheckForNull String code, String text, Severity severity);   Message(@CheckForNull String code, String text, Severity severity,
            @CheckForNull List<ObjectProperty> invalidObjectProperties, @CheckForNull Set<ValidationMarker> markers); static Message newInfo(String code, String text); static Message newWarning(String code, String text); static Message newError(String code, String text); Severity getSeverity(); String getText(); @CheckForNull String getCode(); List<ObjectProperty> getInvalidObjectProperties(); Set<ValidationMarker> getMarkers(); boolean hasMarker(ValidationMarker marker); boolean hasMarkers(); boolean isMandatoryFieldMessage(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static Builder builder(String text, Severity severity);  }### Answer:
@Test public void testToString() { Message message = new Message("code", "text", Severity.WARNING, Arrays.asList(new ObjectProperty("Object", "property", 1)), Collections.singleton(() -> true)); assertThat(message.toString(), is("WARNING code[Object.property]\ntext")); }