CompilationMessage implements Serializable { @Override public String toString() { StringBuilder sb = new StringBuilder(text.length() + 20); if (!StringUtils.isEmpty(entityName)) { sb.append("[").append(entityName).append("]"); } sb.append("[").append(row).append(",").append(column).append("]"); sb.append(text); return sb.toString(); } CompilationMessage(String text);  CompilationMessage(String entityName, int row, int column,
            String text); String getEntityName(); int getRow(); int getColumn(); String getText(); @Override String toString();  }
@Test public void testToString() { CompilationMessage message = new CompilationMessage("entity_name", 3, 57, "a message text"); toStringPrint(message); assertEquals("[entity_name][3,57]a message text", message.toString()); message = new CompilationMessage(null, -1, -1, "another text"); toStringPrint(message); assertEquals("[-1,-1]another text", message.toString()); }