StoreImage implements ICachable<StoreImage> { public BufferedImage getImage() { BufferedImage image = null; ByteArrayInputStream stream = new ByteArrayInputStream(Base64.getDecoder().decode(data)); try { image = ImageIO.read(stream); } catch (IOException ioException) { log.warn("An IOException occured while trying to read image from stream.", ioException); } return image; } StoreImage(final long id, BufferedImage image, ImageSize size);  StoreImage(final long id, byte[] base64, ImageSize size);  StoreImage(StoreImage image); long getId(); BufferedImage getImage(); ImageSize getSize(); @Override long getByteSize(); String getBase64(); byte[] getByteArray(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); static final String STORE_IMAGE_FORMAT; static final String STORE_IMAGE_DATA_STRING; }
@Test public void testGetImage() { StoreImage uut = new StoreImage(IMG_ID1, IMG_DATA.getBytes(), ImageSizePreset.ICON.getSize()); BufferedImage bi = uut.getImage(); if (bi == null) fail(); assertEquals(bi.getWidth(), img.getWidth()); assertEquals(bi.getHeight(), img.getHeight()); }