Icon implements Serializable { public byte[] getData() { return this.data; } Icon();  Icon(byte[] data, String imageType);  Icon(Image image, String imageType); byte[] getData(); BufferedImage getImage(); String getImageType(); void setImageType(String imageType); void setData(byte[] data, String imageType); final void setImage(Image image, String imageType); void setImage(String imagePath);  }
@Test public void testGetData() { System.out.println("getData"); testSetData(); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(icon.getImage(), "png", baos); byte[] outputImageBytes = baos.toByteArray(); Assert.assertArrayEquals("hi",outputImageBytes,icon.getData()); } catch (IOException ex) { Exceptions.printStackTrace(ex); } }