{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/comments/55747310","id":55747310,"diff_hunk":"@@ -321,6 +330,60 @@ public void testUndelete() {\n   }\n \n   @Test\n+  public void testGetPolicy() {\n+    assertNull(RESOURCE_MANAGER.getPolicy(COMPLETE_PROJECT.projectId()));\n+    RESOURCE_MANAGER.create(COMPLETE_PROJECT);\n+    RESOURCE_MANAGER.replacePolicy(COMPLETE_PROJECT.projectId(), POLICY);\n+    Policy retrieved = RESOURCE_MANAGER.getPolicy(COMPLETE_PROJECT.projectId());\n+    assertEquals(POLICY.bindings(), retrieved.bindings());\n+    assertNotNull(retrieved.etag());\n+    assertEquals(0, retrieved.version().intValue());\n+  }\n+\n+  @Test\n+  public void testReplacePolicy() {\n+    try {\n+      RESOURCE_MANAGER.replacePolicy(\"nonexistent-project\", POLICY);\n+      fail(\"Project doesn't exist.\");\n+    } catch (ResourceManagerException e) {\n+      assertEquals(403, e.code());\n+      assertTrue(e.getMessage().endsWith(\"project was not found.\"));\n+    }\n+    RESOURCE_MANAGER.create(PARTIAL_PROJECT);\n+    Policy oldPolicy = RESOURCE_MANAGER.getPolicy(PARTIAL_PROJECT.projectId());\n+    RESOURCE_MANAGER.replacePolicy(PARTIAL_PROJECT.projectId(), POLICY);\n+    try {\n+      RESOURCE_MANAGER.replacePolicy(PARTIAL_PROJECT.projectId(), oldPolicy);\n+      fail(\"Policy with an invalid etag didn't cause error.\");\n+    } catch (ResourceManagerException e) {\n+      assertEquals(409, e.code());\n+      assertTrue(e.getMessage().contains(\"Policy etag mismatch\"));\n+    }\n+    String originalEtag = RESOURCE_MANAGER.getPolicy(PARTIAL_PROJECT.projectId()).etag();\n+    Policy newPolicy = RESOURCE_MANAGER.replacePolicy(PARTIAL_PROJECT.projectId(), POLICY);\n+    assertEquals(POLICY.bindings(), newPolicy.bindings());\n+    assertNotNull(newPolicy.etag());\n+    assertNotEquals(originalEtag, newPolicy.etag());\n+  }\n+\n+  @Test\n+  public void testTestPermissions() {\n+    List<Permission> permissions = ImmutableList.of(Permission.GET);\n+    try {\n+      RESOURCE_MANAGER.testPermissions(\"nonexistent-project\", permissions);\n+    } catch (ResourceManagerException e) {\n+      assertEquals(403, e.code());\n+      assertEquals(\"Project nonexistent-project not found.\", e.getMessage());\n+    }\n+    RESOURCE_MANAGER.create(PARTIAL_PROJECT);\n+    assertEquals(ImmutableList.of(true),\n+        RESOURCE_MANAGER.testPermissions(PARTIAL_PROJECT.projectId(), permissions));\n+    assertEquals(ImmutableList.of(true, true),\n+        RESOURCE_MANAGER.testPermissions(","path":"gcloud-java-resourcemanager/src/test/java/com/google/gcloud/resourcemanager/ResourceManagerImplTest.java","position":92,"original_position":92,"commit_id":"28985fbb8ac06fc75081d4549cbb151046e7bd43","original_commit_id":"28985fbb8ac06fc75081d4549cbb151046e7bd43","user":{"login":"mderka","id":1192586,"avatar_url":"https://avatars.githubusercontent.com/u/1192586?v=3","gravatar_id":"","url":"https://api.github.com/users/mderka","html_url":"https://github.com/mderka","followers_url":"https://api.github.com/users/mderka/followers","following_url":"https://api.github.com/users/mderka/following{/other_user}","gists_url":"https://api.github.com/users/mderka/gists{/gist_id}","starred_url":"https://api.github.com/users/mderka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mderka/subscriptions","organizations_url":"https://api.github.com/users/mderka/orgs","repos_url":"https://api.github.com/users/mderka/repos","events_url":"https://api.github.com/users/mderka/events{/privacy}","received_events_url":"https://api.github.com/users/mderka/received_events","type":"User","site_admin":false},"body":"Is this an ideal wrapping? I would move line 382 to 381 and break this assert over two lines only.","created_at":"2016-03-10T20:51:13Z","updated_at":"2016-03-10T20:51:13Z","html_url":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/718#discussion_r55747310","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/718","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/comments/55747310"},"html":{"href":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/718#discussion_r55747310"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/718"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/718","id":61820949,"html_url":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/718","diff_url":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/718.diff","patch_url":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/718.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/718","number":718,"state":"open","locked":false,"title":"Add get, replace, and test for IAM","user":{"login":"ajkannan","id":5316886,"avatar_url":"https://avatars.githubusercontent.com/u/5316886?v=3","gravatar_id":"","url":"https://api.github.com/users/ajkannan","html_url":"https://github.com/ajkannan","followers_url":"https://api.github.com/users/ajkannan/followers","following_url":"https://api.github.com/users/ajkannan/following{/other_user}","gists_url":"https://api.github.com/users/ajkannan/gists{/gist_id}","starred_url":"https://api.github.com/users/ajkannan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajkannan/subscriptions","organizations_url":"https://api.github.com/users/ajkannan/orgs","repos_url":"https://api.github.com/users/ajkannan/repos","events_url":"https://api.github.com/users/ajkannan/events{/privacy}","received_events_url":"https://api.github.com/users/ajkannan/received_events","type":"User","site_admin":false},"body":"Fixes #439.\r\n\r\nThere are two outstanding issues to resolve regarding IAM:\r\n* The string values corresponding to the permissions for `list` and `create` are correctly formed.  However, when I tested manually, I found that they cause a 400 error citing bad request.  I will ask about this.\r\n* Version seems to be a completely useless field, because people will unset it completely by creating and setting a fresh policy (not using the read-write-modify pattern).  Should we remove version entirely from the `IamPolicy` class in core?","created_at":"2016-03-05T19:11:12Z","updated_at":"2016-03-10T20:51:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f8e45cdc4eefca8c0f404e4e1a5c239eb1df1e0d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/718/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/718/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/718/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/statuses/28985fbb8ac06fc75081d4549cbb151046e7bd43","head":{"label":"ajkannan:get-set-test-iam","ref":"get-set-test-iam","sha":"28985fbb8ac06fc75081d4549cbb151046e7bd43","user":{"login":"ajkannan","id":5316886,"avatar_url":"https://avatars.githubusercontent.com/u/5316886?v=3","gravatar_id":"","url":"https://api.github.com/users/ajkannan","html_url":"https://github.com/ajkannan","followers_url":"https://api.github.com/users/ajkannan/followers","following_url":"https://api.github.com/users/ajkannan/following{/other_user}","gists_url":"https://api.github.com/users/ajkannan/gists{/gist_id}","starred_url":"https://api.github.com/users/ajkannan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajkannan/subscriptions","organizations_url":"https://api.github.com/users/ajkannan/orgs","repos_url":"https://api.github.com/users/ajkannan/repos","events_url":"https://api.github.com/users/ajkannan/events{/privacy}","received_events_url":"https://api.github.com/users/ajkannan/received_events","type":"User","site_admin":false},"repo":{"id":40725411,"name":"gcloud-java","full_name":"ajkannan/gcloud-java","owner":{"login":"ajkannan","id":5316886,"avatar_url":"https://avatars.githubusercontent.com/u/5316886?v=3","gravatar_id":"","url":"https://api.github.com/users/ajkannan","html_url":"https://github.com/ajkannan","followers_url":"https://api.github.com/users/ajkannan/followers","following_url":"https://api.github.com/users/ajkannan/following{/other_user}","gists_url":"https://api.github.com/users/ajkannan/gists{/gist_id}","starred_url":"https://api.github.com/users/ajkannan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajkannan/subscriptions","organizations_url":"https://api.github.com/users/ajkannan/orgs","repos_url":"https://api.github.com/users/ajkannan/repos","events_url":"https://api.github.com/users/ajkannan/events{/privacy}","received_events_url":"https://api.github.com/users/ajkannan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ajkannan/gcloud-java","description":"Google Cloud Client Library for Java","fork":true,"url":"https://api.github.com/repos/ajkannan/gcloud-java","forks_url":"https://api.github.com/repos/ajkannan/gcloud-java/forks","keys_url":"https://api.github.com/repos/ajkannan/gcloud-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ajkannan/gcloud-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ajkannan/gcloud-java/teams","hooks_url":"https://api.github.com/repos/ajkannan/gcloud-java/hooks","issue_events_url":"https://api.github.com/repos/ajkannan/gcloud-java/issues/events{/number}","events_url":"https://api.github.com/repos/ajkannan/gcloud-java/events","assignees_url":"https://api.github.com/repos/ajkannan/gcloud-java/assignees{/user}","branches_url":"https://api.github.com/repos/ajkannan/gcloud-java/branches{/branch}","tags_url":"https://api.github.com/repos/ajkannan/gcloud-java/tags","blobs_url":"https://api.github.com/repos/ajkannan/gcloud-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ajkannan/gcloud-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ajkannan/gcloud-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/ajkannan/gcloud-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ajkannan/gcloud-java/statuses/{sha}","languages_url":"https://api.github.com/repos/ajkannan/gcloud-java/languages","stargazers_url":"https://api.github.com/repos/ajkannan/gcloud-java/stargazers","contributors_url":"https://api.github.com/repos/ajkannan/gcloud-java/contributors","subscribers_url":"https://api.github.com/repos/ajkannan/gcloud-java/subscribers","subscription_url":"https://api.github.com/repos/ajkannan/gcloud-java/subscription","commits_url":"https://api.github.com/repos/ajkannan/gcloud-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/ajkannan/gcloud-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/ajkannan/gcloud-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/ajkannan/gcloud-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/ajkannan/gcloud-java/contents/{+path}","compare_url":"https://api.github.com/repos/ajkannan/gcloud-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ajkannan/gcloud-java/merges","archive_url":"https://api.github.com/repos/ajkannan/gcloud-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ajkannan/gcloud-java/downloads","issues_url":"https://api.github.com/repos/ajkannan/gcloud-java/issues{/number}","pulls_url":"https://api.github.com/repos/ajkannan/gcloud-java/pulls{/number}","milestones_url":"https://api.github.com/repos/ajkannan/gcloud-java/milestones{/number}","notifications_url":"https://api.github.com/repos/ajkannan/gcloud-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ajkannan/gcloud-java/labels{/name}","releases_url":"https://api.github.com/repos/ajkannan/gcloud-java/releases{/id}","deployments_url":"https://api.github.com/repos/ajkannan/gcloud-java/deployments","created_at":"2015-08-14T16:38:38Z","updated_at":"2016-01-28T17:32:12Z","pushed_at":"2016-03-09T23:31:26Z","git_url":"git://github.com/ajkannan/gcloud-java.git","ssh_url":"git@github.com:ajkannan/gcloud-java.git","clone_url":"https://github.com/ajkannan/gcloud-java.git","svn_url":"https://github.com/ajkannan/gcloud-java","homepage":"","size":16997,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"d3224b38a07dbfd776b0818684bc21a5adcfeb64","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":26181278,"name":"gcloud-java","full_name":"GoogleCloudPlatform/gcloud-java","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/gcloud-java","description":"Google Cloud Client Library for Java","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/deployments","created_at":"2014-11-04T17:57:16Z","updated_at":"2016-03-08T18:46:20Z","pushed_at":"2016-03-10T20:44:26Z","git_url":"git://github.com/GoogleCloudPlatform/gcloud-java.git","ssh_url":"git@github.com:GoogleCloudPlatform/gcloud-java.git","clone_url":"https://github.com/GoogleCloudPlatform/gcloud-java.git","svn_url":"https://github.com/GoogleCloudPlatform/gcloud-java","homepage":"http://googlecloudplatform.github.io/gcloud-java/","size":217628,"stargazers_count":72,"watchers_count":72,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":38,"mirror_url":null,"open_issues_count":135,"forks":38,"open_issues":135,"watchers":72,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/718"},"html":{"href":"https://github.com/GoogleCloudPlatform/gcloud-java/pull/718"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/718"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/718/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/718/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/pulls/718/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/statuses/28985fbb8ac06fc75081d4549cbb151046e7bd43"}}}}