FileOrDirectoryTaskOutput extends AbstractTaskOutput implements SingleOrMultipleTaskOutput { @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof FileOrDirectoryTaskOutput)) { return false; } FileOrDirectoryTaskOutput output = (FileOrDirectoryTaskOutput) other; return new EqualsBuilder().appendSuper(super.equals(other)).append(file, output.file).isEquals(); } FileOrDirectoryTaskOutput(File file); @Override File getDestination(); @Override void accept(TaskOutputDispatcher writer); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object other); static FileOrDirectoryTaskOutput file(File file); static FileOrDirectoryTaskOutput directory(File directory);  }
@Test public void testEquals() { File diffFile = mock(File.class); when(diffFile.isFile()).thenReturn(Boolean.TRUE); FileOrDirectoryTaskOutput eq1 = new FileOrDirectoryTaskOutput(file); FileOrDirectoryTaskOutput eq2 = new FileOrDirectoryTaskOutput(file); FileOrDirectoryTaskOutput eq3 = new FileOrDirectoryTaskOutput(file); FileOrDirectoryTaskOutput diff = new FileOrDirectoryTaskOutput(diffFile); TestUtils.testEqualsAndHashCodes(eq1, eq2, eq3, diff); }