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