ChangeScript implements Comparable { @Override public String toString() { return "#" + id + ": " + description; } ChangeScript(long id);  ChangeScript(long id, String description);  ChangeScript(long id, File file, String encoding); File getFile(); long getId(); String getDescription(); int compareTo(Object o); @Override String toString(); String getContent(); String getUndoContent();  }
@Test public void toStringReturnsASensibleValue() throws Exception { File file = new File("abc.txt"); ChangeScript changeScript = new ChangeScript(5, file, "UTF-8"); assertThat(changeScript.toString(), equalTo("#5: abc.txt")); changeScript = new ChangeScript(5, "abc.txt"); assertThat(changeScript.toString(), equalTo("#5: abc.txt")); }