FontCharacteristics { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FontCharacteristics that = (FontCharacteristics) o; return isItalic == that.isItalic && isBold == that.isBold && fontWeight == that.fontWeight; } FontCharacteristics();  FontCharacteristics(FontCharacteristics other); FontCharacteristics setFontWeight(short fw); FontCharacteristics setFontWeight(String fw); FontCharacteristics setBoldFlag(boolean isBold); FontCharacteristics setItalicFlag(boolean isItalic); FontCharacteristics setMonospaceFlag(boolean isMonospace); FontCharacteristics setFontStyle(String fs); boolean isItalic(); boolean isBold(); boolean isMonospace(); short getFontWeight(); boolean isUndefined(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testEquals() { FontCharacteristics fontCharacteristics = new FontCharacteristics(); fontCharacteristics.setFontStyle("italic"); fontCharacteristics.setFontWeight((short) 300); FontCharacteristics sameFontCharacteristics = new FontCharacteristics(); sameFontCharacteristics.setFontStyle("italic"); sameFontCharacteristics.setFontWeight((short) 300); Assert.assertTrue(fontCharacteristics.equals(sameFontCharacteristics)); FontCharacteristics copyFontCharacteristics = new FontCharacteristics(fontCharacteristics); Assert.assertTrue(fontCharacteristics.equals(copyFontCharacteristics)); FontCharacteristics diffFontCharacteristics = new FontCharacteristics(); fontCharacteristics.setBoldFlag(true); fontCharacteristics.setFontWeight((short) 800); Assert.assertFalse(fontCharacteristics.equals(diffFontCharacteristics)); }