@Test public void equalsTest() { Job job1 = new Job(new Tile(0, 1, (byte) 2), 1, false); Job job2 = new Job(new Tile(0, 1, (byte) 2), 1, false); Job job3 = new Job(new Tile(0, 0, (byte) 0), 1, 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; if (this.tileSize != other.tileSize) { return false; } if (this.hasAlpha != other.hasAlpha) { return false; } return 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; if (this.tileSize != other.tileSize) { return false; } if (this.hasAlpha != other.hasAlpha) { return false; } return 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; if (this.tileSize != other.tileSize) { return false; } if (this.hasAlpha != other.hasAlpha) { return false; } return this.tile.equals(other.tile); } protected  Job(Tile tile, int tileSize, 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; if (this.tileSize != other.tileSize) { return false; } if (this.hasAlpha != other.hasAlpha) { return false; } return this.tile.equals(other.tile); } protected  Job(Tile tile, int tileSize, boolean hasAlpha); @Override boolean equals(Object obj); @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; if (this.tileSize != other.tileSize) { return false; } if (this.hasAlpha != other.hasAlpha) { return false; } return this.tile.equals(other.tile); } protected  Job(Tile tile, int tileSize, boolean hasAlpha); @Override boolean equals(Object obj); @Override int hashCode(); final boolean hasAlpha; final Tile tile; final int tileSize; }