@Test public void testEquals() { Font theFont1 = new Font(Font.FontName.ARIAL, 22); Font theFont2 = new Font(Font.FontName.ARIAL, 22); assertTrue(theFont1.equals(theFont1)); assertTrue(theFont1.equals(theFont2)); assertFalse(theFont1.equals(null)); assertFalse(theFont1.equals(22)); assertFalse(theFont1.equals(new Font(Font.FontName.ARIAL, 23))); assertFalse(theFont1.equals(new Font(Font.FontName.VERDANA, 22))); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Font font = (Font) o; if (size != font.size) return false; if (name != font.name) return false; return true; }
Font implements Distributable { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Font font = (Font) o; if (size != font.size) return false; if (name != font.name) return false; return true; } }
Font implements Distributable { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Font font = (Font) o; if (size != font.size) return false; if (name != font.name) return false; return true; } Font(FontName aFontName, int aSize); }
Font implements Distributable { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Font font = (Font) o; if (size != font.size) return false; if (name != font.name) return false; return true; } Font(FontName aFontName, int aSize); @Override boolean equals(Object o); @Override int hashCode(); Font changeSize(int aSize); Font changeName(FontName aName); @Override Map<String, Object> serialize(); static Font deserialize(Map<String, Object> aSerializedData); }
Font implements Distributable { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Font font = (Font) o; if (size != font.size) return false; if (name != font.name) return false; return true; } Font(FontName aFontName, int aSize); @Override boolean equals(Object o); @Override int hashCode(); Font changeSize(int aSize); Font changeName(FontName aName); @Override Map<String, Object> serialize(); static Font deserialize(Map<String, Object> aSerializedData); static final Font DEFAULT_FONT; final FontName name; final int size; }