{"action":"created","comment":{"url":"https://api.github.com/repos/hi3g/freki/pulls/comments/35207245","id":35207245,"diff_hunk":"@@ -152,4 +155,67 @@ public void createIdPublishesEventOnSuccess() throws Exception {\n     typeContext.createId(\"foo\").get();\n     verify(eventBus).post(any(LabelCreatedEvent.class));\n   }\n+\n+  @Test(expected = IllegalArgumentException.class)\n+  public void testRenameNewNameExists() throws Exception {\n+    typeContext = new LabelClientTypeContext(store, LabelType.METRIC, metrics, eventBus,\n+        MAX_CACHE_SIZE);\n+    // Can not rename to a name that is already taken\n+    typeContext.createId(\"newName\");\n+    typeContext.rename(\"oldName\", \"newName\");\n+  }\n+\n+  @Test\n+  public void testRenameIdNotFoundOnOldName() throws Exception {\n+    typeContext = new LabelClientTypeContext(store, LabelType.METRIC, metrics, eventBus,\n+        MAX_CACHE_SIZE);\n+    //No previous label called \"oldName\" return Failed future\n+    ListenableFuture<Void> response = typeContext.rename(\"oldName\", \"newName\");\n+\n+    Futures.addCallback(response, new FutureCallback<Void>() {\n+      @Override\n+      public void onSuccess(final Void result) {\n+        fail();\n+      }\n+\n+      @Override\n+      public void onFailure(final Throwable throwable) {\n+        // Do nothing nwe should fail.\n+      }\n+    });\n+  }\n+\n+  @Test\n+  public void testRename() throws Exception {\n+    typeContext = new LabelClientTypeContext(store, LabelType.METRIC, metrics, eventBus,\n+        MAX_CACHE_SIZE);\n+\n+    final LabelId labelId = typeContext.createId(\"oldName\").get();\n+    ListenableFuture<Void> response = typeContext.rename(\"oldName\", \"newName\");\n+\n+    Futures.addCallback(response, new FutureCallback<Void>() {","path":"core/src/test/java/se/tre/freki/labels/LabelClientTypeContextTest.java","position":59,"original_position":59,"commit_id":"c9eb566a619058b825924361da6fae5cc44fab91","original_commit_id":"c9eb566a619058b825924361da6fae5cc44fab91","user":{"login":"luuse","id":111528,"avatar_url":"https://avatars.githubusercontent.com/u/111528?v=3","gravatar_id":"","url":"https://api.github.com/users/luuse","html_url":"https://github.com/luuse","followers_url":"https://api.github.com/users/luuse/followers","following_url":"https://api.github.com/users/luuse/following{/other_user}","gists_url":"https://api.github.com/users/luuse/gists{/gist_id}","starred_url":"https://api.github.com/users/luuse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luuse/subscriptions","organizations_url":"https://api.github.com/users/luuse/orgs","repos_url":"https://api.github.com/users/luuse/repos","events_url":"https://api.github.com/users/luuse/events{/privacy}","received_events_url":"https://api.github.com/users/luuse/received_events","type":"User","site_admin":false},"body":"See above about not blocking the calls for futures. In any case it is probably less verbose to just block and work with the result directly. Also, the contract for `Store#renameLabel` is that if one checks that the current name exists and the new name does not exist before a call to it, then if the `#renameLabel` call returns successfully and the future does not contain an exception, then the label should have been renamed. This means it is not strictly necessary to test that the label is renamed here, it's enough to call `#rename` and block on it to make sure it does not contain an exception.","created_at":"2015-07-22T12:35:59Z","updated_at":"2015-07-22T12:35:59Z","html_url":"https://github.com/hi3g/freki/pull/73#discussion_r35207245","pull_request_url":"https://api.github.com/repos/hi3g/freki/pulls/73","_links":{"self":{"href":"https://api.github.com/repos/hi3g/freki/pulls/comments/35207245"},"html":{"href":"https://github.com/hi3g/freki/pull/73#discussion_r35207245"},"pull_request":{"href":"https://api.github.com/repos/hi3g/freki/pulls/73"}}},"pull_request":{"url":"https://api.github.com/repos/hi3g/freki/pulls/73","id":40557917,"html_url":"https://github.com/hi3g/freki/pull/73","diff_url":"https://github.com/hi3g/freki/pull/73.diff","patch_url":"https://github.com/hi3g/freki/pull/73.patch","issue_url":"https://api.github.com/repos/hi3g/freki/issues/73","number":73,"state":"open","locked":false,"title":"Moved tests to where they should be. Redid them to check the current …","user":{"login":"jzeeck","id":1387446,"avatar_url":"https://avatars.githubusercontent.com/u/1387446?v=3","gravatar_id":"","url":"https://api.github.com/users/jzeeck","html_url":"https://github.com/jzeeck","followers_url":"https://api.github.com/users/jzeeck/followers","following_url":"https://api.github.com/users/jzeeck/following{/other_user}","gists_url":"https://api.github.com/users/jzeeck/gists{/gist_id}","starred_url":"https://api.github.com/users/jzeeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzeeck/subscriptions","organizations_url":"https://api.github.com/users/jzeeck/orgs","repos_url":"https://api.github.com/users/jzeeck/repos","events_url":"https://api.github.com/users/jzeeck/events{/privacy}","received_events_url":"https://api.github.com/users/jzeeck/received_events","type":"User","site_admin":false},"body":"…functionallity. Added documentation","created_at":"2015-07-22T12:10:40Z","updated_at":"2015-07-22T12:35:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"64110bcaba0b2d68e0c13dd593b5139d8169c613","assignee":{"login":"luuse","id":111528,"avatar_url":"https://avatars.githubusercontent.com/u/111528?v=3","gravatar_id":"","url":"https://api.github.com/users/luuse","html_url":"https://github.com/luuse","followers_url":"https://api.github.com/users/luuse/followers","following_url":"https://api.github.com/users/luuse/following{/other_user}","gists_url":"https://api.github.com/users/luuse/gists{/gist_id}","starred_url":"https://api.github.com/users/luuse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luuse/subscriptions","organizations_url":"https://api.github.com/users/luuse/orgs","repos_url":"https://api.github.com/users/luuse/repos","events_url":"https://api.github.com/users/luuse/events{/privacy}","received_events_url":"https://api.github.com/users/luuse/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/hi3g/freki/milestones/2","html_url":"https://github.com/hi3g/freki/milestones/0.3","labels_url":"https://api.github.com/repos/hi3g/freki/milestones/2/labels","id":1207635,"number":2,"title":"0.3","description":"","creator":{"login":"luuse","id":111528,"avatar_url":"https://avatars.githubusercontent.com/u/111528?v=3","gravatar_id":"","url":"https://api.github.com/users/luuse","html_url":"https://github.com/luuse","followers_url":"https://api.github.com/users/luuse/followers","following_url":"https://api.github.com/users/luuse/following{/other_user}","gists_url":"https://api.github.com/users/luuse/gists{/gist_id}","starred_url":"https://api.github.com/users/luuse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luuse/subscriptions","organizations_url":"https://api.github.com/users/luuse/orgs","repos_url":"https://api.github.com/users/luuse/repos","events_url":"https://api.github.com/users/luuse/events{/privacy}","received_events_url":"https://api.github.com/users/luuse/received_events","type":"User","site_admin":false},"open_issues":10,"closed_issues":4,"state":"open","created_at":"2015-07-14T18:36:19Z","updated_at":"2015-07-22T12:10:40Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/hi3g/freki/pulls/73/commits","review_comments_url":"https://api.github.com/repos/hi3g/freki/pulls/73/comments","review_comment_url":"https://api.github.com/repos/hi3g/freki/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hi3g/freki/issues/73/comments","statuses_url":"https://api.github.com/repos/hi3g/freki/statuses/c9eb566a619058b825924361da6fae5cc44fab91","head":{"label":"hi3g:rename_fixes","ref":"rename_fixes","sha":"c9eb566a619058b825924361da6fae5cc44fab91","user":{"login":"hi3g","id":8111300,"avatar_url":"https://avatars.githubusercontent.com/u/8111300?v=3","gravatar_id":"","url":"https://api.github.com/users/hi3g","html_url":"https://github.com/hi3g","followers_url":"https://api.github.com/users/hi3g/followers","following_url":"https://api.github.com/users/hi3g/following{/other_user}","gists_url":"https://api.github.com/users/hi3g/gists{/gist_id}","starred_url":"https://api.github.com/users/hi3g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hi3g/subscriptions","organizations_url":"https://api.github.com/users/hi3g/orgs","repos_url":"https://api.github.com/users/hi3g/repos","events_url":"https://api.github.com/users/hi3g/events{/privacy}","received_events_url":"https://api.github.com/users/hi3g/received_events","type":"Organization","site_admin":false},"repo":{"id":39054692,"name":"freki","full_name":"hi3g/freki","owner":{"login":"hi3g","id":8111300,"avatar_url":"https://avatars.githubusercontent.com/u/8111300?v=3","gravatar_id":"","url":"https://api.github.com/users/hi3g","html_url":"https://github.com/hi3g","followers_url":"https://api.github.com/users/hi3g/followers","following_url":"https://api.github.com/users/hi3g/following{/other_user}","gists_url":"https://api.github.com/users/hi3g/gists{/gist_id}","starred_url":"https://api.github.com/users/hi3g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hi3g/subscriptions","organizations_url":"https://api.github.com/users/hi3g/orgs","repos_url":"https://api.github.com/users/hi3g/repos","events_url":"https://api.github.com/users/hi3g/events{/privacy}","received_events_url":"https://api.github.com/users/hi3g/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hi3g/freki","description":"","fork":false,"url":"https://api.github.com/repos/hi3g/freki","forks_url":"https://api.github.com/repos/hi3g/freki/forks","keys_url":"https://api.github.com/repos/hi3g/freki/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hi3g/freki/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hi3g/freki/teams","hooks_url":"https://api.github.com/repos/hi3g/freki/hooks","issue_events_url":"https://api.github.com/repos/hi3g/freki/issues/events{/number}","events_url":"https://api.github.com/repos/hi3g/freki/events","assignees_url":"https://api.github.com/repos/hi3g/freki/assignees{/user}","branches_url":"https://api.github.com/repos/hi3g/freki/branches{/branch}","tags_url":"https://api.github.com/repos/hi3g/freki/tags","blobs_url":"https://api.github.com/repos/hi3g/freki/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hi3g/freki/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hi3g/freki/git/refs{/sha}","trees_url":"https://api.github.com/repos/hi3g/freki/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hi3g/freki/statuses/{sha}","languages_url":"https://api.github.com/repos/hi3g/freki/languages","stargazers_url":"https://api.github.com/repos/hi3g/freki/stargazers","contributors_url":"https://api.github.com/repos/hi3g/freki/contributors","subscribers_url":"https://api.github.com/repos/hi3g/freki/subscribers","subscription_url":"https://api.github.com/repos/hi3g/freki/subscription","commits_url":"https://api.github.com/repos/hi3g/freki/commits{/sha}","git_commits_url":"https://api.github.com/repos/hi3g/freki/git/commits{/sha}","comments_url":"https://api.github.com/repos/hi3g/freki/comments{/number}","issue_comment_url":"https://api.github.com/repos/hi3g/freki/issues/comments{/number}","contents_url":"https://api.github.com/repos/hi3g/freki/contents/{+path}","compare_url":"https://api.github.com/repos/hi3g/freki/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hi3g/freki/merges","archive_url":"https://api.github.com/repos/hi3g/freki/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hi3g/freki/downloads","issues_url":"https://api.github.com/repos/hi3g/freki/issues{/number}","pulls_url":"https://api.github.com/repos/hi3g/freki/pulls{/number}","milestones_url":"https://api.github.com/repos/hi3g/freki/milestones{/number}","notifications_url":"https://api.github.com/repos/hi3g/freki/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hi3g/freki/labels{/name}","releases_url":"https://api.github.com/repos/hi3g/freki/releases{/id}","created_at":"2015-07-14T05:05:40Z","updated_at":"2015-07-14T05:53:47Z","pushed_at":"2015-07-22T12:31:30Z","git_url":"git://github.com/hi3g/freki.git","ssh_url":"git@github.com:hi3g/freki.git","clone_url":"https://github.com/hi3g/freki.git","svn_url":"https://github.com/hi3g/freki","homepage":null,"size":932,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":26,"forks":0,"open_issues":26,"watchers":0,"default_branch":"master"}},"base":{"label":"hi3g:master","ref":"master","sha":"a9d2d8ff3383343ed9d3a3fe095659289f584579","user":{"login":"hi3g","id":8111300,"avatar_url":"https://avatars.githubusercontent.com/u/8111300?v=3","gravatar_id":"","url":"https://api.github.com/users/hi3g","html_url":"https://github.com/hi3g","followers_url":"https://api.github.com/users/hi3g/followers","following_url":"https://api.github.com/users/hi3g/following{/other_user}","gists_url":"https://api.github.com/users/hi3g/gists{/gist_id}","starred_url":"https://api.github.com/users/hi3g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hi3g/subscriptions","organizations_url":"https://api.github.com/users/hi3g/orgs","repos_url":"https://api.github.com/users/hi3g/repos","events_url":"https://api.github.com/users/hi3g/events{/privacy}","received_events_url":"https://api.github.com/users/hi3g/received_events","type":"Organization","site_admin":false},"repo":{"id":39054692,"name":"freki","full_name":"hi3g/freki","owner":{"login":"hi3g","id":8111300,"avatar_url":"https://avatars.githubusercontent.com/u/8111300?v=3","gravatar_id":"","url":"https://api.github.com/users/hi3g","html_url":"https://github.com/hi3g","followers_url":"https://api.github.com/users/hi3g/followers","following_url":"https://api.github.com/users/hi3g/following{/other_user}","gists_url":"https://api.github.com/users/hi3g/gists{/gist_id}","starred_url":"https://api.github.com/users/hi3g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hi3g/subscriptions","organizations_url":"https://api.github.com/users/hi3g/orgs","repos_url":"https://api.github.com/users/hi3g/repos","events_url":"https://api.github.com/users/hi3g/events{/privacy}","received_events_url":"https://api.github.com/users/hi3g/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hi3g/freki","description":"","fork":false,"url":"https://api.github.com/repos/hi3g/freki","forks_url":"https://api.github.com/repos/hi3g/freki/forks","keys_url":"https://api.github.com/repos/hi3g/freki/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hi3g/freki/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hi3g/freki/teams","hooks_url":"https://api.github.com/repos/hi3g/freki/hooks","issue_events_url":"https://api.github.com/repos/hi3g/freki/issues/events{/number}","events_url":"https://api.github.com/repos/hi3g/freki/events","assignees_url":"https://api.github.com/repos/hi3g/freki/assignees{/user}","branches_url":"https://api.github.com/repos/hi3g/freki/branches{/branch}","tags_url":"https://api.github.com/repos/hi3g/freki/tags","blobs_url":"https://api.github.com/repos/hi3g/freki/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hi3g/freki/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hi3g/freki/git/refs{/sha}","trees_url":"https://api.github.com/repos/hi3g/freki/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hi3g/freki/statuses/{sha}","languages_url":"https://api.github.com/repos/hi3g/freki/languages","stargazers_url":"https://api.github.com/repos/hi3g/freki/stargazers","contributors_url":"https://api.github.com/repos/hi3g/freki/contributors","subscribers_url":"https://api.github.com/repos/hi3g/freki/subscribers","subscription_url":"https://api.github.com/repos/hi3g/freki/subscription","commits_url":"https://api.github.com/repos/hi3g/freki/commits{/sha}","git_commits_url":"https://api.github.com/repos/hi3g/freki/git/commits{/sha}","comments_url":"https://api.github.com/repos/hi3g/freki/comments{/number}","issue_comment_url":"https://api.github.com/repos/hi3g/freki/issues/comments{/number}","contents_url":"https://api.github.com/repos/hi3g/freki/contents/{+path}","compare_url":"https://api.github.com/repos/hi3g/freki/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hi3g/freki/merges","archive_url":"https://api.github.com/repos/hi3g/freki/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hi3g/freki/downloads","issues_url":"https://api.github.com/repos/hi3g/freki/issues{/number}","pulls_url":"https://api.github.com/repos/hi3g/freki/pulls{/number}","milestones_url":"https://api.github.com/repos/hi3g/freki/milestones{/number}","notifications_url":"https://api.github.com/repos/hi3g/freki/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hi3g/freki/labels{/name}","releases_url":"https://api.github.com/repos/hi3g/freki/releases{/id}","created_at":"2015-07-14T05:05:40Z","updated_at":"2015-07-14T05:53:47Z","pushed_at":"2015-07-22T12:31:30Z","git_url":"git://github.com/hi3g/freki.git","ssh_url":"git@github.com:hi3g/freki.git","clone_url":"https://github.com/hi3g/freki.git","svn_url":"https://github.com/hi3g/freki","homepage":null,"size":932,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":26,"forks":0,"open_issues":26,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hi3g/freki/pulls/73"},"html":{"href":"https://github.com/hi3g/freki/pull/73"},"issue":{"href":"https://api.github.com/repos/hi3g/freki/issues/73"},"comments":{"href":"https://api.github.com/repos/hi3g/freki/issues/73/comments"},"review_comments":{"href":"https://api.github.com/repos/hi3g/freki/pulls/73/comments"},"review_comment":{"href":"https://api.github.com/repos/hi3g/freki/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hi3g/freki/pulls/73/commits"},"statuses":{"href":"https://api.github.com/repos/hi3g/freki/statuses/c9eb566a619058b825924361da6fae5cc44fab91"}}}}