### Question:
AWTUtilities { public static String encode(Font font) { String style; if (font.isBold()) { style = font.isItalic() ? "bolditalic" : "bold"; } else { style = font.isItalic() ? "italic" : "plain"; } return String.join("-", font.getName(), style, String.valueOf(font.getSize())); } private  AWTUtilities(); static int getMaxX(Rectangle rect); static int getMaxY(Rectangle rect); static int getTextXLocation(String text, int anchorX, int pad, int position, Graphics g); static double getTextWidth(String text, Graphics g); static String encode(Font font); static int getFontSize(String encodedFont);  }### Answer:
@Test public void testEncode() { Font font = new Font("Arial", Font.BOLD + Font.ITALIC, 14); Assert.assertEquals(font, Font.decode(AWTUtilities.encode(font))); }