{"action":"created","comment":{"url":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/comments/53144072","id":53144072,"diff_hunk":"@@ -0,0 +1,90 @@\n+/*\n+ * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *       http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.guvnor.m2repo.client;\n+\n+import javax.enterprise.event.Event;\n+\n+import com.google.gwt.event.dom.client.ClickEvent;\n+import com.google.gwt.event.dom.client.ClickHandler;\n+import com.google.gwtmockito.GwtMock;\n+import com.google.gwtmockito.GwtMockitoTestRunner;\n+import org.guvnor.m2repo.client.event.M2RepoRefreshEvent;\n+import org.guvnor.m2repo.client.upload.UploadFormPresenter;\n+import org.gwtbootstrap3.client.ui.Button;\n+import org.junit.Before;\n+import org.junit.Test;\n+import org.junit.runner.RunWith;\n+import org.mockito.InjectMocks;\n+import org.mockito.Mock;\n+import org.mockito.Spy;\n+import org.mockito.invocation.InvocationOnMock;\n+import org.mockito.stubbing.Answer;\n+import org.uberfire.mocks.EventSourceMock;\n+import org.uberfire.workbench.model.menu.MenuCustom;\n+import org.uberfire.workbench.model.menu.MenuItemCommand;\n+\n+import static org.mockito.Mockito.*;\n+\n+@RunWith(GwtMockitoTestRunner.class)\n+public class M2RepoEditorPresenterTest {\n+\n+    @Mock\n+    UploadFormPresenter uploadFormPresenter;\n+\n+    @Spy\n+    Event<M2RepoRefreshEvent> refreshEvents = new EventSourceMock<M2RepoRefreshEvent>();\n+\n+    @GwtMock\n+    Button menuRefreshButton;\n+\n+    ClickHandler clickHandler;\n+\n+    @InjectMocks\n+    M2RepoEditorPresenter presenter;\n+\n+    @Before\n+    public void setup() {\n+        doNothing().when(refreshEvents).fire(any(M2RepoRefreshEvent.class));\n+    }\n+\n+    @Test\n+    public void testUpload() {\n+        final MenuItemCommand upload = (MenuItemCommand) presenter.getMenus().getItems().get(0);\n+        upload.getCommand().execute();\n+\n+        verify(uploadFormPresenter).showView();\n+    }\n+\n+    @Test\n+    public void testRefresh() {\n+        when(menuRefreshButton.addClickHandler(any(ClickHandler.class))).thenAnswer(new Answer() {\n+            public Object answer(InvocationOnMock aInvocation) throws Throwable {\n+                clickHandler = (ClickHandler) aInvocation.getArguments()[0];\n+                return null;\n+            }\n+        });\n+\n+        final MenuCustom refresh = (MenuCustom) presenter.getMenus().getItems().get(1);\n+        refresh.build();\n+\n+        clickHandler.onClick(new ClickEvent() {\n+        });\n+\n+        verify(refreshEvents).fire(any(M2RepoRefreshEvent.class));","path":"guvnor-m2repo-editor/guvnor-m2repo-editor-client/src/test/java/org/guvnor/m2repo/client/M2RepoEditorPresenterTest.java","position":87,"original_position":87,"commit_id":"67dc03fb9f5bf900b5498e809755844472017eb0","original_commit_id":"67dc03fb9f5bf900b5498e809755844472017eb0","user":{"login":"manstis","id":497544,"avatar_url":"https://avatars.githubusercontent.com/u/497544?v=3","gravatar_id":"","url":"https://api.github.com/users/manstis","html_url":"https://github.com/manstis","followers_url":"https://api.github.com/users/manstis/followers","following_url":"https://api.github.com/users/manstis/following{/other_user}","gists_url":"https://api.github.com/users/manstis/gists{/gist_id}","starred_url":"https://api.github.com/users/manstis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manstis/subscriptions","organizations_url":"https://api.github.com/users/manstis/orgs","repos_url":"https://api.github.com/users/manstis/repos","events_url":"https://api.github.com/users/manstis/events{/privacy}","received_events_url":"https://api.github.com/users/manstis/received_events","type":"User","site_admin":false},"body":"Out of interest.. what do I do wrong?!?!\r\n\r\nWhenever I use ```EventSourceMock``` I get ```UnsupportedOperationException``` errors (due to the ```fire()``` implementation) and normally have to override it to not throw the exception. I see you don't override and you also expect ```fire()``` to be have been called... so either I'm doing something wrong (and happy to be corrected) or this test fails?","created_at":"2016-02-17T10:15:45Z","updated_at":"2016-02-17T10:15:45Z","html_url":"https://github.com/droolsjbpm/guvnor/pull/250#discussion_r53144072","pull_request_url":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/250","_links":{"self":{"href":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/comments/53144072"},"html":{"href":"https://github.com/droolsjbpm/guvnor/pull/250#discussion_r53144072"},"pull_request":{"href":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/250"}}},"pull_request":{"url":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/250","id":59597908,"html_url":"https://github.com/droolsjbpm/guvnor/pull/250","diff_url":"https://github.com/droolsjbpm/guvnor/pull/250.diff","patch_url":"https://github.com/droolsjbpm/guvnor/pull/250.patch","issue_url":"https://api.github.com/repos/droolsjbpm/guvnor/issues/250","number":250,"state":"open","locked":false,"title":"BZ1078112 - Move upload and refresh buttons into toolbar","user":{"login":"cristianonicolai","id":570894,"avatar_url":"https://avatars.githubusercontent.com/u/570894?v=3","gravatar_id":"","url":"https://api.github.com/users/cristianonicolai","html_url":"https://github.com/cristianonicolai","followers_url":"https://api.github.com/users/cristianonicolai/followers","following_url":"https://api.github.com/users/cristianonicolai/following{/other_user}","gists_url":"https://api.github.com/users/cristianonicolai/gists{/gist_id}","starred_url":"https://api.github.com/users/cristianonicolai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cristianonicolai/subscriptions","organizations_url":"https://api.github.com/users/cristianonicolai/orgs","repos_url":"https://api.github.com/users/cristianonicolai/repos","events_url":"https://api.github.com/users/cristianonicolai/events{/privacy}","received_events_url":"https://api.github.com/users/cristianonicolai/received_events","type":"User","site_admin":false},"body":"Depends on https://github.com/uberfire/uberfire-extensions/pull/211","created_at":"2016-02-17T05:23:32Z","updated_at":"2016-02-17T10:15:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5ed54ee407a15e33d73bf102c4c3d9961f193fae","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/250/commits","review_comments_url":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/250/comments","review_comment_url":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/droolsjbpm/guvnor/issues/250/comments","statuses_url":"https://api.github.com/repos/droolsjbpm/guvnor/statuses/67dc03fb9f5bf900b5498e809755844472017eb0","head":{"label":"cristianonicolai:menubuilder-6.4.x","ref":"menubuilder-6.4.x","sha":"67dc03fb9f5bf900b5498e809755844472017eb0","user":{"login":"cristianonicolai","id":570894,"avatar_url":"https://avatars.githubusercontent.com/u/570894?v=3","gravatar_id":"","url":"https://api.github.com/users/cristianonicolai","html_url":"https://github.com/cristianonicolai","followers_url":"https://api.github.com/users/cristianonicolai/followers","following_url":"https://api.github.com/users/cristianonicolai/following{/other_user}","gists_url":"https://api.github.com/users/cristianonicolai/gists{/gist_id}","starred_url":"https://api.github.com/users/cristianonicolai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cristianonicolai/subscriptions","organizations_url":"https://api.github.com/users/cristianonicolai/orgs","repos_url":"https://api.github.com/users/cristianonicolai/repos","events_url":"https://api.github.com/users/cristianonicolai/events{/privacy}","received_events_url":"https://api.github.com/users/cristianonicolai/received_events","type":"User","site_admin":false},"repo":{"id":5117245,"name":"guvnor","full_name":"cristianonicolai/guvnor","owner":{"login":"cristianonicolai","id":570894,"avatar_url":"https://avatars.githubusercontent.com/u/570894?v=3","gravatar_id":"","url":"https://api.github.com/users/cristianonicolai","html_url":"https://github.com/cristianonicolai","followers_url":"https://api.github.com/users/cristianonicolai/followers","following_url":"https://api.github.com/users/cristianonicolai/following{/other_user}","gists_url":"https://api.github.com/users/cristianonicolai/gists{/gist_id}","starred_url":"https://api.github.com/users/cristianonicolai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cristianonicolai/subscriptions","organizations_url":"https://api.github.com/users/cristianonicolai/orgs","repos_url":"https://api.github.com/users/cristianonicolai/repos","events_url":"https://api.github.com/users/cristianonicolai/events{/privacy}","received_events_url":"https://api.github.com/users/cristianonicolai/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cristianonicolai/guvnor","description":"Guvnor is the web application and repository to govern Drools and jBPM assets.","fork":true,"url":"https://api.github.com/repos/cristianonicolai/guvnor","forks_url":"https://api.github.com/repos/cristianonicolai/guvnor/forks","keys_url":"https://api.github.com/repos/cristianonicolai/guvnor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cristianonicolai/guvnor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cristianonicolai/guvnor/teams","hooks_url":"https://api.github.com/repos/cristianonicolai/guvnor/hooks","issue_events_url":"https://api.github.com/repos/cristianonicolai/guvnor/issues/events{/number}","events_url":"https://api.github.com/repos/cristianonicolai/guvnor/events","assignees_url":"https://api.github.com/repos/cristianonicolai/guvnor/assignees{/user}","branches_url":"https://api.github.com/repos/cristianonicolai/guvnor/branches{/branch}","tags_url":"https://api.github.com/repos/cristianonicolai/guvnor/tags","blobs_url":"https://api.github.com/repos/cristianonicolai/guvnor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cristianonicolai/guvnor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cristianonicolai/guvnor/git/refs{/sha}","trees_url":"https://api.github.com/repos/cristianonicolai/guvnor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cristianonicolai/guvnor/statuses/{sha}","languages_url":"https://api.github.com/repos/cristianonicolai/guvnor/languages","stargazers_url":"https://api.github.com/repos/cristianonicolai/guvnor/stargazers","contributors_url":"https://api.github.com/repos/cristianonicolai/guvnor/contributors","subscribers_url":"https://api.github.com/repos/cristianonicolai/guvnor/subscribers","subscription_url":"https://api.github.com/repos/cristianonicolai/guvnor/subscription","commits_url":"https://api.github.com/repos/cristianonicolai/guvnor/commits{/sha}","git_commits_url":"https://api.github.com/repos/cristianonicolai/guvnor/git/commits{/sha}","comments_url":"https://api.github.com/repos/cristianonicolai/guvnor/comments{/number}","issue_comment_url":"https://api.github.com/repos/cristianonicolai/guvnor/issues/comments{/number}","contents_url":"https://api.github.com/repos/cristianonicolai/guvnor/contents/{+path}","compare_url":"https://api.github.com/repos/cristianonicolai/guvnor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cristianonicolai/guvnor/merges","archive_url":"https://api.github.com/repos/cristianonicolai/guvnor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cristianonicolai/guvnor/downloads","issues_url":"https://api.github.com/repos/cristianonicolai/guvnor/issues{/number}","pulls_url":"https://api.github.com/repos/cristianonicolai/guvnor/pulls{/number}","milestones_url":"https://api.github.com/repos/cristianonicolai/guvnor/milestones{/number}","notifications_url":"https://api.github.com/repos/cristianonicolai/guvnor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cristianonicolai/guvnor/labels{/name}","releases_url":"https://api.github.com/repos/cristianonicolai/guvnor/releases{/id}","deployments_url":"https://api.github.com/repos/cristianonicolai/guvnor/deployments","created_at":"2012-07-19T23:54:44Z","updated_at":"2013-05-20T13:16:37Z","pushed_at":"2016-02-17T07:00:40Z","git_url":"git://github.com/cristianonicolai/guvnor.git","ssh_url":"git@github.com:cristianonicolai/guvnor.git","clone_url":"https://github.com/cristianonicolai/guvnor.git","svn_url":"https://github.com/cristianonicolai/guvnor","homepage":"http://www.jboss.org/drools/drools-guvnor","size":166161,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"droolsjbpm:6.4.x","ref":"6.4.x","sha":"e78d02fb1dcd761125a41bacc97416a71ca22a62","user":{"login":"droolsjbpm","id":517980,"avatar_url":"https://avatars.githubusercontent.com/u/517980?v=3","gravatar_id":"","url":"https://api.github.com/users/droolsjbpm","html_url":"https://github.com/droolsjbpm","followers_url":"https://api.github.com/users/droolsjbpm/followers","following_url":"https://api.github.com/users/droolsjbpm/following{/other_user}","gists_url":"https://api.github.com/users/droolsjbpm/gists{/gist_id}","starred_url":"https://api.github.com/users/droolsjbpm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/droolsjbpm/subscriptions","organizations_url":"https://api.github.com/users/droolsjbpm/orgs","repos_url":"https://api.github.com/users/droolsjbpm/repos","events_url":"https://api.github.com/users/droolsjbpm/events{/privacy}","received_events_url":"https://api.github.com/users/droolsjbpm/received_events","type":"Organization","site_admin":false},"repo":{"id":1354561,"name":"guvnor","full_name":"droolsjbpm/guvnor","owner":{"login":"droolsjbpm","id":517980,"avatar_url":"https://avatars.githubusercontent.com/u/517980?v=3","gravatar_id":"","url":"https://api.github.com/users/droolsjbpm","html_url":"https://github.com/droolsjbpm","followers_url":"https://api.github.com/users/droolsjbpm/followers","following_url":"https://api.github.com/users/droolsjbpm/following{/other_user}","gists_url":"https://api.github.com/users/droolsjbpm/gists{/gist_id}","starred_url":"https://api.github.com/users/droolsjbpm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/droolsjbpm/subscriptions","organizations_url":"https://api.github.com/users/droolsjbpm/orgs","repos_url":"https://api.github.com/users/droolsjbpm/repos","events_url":"https://api.github.com/users/droolsjbpm/events{/privacy}","received_events_url":"https://api.github.com/users/droolsjbpm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/droolsjbpm/guvnor","description":"Guvnor is the governance framework for KIE workbenches","fork":false,"url":"https://api.github.com/repos/droolsjbpm/guvnor","forks_url":"https://api.github.com/repos/droolsjbpm/guvnor/forks","keys_url":"https://api.github.com/repos/droolsjbpm/guvnor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/droolsjbpm/guvnor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/droolsjbpm/guvnor/teams","hooks_url":"https://api.github.com/repos/droolsjbpm/guvnor/hooks","issue_events_url":"https://api.github.com/repos/droolsjbpm/guvnor/issues/events{/number}","events_url":"https://api.github.com/repos/droolsjbpm/guvnor/events","assignees_url":"https://api.github.com/repos/droolsjbpm/guvnor/assignees{/user}","branches_url":"https://api.github.com/repos/droolsjbpm/guvnor/branches{/branch}","tags_url":"https://api.github.com/repos/droolsjbpm/guvnor/tags","blobs_url":"https://api.github.com/repos/droolsjbpm/guvnor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/droolsjbpm/guvnor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/droolsjbpm/guvnor/git/refs{/sha}","trees_url":"https://api.github.com/repos/droolsjbpm/guvnor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/droolsjbpm/guvnor/statuses/{sha}","languages_url":"https://api.github.com/repos/droolsjbpm/guvnor/languages","stargazers_url":"https://api.github.com/repos/droolsjbpm/guvnor/stargazers","contributors_url":"https://api.github.com/repos/droolsjbpm/guvnor/contributors","subscribers_url":"https://api.github.com/repos/droolsjbpm/guvnor/subscribers","subscription_url":"https://api.github.com/repos/droolsjbpm/guvnor/subscription","commits_url":"https://api.github.com/repos/droolsjbpm/guvnor/commits{/sha}","git_commits_url":"https://api.github.com/repos/droolsjbpm/guvnor/git/commits{/sha}","comments_url":"https://api.github.com/repos/droolsjbpm/guvnor/comments{/number}","issue_comment_url":"https://api.github.com/repos/droolsjbpm/guvnor/issues/comments{/number}","contents_url":"https://api.github.com/repos/droolsjbpm/guvnor/contents/{+path}","compare_url":"https://api.github.com/repos/droolsjbpm/guvnor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/droolsjbpm/guvnor/merges","archive_url":"https://api.github.com/repos/droolsjbpm/guvnor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/droolsjbpm/guvnor/downloads","issues_url":"https://api.github.com/repos/droolsjbpm/guvnor/issues{/number}","pulls_url":"https://api.github.com/repos/droolsjbpm/guvnor/pulls{/number}","milestones_url":"https://api.github.com/repos/droolsjbpm/guvnor/milestones{/number}","notifications_url":"https://api.github.com/repos/droolsjbpm/guvnor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/droolsjbpm/guvnor/labels{/name}","releases_url":"https://api.github.com/repos/droolsjbpm/guvnor/releases{/id}","deployments_url":"https://api.github.com/repos/droolsjbpm/guvnor/deployments","created_at":"2011-02-11T10:35:34Z","updated_at":"2015-12-28T07:35:51Z","pushed_at":"2016-02-17T07:01:55Z","git_url":"git://github.com/droolsjbpm/guvnor.git","ssh_url":"git@github.com:droolsjbpm/guvnor.git","clone_url":"https://github.com/droolsjbpm/guvnor.git","svn_url":"https://github.com/droolsjbpm/guvnor","homepage":"http://www.jboss.org/drools/drools-guvnor","size":488023,"stargazers_count":148,"watchers_count":148,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":318,"mirror_url":null,"open_issues_count":2,"forks":318,"open_issues":2,"watchers":148,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/250"},"html":{"href":"https://github.com/droolsjbpm/guvnor/pull/250"},"issue":{"href":"https://api.github.com/repos/droolsjbpm/guvnor/issues/250"},"comments":{"href":"https://api.github.com/repos/droolsjbpm/guvnor/issues/250/comments"},"review_comments":{"href":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/250/comments"},"review_comment":{"href":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/droolsjbpm/guvnor/pulls/250/commits"},"statuses":{"href":"https://api.github.com/repos/droolsjbpm/guvnor/statuses/67dc03fb9f5bf900b5498e809755844472017eb0"}}}}