DirectoryTaskOutput extends AbstractTaskOutput implements MultipleTaskOutput { @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof DirectoryTaskOutput)) { return false; } DirectoryTaskOutput output = (DirectoryTaskOutput) other; return new EqualsBuilder().appendSuper(super.equals(other)) .append(directory, output.getDestination()).isEquals(); } DirectoryTaskOutput(File directory); @Override File getDestination(); @Override void accept(TaskOutputDispatcher writer); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object other);  }
@Test public void testEquals() throws IOException { File directory = folder.newFolder(); File diffDirectory = folder.newFolder(); DirectoryTaskOutput eq1 = new DirectoryTaskOutput(directory); DirectoryTaskOutput eq2 = new DirectoryTaskOutput(directory); DirectoryTaskOutput eq3 = new DirectoryTaskOutput(directory); DirectoryTaskOutput diff = new DirectoryTaskOutput(diffDirectory); TestUtils.testEqualsAndHashCodes(eq1, eq2, eq3, diff); }