@Test public void testSerialize() throws Exception { Font theDefaultFont = Font.DEFAULT_FONT; Map<String, Object> theData = theDefaultFont.serialize(); assertEquals(2, theData.size()); assertEquals("ARIAL", theData.get("name")); assertEquals("10", theData.get("size")); }
@Override public Map<String, Object> serialize() { Map<String, Object> theResult = new HashMap<>(); theResult.put("name", name.name()); theResult.put("size", Integer.toString(size)); return theResult; }
Font implements Distributable { @Override public Map<String, Object> serialize() { Map<String, Object> theResult = new HashMap<>(); theResult.put("name", name.name()); theResult.put("size", Integer.toString(size)); return theResult; } }
Font implements Distributable { @Override public Map<String, Object> serialize() { Map<String, Object> theResult = new HashMap<>(); theResult.put("name", name.name()); theResult.put("size", Integer.toString(size)); return theResult; } Font(FontName aFontName, int aSize); }
Font implements Distributable { @Override public Map<String, Object> serialize() { Map<String, Object> theResult = new HashMap<>(); theResult.put("name", name.name()); theResult.put("size", Integer.toString(size)); return theResult; } 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 Map<String, Object> serialize() { Map<String, Object> theResult = new HashMap<>(); theResult.put("name", name.name()); theResult.put("size", Integer.toString(size)); return theResult; } 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; }