@Test public void equalsTest() { Dimension dimension1 = new Dimension(1, 2); Dimension dimension2 = new Dimension(1, 2); Dimension dimension3 = new Dimension(1, 1); Dimension dimension4 = new Dimension(2, 2); TestUtils.equalsTest(dimension1, dimension2); TestUtils.notEqualsTest(dimension1, dimension3); TestUtils.notEqualsTest(dimension1, dimension4); TestUtils.notEqualsTest(dimension1, new Object()); TestUtils.notEqualsTest(dimension1, null); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Dimension)) { return false; } Dimension other = (Dimension) obj; if (this.width != other.width) { return false; } else if (this.height != other.height) { return false; } return true; }
Dimension implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Dimension)) { return false; } Dimension other = (Dimension) obj; if (this.width != other.width) { return false; } else if (this.height != other.height) { return false; } return true; } }
Dimension implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Dimension)) { return false; } Dimension other = (Dimension) obj; if (this.width != other.width) { return false; } else if (this.height != other.height) { return false; } return true; } Dimension(int width, int height); }
Dimension implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Dimension)) { return false; } Dimension other = (Dimension) obj; if (this.width != other.width) { return false; } else if (this.height != other.height) { return false; } return true; } Dimension(int width, int height); @Override boolean equals(Object obj); Point getCenter(); @Override int hashCode(); @Override String toString(); }
Dimension implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Dimension)) { return false; } Dimension other = (Dimension) obj; if (this.width != other.width) { return false; } else if (this.height != other.height) { return false; } return true; } Dimension(int width, int height); @Override boolean equals(Object obj); Point getCenter(); @Override int hashCode(); @Override String toString(); final int height; final int width; }