### Question:
G3Client implements IG3Client { public InputStream getPhotoInputStream(String url) throws G3GalleryException { InputStream content = null; String appendToGalleryUrl = url.substring(url.indexOf(galleryItemUrl)+galleryItemUrl.length()); try { content = requestToResponseEntity(appendToGalleryUrl, null, GET, null).getContent(); } catch (IllegalStateException e) { throw new G3GalleryException(e); } catch (UnsupportedEncodingException e) { throw new G3GalleryException(e); } catch (ClientProtocolException e) { throw new G3GalleryException(e); } catch (IOException e) { throw new G3GalleryException(e); } return content; } G3Client(String galleryUrl, String userAgent); Item getItem(int itemId); int createItem(Entity entity, File file); void updateItem(Entity entity); void deleteItem(int itemId); String getApiKey(); List<Item> getAlbumAndSubAlbumsAndPictures(int albumId); List<Item> getAlbumAndSubAlbums(int albumId); List<Item> getPictures(int albumId); InputStream getPhotoInputStream(String url); void setPassword(String password); void setUsername(String username); void setExistingApiKey(String existingApiKey); String getExistingApiKey(); boolean isUsingRewrittenUrls(); void setUsingRewrittenUrls(boolean isUsingRewrittenUrls);  }### Answer:
@Test public void getPhotoInputStream() throws IOException, G3GalleryException, MagicParseException, MagicMatchNotFoundException, MagicException { try { itemClient.getItem(createdPhotoId); }catch(G3ItemNotFoundException ex){ addPhoto(); } Item item1 = itemClient.getItem(createdPhotoId); String url = item1.getEntity().getFileUrl(); InputStream inputStream = itemClient.getPhotoInputStream(url); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ByteStreams.copy(inputStream, outputStream); byte[] photoDownloadedAsAByteArray = outputStream.toByteArray(); String contentType = Magic.getMagicMatch(photoDownloadedAsAByteArray).getMimeType(); assertEquals("image/png", contentType); }