@Test public void equalsTest() { Job job1 = new Job(new Tile(0, 1, (byte) 2, TILE_SIZE), false); Job job2 = new Job(new Tile(0, 1, (byte) 2, TILE_SIZE), false); Job job3 = new Job(new Tile(0, 0, (byte) 0, TILE_SIZE), false); TestUtils.equalsTest(job1, job2); Assert.assertNotEquals(job1, job3); Assert.assertNotEquals(job3, job1); Assert.assertNotEquals(job1, new Object()); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Job)) { return false; } Job other = (Job) obj; return this.hasAlpha == other.hasAlpha && this.tile.equals(other.tile); }
Job { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Job)) { return false; } Job other = (Job) obj; return this.hasAlpha == other.hasAlpha && this.tile.equals(other.tile); } }
Job { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Job)) { return false; } Job other = (Job) obj; return this.hasAlpha == other.hasAlpha && this.tile.equals(other.tile); } Job(Tile tile, boolean hasAlpha); }
Job { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Job)) { return false; } Job other = (Job) obj; return this.hasAlpha == other.hasAlpha && this.tile.equals(other.tile); } Job(Tile tile, boolean hasAlpha); static String composeKey(String z, String x, String y); @Override boolean equals(Object obj); String getKey(); @Override int hashCode(); }
Job { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Job)) { return false; } Job other = (Job) obj; return this.hasAlpha == other.hasAlpha && this.tile.equals(other.tile); } Job(Tile tile, boolean hasAlpha); static String composeKey(String z, String x, String y); @Override boolean equals(Object obj); String getKey(); @Override int hashCode(); final boolean hasAlpha; final Tile tile; }