### Question:
DownloadJob extends Job { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!super.equals(obj)) { return false; } else if (!(obj instanceof DownloadJob)) { return false; } DownloadJob other = (DownloadJob) obj; if (!this.tileSource.equals(other.tileSource)) { return false; } return true; } DownloadJob(Tile tile, int tileSize, TileSource tileSource); @Override boolean equals(Object obj); @Override int hashCode(); final TileSource tileSource; }### Answer:
@Test public void equalsTest() { Tile tile = new Tile(0, 0, (byte) 0); DownloadJob downloadJob1 = new DownloadJob(tile, tileSize, OpenStreetMapMapnik.INSTANCE); DownloadJob downloadJob2 = new DownloadJob(tile, tileSize, OpenStreetMapMapnik.INSTANCE); DownloadJob downloadJob3 = new DownloadJob(tile, tileSize, OpenCycleMap.INSTANCE); TestUtils.equalsTest(downloadJob1, downloadJob2); Assert.assertNotEquals(downloadJob1, downloadJob3); Assert.assertNotEquals(downloadJob3, downloadJob1); Assert.assertNotEquals(downloadJob1, new Object()); File mapFile = new File("map.file"); XmlRenderTheme xmlRenderTheme = InternalRenderTheme.OSMARENDER; Assert.assertNotEquals(downloadJob1, new RendererJob(tile, mapFile, xmlRenderTheme, new DisplayModel(), 1, false)); }