FileMetaData implements Serializable { @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof FileMetaData)) { return false; } FileMetaData otherFmd = (FileMetaData) other; return toString().equals(otherFmd.toString()); } FileMetaData(TemplatePack pack, Template template, String fileRelativePath, File file); @Override boolean equals(Object other); long getSize(); long getLastMod(); String getFileRelativePath(); boolean isBootstrapFile(); @Override int hashCode(); @Override final String toString();  }
@Test public void equalsTest() throws IOException { File f1 = new File("target/test/my-file-1"); File parent = f1.getParentFile(); if (parent != null) { parent.mkdirs(); } (new IOUtil()).stringToFile("some content", f1); FileMetaData fmd1 = new FileMetaData(null, null, "target/test/my-file-1", f1); File f2 = new File("target/test/my-file-1"); FileMetaData fmd2 = new FileMetaData(null, null, "target/test/my-file-1", f2); assertThat(fmd1).isEqualTo(fmd2); File f3 = new File("target/test/my-file-1"); (new IOUtil()).stringToFile("some content...", f3); assertThat(fmd2).isNotEqualTo(new FileMetaData(null, null, "target/test/my-file-1", f3)); }