### Question:
G3Client implements IG3Client { public int createItem(Entity entity, File file) throws G3GalleryException { String resultUrl; NameValuePair nameValuePair; try { if (file == null) { nameValuePair = new BasicNameValuePair("entity", ItemUtils.convertAlbumEntityToJSON(entity)); } else { nameValuePair = new BasicNameValuePair("entity", ItemUtils.convertPhotoEntityToJSON(entity)); } List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(nameValuePair); resultUrl = sendHttpRequest( INDEX_PHP_REST_ITEM + entity.getParent(), nameValuePairs, POST, file); resultUrl = ItemUtils.convertJsonStringToUrl(resultUrl); } catch (JSONException e) { throw new G3GalleryException(e.getMessage()); } return ItemUtils.getItemIdFromUrl(resultUrl); } 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 createAlbum() throws G3GalleryException { Entity albumToCreate = new Entity(); albumToCreate.setName("AlbumName" + System.currentTimeMillis()); albumToCreate.setTitle("New Album"); albumToCreate.setParent(G2ANDROID_SECRET_ALBUM); createdAlbumId = itemClient.createItem(albumToCreate, null); assertNotNull(createdAlbumId); }
@Ignore @Test(expected = G3BadRequestException.class) public void createAlbum__already_exists() throws G3GalleryException { long albumSuffix = System.currentTimeMillis(); Entity albumToCreate = new Entity(); albumToCreate.setName("AlbumName" + albumSuffix); albumToCreate.setTitle("New Album"); albumToCreate.setParent(G2ANDROID_SECRET_ALBUM); itemClient.createItem(albumToCreate, null); itemClient.createItem(albumToCreate, null); }