Dimension { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Dimension other = (Dimension) obj; if (depth != other.depth) return false; if (height != other.height) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; if (volume != other.volume) return false; if (width != other.width) return false; return true; } Dimension(String name);  Dimension();  Dimension(String name, int w, int d, int h);  Dimension(int w, int d, int h); static Dimension decode(String size); static String encode(Dimension dto); static String encode(int width, int depth, int height); static Dimension newInstance(int width, int depth, int height); int getWidth(); int getHeight(); int getDepth(); boolean canHold3D(Dimension dimension); boolean canHold3D(int w, int d, int h); boolean canHold2D(Dimension dimension); boolean canHold2D(int w, int d, int h); int getFootprint(); boolean isSquare2D(); boolean isSquare3D(); boolean fitsInside3D(Dimension dimension); boolean fitsInside3D(int w, int d, int h); boolean canFitInside3D(Dimension dimension); boolean canFitInside2D(Dimension dimension); long getVolume(); boolean nonEmpty(); @Override String toString(); String encode(); String getName(); @Override int hashCode(); @Override boolean equals(Object obj); void setDepth(int depth); void setHeight(int height); void setWidth(int width); static final Dimension EMPTY; }
@Test void testEquals() { assertEquals(new Dimension(1, 1, 1), new Dimension(1, 1, 1)); }