{"action":"created","comment":{"url":"https://api.github.com/repos/apache/incubator-beam/pulls/comments/61946429","id":61946429,"diff_hunk":"@@ -378,4 +383,251 @@ public State answer(InvocationOnMock invocation) {\n     // instead of inside the try-catch block.\n     fail(\"AssertionError expected\");\n   }\n+\n+  @Test\n+  public void testBatchCreateMatcher() throws Exception {\n+    Pipeline p = TestPipeline.create(options);\n+    PCollection<Integer> pc = p.apply(Create.of(1, 2, 3));\n+    PAssert.that(pc).containsInAnyOrder(1, 2, 3);\n+    final DataflowPipelineJob mockJob = Mockito.mock(DataflowPipelineJob.class);\n+    when(mockJob.getDataflowClient()).thenReturn(service);\n+    when(mockJob.getState()).thenReturn(State.DONE);\n+    when(mockJob.getProjectId()).thenReturn(\"test-project\");\n+    when(mockJob.getJobId()).thenReturn(\"test-job\");\n+\n+    DataflowPipelineRunner mockRunner = Mockito.mock(DataflowPipelineRunner.class);\n+    when(mockRunner.run(any(Pipeline.class))).thenReturn(mockJob);\n+\n+    TestDataflowPipelineRunner runner = (TestDataflowPipelineRunner) p.getRunner();\n+    p.getOptions().as(TestPipelineOptions.class)\n+        .setOnCreateMatcher(new BaseMatcher<PipelineResult>() {\n+          @Override\n+          public boolean matches(Object o) {\n+            try {\n+              verify(mockJob, never()).waitToFinish(any(Long.class), any(TimeUnit.class),\n+                  any(JobMessagesHandler.class));\n+            } catch (Exception e) {\n+              return false;\n+            }\n+            return (PipelineResult) o == (PipelineResult) mockJob;\n+          }\n+\n+          @Override\n+          public void describeTo(Description description) {\n+          }\n+        });\n+\n+    when(request.execute()).thenReturn(\n+        generateMockMetricResponse(true /* success */, true /* tentative */));\n+    runner.run(p, mockRunner);\n+  }\n+\n+  @Test\n+  public void testStreamingCreateMatcher() throws Exception {\n+    options.setStreaming(true);\n+    Pipeline p = TestPipeline.create(options);\n+    PCollection<Integer> pc = p.apply(Create.of(1, 2, 3));\n+    PAssert.that(pc).containsInAnyOrder(1, 2, 3);\n+\n+    final DataflowPipelineJob mockJob = Mockito.mock(DataflowPipelineJob.class);\n+    when(mockJob.getDataflowClient()).thenReturn(service);\n+    when(mockJob.getState()).thenReturn(State.DONE);\n+    when(mockJob.getProjectId()).thenReturn(\"test-project\");\n+    when(mockJob.getJobId()).thenReturn(\"test-job\");\n+\n+    DataflowPipelineRunner mockRunner = Mockito.mock(DataflowPipelineRunner.class);\n+    when(mockRunner.run(any(Pipeline.class))).thenReturn(mockJob);\n+\n+    TestDataflowPipelineRunner runner = (TestDataflowPipelineRunner) p.getRunner();\n+    p.getOptions().as(TestPipelineOptions.class)\n+        .setOnCreateMatcher(new BaseMatcher<PipelineResult>() {\n+          @Override\n+          public boolean matches(Object o) {\n+            // Assert that job.WaitToFinish has not yet been called\n+            try {\n+              verify(mockJob, never()).waitToFinish(any(Long.class), any(TimeUnit.class),\n+                  any(JobMessagesHandler.class));\n+            } catch (Exception e) {\n+              return false;\n+            }\n+            return (PipelineResult) o == (PipelineResult) mockJob;\n+          }\n+\n+          @Override\n+          public void describeTo(Description description) {\n+          }\n+        });\n+    when(mockJob.waitToFinish(any(Long.class), any(TimeUnit.class), any(JobMessagesHandler.class)))\n+        .thenReturn(State.DONE);\n+\n+    when(request.execute()).thenReturn(\n+        generateMockMetricResponse(true /* success */, true /* tentative */));\n+    runner.run(p, mockRunner);\n+  }\n+\n+  @Test\n+  public void testBatchSuccessMatcherPipelineSuccess() throws Exception {\n+    Pipeline p = TestPipeline.create(options);\n+    PCollection<Integer> pc = p.apply(Create.of(1, 2, 3));\n+    PAssert.that(pc).containsInAnyOrder(1, 2, 3);\n+\n+    final DataflowPipelineJob mockJob = Mockito.mock(DataflowPipelineJob.class);\n+    when(mockJob.getDataflowClient()).thenReturn(service);\n+    when(mockJob.getState()).thenReturn(State.DONE);\n+    when(mockJob.getProjectId()).thenReturn(\"test-project\");\n+    when(mockJob.getJobId()).thenReturn(\"test-job\");\n+\n+    DataflowPipelineRunner mockRunner = Mockito.mock(DataflowPipelineRunner.class);\n+    when(mockRunner.run(any(Pipeline.class))).thenReturn(mockJob);\n+\n+    TestDataflowPipelineRunner runner = (TestDataflowPipelineRunner) p.getRunner();\n+    p.getOptions().as(TestPipelineOptions.class)\n+        .setOnSuccessMatcher(new BaseMatcher<PipelineResult>() {\n+          @Override\n+          public boolean matches(Object o) {\n+            // Assert that job.WaitToFinish has not yet been called\n+            try {\n+              verify(mockJob, Mockito.times(1)).waitToFinish(any(Long.class), any(TimeUnit.class),\n+                  any(JobMessagesHandler.class));\n+            } catch (Exception e) {\n+              return false;\n+            }\n+            return (PipelineResult) o == (PipelineResult) mockJob;","path":"runners/google-cloud-dataflow-java/src/test/java/org/apache/beam/runners/dataflow/testing/TestDataflowPipelineRunnerTest.java","position":60,"original_position":143,"commit_id":"36fb782c6486b62cc998730d00b902cd19d30433","original_commit_id":"36fb782c6486b62cc998730d00b902cd19d30433","user":{"login":"lukecwik","id":10078956,"avatar_url":"https://avatars.githubusercontent.com/u/10078956?v=3","gravatar_id":"","url":"https://api.github.com/users/lukecwik","html_url":"https://github.com/lukecwik","followers_url":"https://api.github.com/users/lukecwik/followers","following_url":"https://api.github.com/users/lukecwik/following{/other_user}","gists_url":"https://api.github.com/users/lukecwik/gists{/gist_id}","starred_url":"https://api.github.com/users/lukecwik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukecwik/subscriptions","organizations_url":"https://api.github.com/users/lukecwik/orgs","repos_url":"https://api.github.com/users/lukecwik/repos","events_url":"https://api.github.com/users/lukecwik/events{/privacy}","received_events_url":"https://api.github.com/users/lukecwik/received_events","type":"User","site_admin":false},"body":"Set the test expectations different from the functional expectations of the code\r\n\r\nassertSame(mockJob, o);\r\nreturn true;","created_at":"2016-05-03T20:05:53Z","updated_at":"2016-05-03T20:05:53Z","html_url":"https://github.com/apache/incubator-beam/pull/273#discussion_r61946429","pull_request_url":"https://api.github.com/repos/apache/incubator-beam/pulls/273","_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-beam/pulls/comments/61946429"},"html":{"href":"https://github.com/apache/incubator-beam/pull/273#discussion_r61946429"},"pull_request":{"href":"https://api.github.com/repos/apache/incubator-beam/pulls/273"}}},"pull_request":{"url":"https://api.github.com/repos/apache/incubator-beam/pulls/273","id":68649154,"html_url":"https://github.com/apache/incubator-beam/pull/273","diff_url":"https://github.com/apache/incubator-beam/pull/273.diff","patch_url":"https://github.com/apache/incubator-beam/pull/273.patch","issue_url":"https://api.github.com/repos/apache/incubator-beam/issues/273","number":273,"state":"open","locked":false,"title":"[BEAM-] Add verifiers to Beam","user":{"login":"jasonkuster","id":2396054,"avatar_url":"https://avatars.githubusercontent.com/u/2396054?v=3","gravatar_id":"","url":"https://api.github.com/users/jasonkuster","html_url":"https://github.com/jasonkuster","followers_url":"https://api.github.com/users/jasonkuster/followers","following_url":"https://api.github.com/users/jasonkuster/following{/other_user}","gists_url":"https://api.github.com/users/jasonkuster/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonkuster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonkuster/subscriptions","organizations_url":"https://api.github.com/users/jasonkuster/orgs","repos_url":"https://api.github.com/users/jasonkuster/repos","events_url":"https://api.github.com/users/jasonkuster/events{/privacy}","received_events_url":"https://api.github.com/users/jasonkuster/received_events","type":"User","site_admin":false},"body":"Be sure to do all of the following to help us incorporate your contribution\r\nquickly and easily:\r\n\r\n - [x] Make sure the PR title is formatted like:\r\n   `[BEAM-<Jira issue #>] Description of pull request`\r\n - [x] Make sure tests pass via `mvn clean verify`. (Even better, enable\r\n       Travis-CI on your fork and ensure the whole test matrix passes).\r\n - [ ] Replace `<Jira issue #>` in the title with the actual Jira issue\r\n       number, if there is one.\r\n - [ ] If this contribution is large, please file an Apache\r\n       [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.txt).\r\n\r\n---\r\n","created_at":"2016-05-03T02:03:52Z","updated_at":"2016-05-03T20:05:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5e887bb68522c4e587f43e67e714b712c845bf88","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/incubator-beam/pulls/273/commits","review_comments_url":"https://api.github.com/repos/apache/incubator-beam/pulls/273/comments","review_comment_url":"https://api.github.com/repos/apache/incubator-beam/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/incubator-beam/issues/273/comments","statuses_url":"https://api.github.com/repos/apache/incubator-beam/statuses/36fb782c6486b62cc998730d00b902cd19d30433","head":{"label":"jasonkuster:pipelinerunner","ref":"pipelinerunner","sha":"36fb782c6486b62cc998730d00b902cd19d30433","user":{"login":"jasonkuster","id":2396054,"avatar_url":"https://avatars.githubusercontent.com/u/2396054?v=3","gravatar_id":"","url":"https://api.github.com/users/jasonkuster","html_url":"https://github.com/jasonkuster","followers_url":"https://api.github.com/users/jasonkuster/followers","following_url":"https://api.github.com/users/jasonkuster/following{/other_user}","gists_url":"https://api.github.com/users/jasonkuster/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonkuster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonkuster/subscriptions","organizations_url":"https://api.github.com/users/jasonkuster/orgs","repos_url":"https://api.github.com/users/jasonkuster/repos","events_url":"https://api.github.com/users/jasonkuster/events{/privacy}","received_events_url":"https://api.github.com/users/jasonkuster/received_events","type":"User","site_admin":false},"repo":{"id":56794555,"name":"incubator-beam","full_name":"jasonkuster/incubator-beam","owner":{"login":"jasonkuster","id":2396054,"avatar_url":"https://avatars.githubusercontent.com/u/2396054?v=3","gravatar_id":"","url":"https://api.github.com/users/jasonkuster","html_url":"https://github.com/jasonkuster","followers_url":"https://api.github.com/users/jasonkuster/followers","following_url":"https://api.github.com/users/jasonkuster/following{/other_user}","gists_url":"https://api.github.com/users/jasonkuster/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonkuster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonkuster/subscriptions","organizations_url":"https://api.github.com/users/jasonkuster/orgs","repos_url":"https://api.github.com/users/jasonkuster/repos","events_url":"https://api.github.com/users/jasonkuster/events{/privacy}","received_events_url":"https://api.github.com/users/jasonkuster/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jasonkuster/incubator-beam","description":"Mirror of Apache Beam (Incubating)","fork":true,"url":"https://api.github.com/repos/jasonkuster/incubator-beam","forks_url":"https://api.github.com/repos/jasonkuster/incubator-beam/forks","keys_url":"https://api.github.com/repos/jasonkuster/incubator-beam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jasonkuster/incubator-beam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jasonkuster/incubator-beam/teams","hooks_url":"https://api.github.com/repos/jasonkuster/incubator-beam/hooks","issue_events_url":"https://api.github.com/repos/jasonkuster/incubator-beam/issues/events{/number}","events_url":"https://api.github.com/repos/jasonkuster/incubator-beam/events","assignees_url":"https://api.github.com/repos/jasonkuster/incubator-beam/assignees{/user}","branches_url":"https://api.github.com/repos/jasonkuster/incubator-beam/branches{/branch}","tags_url":"https://api.github.com/repos/jasonkuster/incubator-beam/tags","blobs_url":"https://api.github.com/repos/jasonkuster/incubator-beam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jasonkuster/incubator-beam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jasonkuster/incubator-beam/git/refs{/sha}","trees_url":"https://api.github.com/repos/jasonkuster/incubator-beam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jasonkuster/incubator-beam/statuses/{sha}","languages_url":"https://api.github.com/repos/jasonkuster/incubator-beam/languages","stargazers_url":"https://api.github.com/repos/jasonkuster/incubator-beam/stargazers","contributors_url":"https://api.github.com/repos/jasonkuster/incubator-beam/contributors","subscribers_url":"https://api.github.com/repos/jasonkuster/incubator-beam/subscribers","subscription_url":"https://api.github.com/repos/jasonkuster/incubator-beam/subscription","commits_url":"https://api.github.com/repos/jasonkuster/incubator-beam/commits{/sha}","git_commits_url":"https://api.github.com/repos/jasonkuster/incubator-beam/git/commits{/sha}","comments_url":"https://api.github.com/repos/jasonkuster/incubator-beam/comments{/number}","issue_comment_url":"https://api.github.com/repos/jasonkuster/incubator-beam/issues/comments{/number}","contents_url":"https://api.github.com/repos/jasonkuster/incubator-beam/contents/{+path}","compare_url":"https://api.github.com/repos/jasonkuster/incubator-beam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jasonkuster/incubator-beam/merges","archive_url":"https://api.github.com/repos/jasonkuster/incubator-beam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jasonkuster/incubator-beam/downloads","issues_url":"https://api.github.com/repos/jasonkuster/incubator-beam/issues{/number}","pulls_url":"https://api.github.com/repos/jasonkuster/incubator-beam/pulls{/number}","milestones_url":"https://api.github.com/repos/jasonkuster/incubator-beam/milestones{/number}","notifications_url":"https://api.github.com/repos/jasonkuster/incubator-beam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jasonkuster/incubator-beam/labels{/name}","releases_url":"https://api.github.com/repos/jasonkuster/incubator-beam/releases{/id}","deployments_url":"https://api.github.com/repos/jasonkuster/incubator-beam/deployments","created_at":"2016-04-21T17:52:55Z","updated_at":"2016-04-21T17:52:59Z","pushed_at":"2016-05-03T18:07:16Z","git_url":"git://github.com/jasonkuster/incubator-beam.git","ssh_url":"git@github.com:jasonkuster/incubator-beam.git","clone_url":"https://github.com/jasonkuster/incubator-beam.git","svn_url":"https://github.com/jasonkuster/incubator-beam","homepage":null,"size":13454,"stargazers_count":0,"watchers_count":0,"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":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"69ec223e589147a8decde5c3a10568f5b0c1b5a1","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":50904245,"name":"incubator-beam","full_name":"apache/incubator-beam","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/incubator-beam","description":"Mirror of Apache Beam (Incubating)","fork":false,"url":"https://api.github.com/repos/apache/incubator-beam","forks_url":"https://api.github.com/repos/apache/incubator-beam/forks","keys_url":"https://api.github.com/repos/apache/incubator-beam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/incubator-beam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/incubator-beam/teams","hooks_url":"https://api.github.com/repos/apache/incubator-beam/hooks","issue_events_url":"https://api.github.com/repos/apache/incubator-beam/issues/events{/number}","events_url":"https://api.github.com/repos/apache/incubator-beam/events","assignees_url":"https://api.github.com/repos/apache/incubator-beam/assignees{/user}","branches_url":"https://api.github.com/repos/apache/incubator-beam/branches{/branch}","tags_url":"https://api.github.com/repos/apache/incubator-beam/tags","blobs_url":"https://api.github.com/repos/apache/incubator-beam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/incubator-beam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/incubator-beam/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/incubator-beam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/incubator-beam/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/incubator-beam/languages","stargazers_url":"https://api.github.com/repos/apache/incubator-beam/stargazers","contributors_url":"https://api.github.com/repos/apache/incubator-beam/contributors","subscribers_url":"https://api.github.com/repos/apache/incubator-beam/subscribers","subscription_url":"https://api.github.com/repos/apache/incubator-beam/subscription","commits_url":"https://api.github.com/repos/apache/incubator-beam/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/incubator-beam/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/incubator-beam/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/incubator-beam/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/incubator-beam/contents/{+path}","compare_url":"https://api.github.com/repos/apache/incubator-beam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/incubator-beam/merges","archive_url":"https://api.github.com/repos/apache/incubator-beam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/incubator-beam/downloads","issues_url":"https://api.github.com/repos/apache/incubator-beam/issues{/number}","pulls_url":"https://api.github.com/repos/apache/incubator-beam/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/incubator-beam/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/incubator-beam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/incubator-beam/labels{/name}","releases_url":"https://api.github.com/repos/apache/incubator-beam/releases{/id}","deployments_url":"https://api.github.com/repos/apache/incubator-beam/deployments","created_at":"2016-02-02T08:00:06Z","updated_at":"2016-05-03T09:30:43Z","pushed_at":"2016-05-03T19:05:09Z","git_url":"git://github.com/apache/incubator-beam.git","ssh_url":"git@github.com:apache/incubator-beam.git","clone_url":"https://github.com/apache/incubator-beam.git","svn_url":"https://github.com/apache/incubator-beam","homepage":null,"size":15912,"stargazers_count":152,"watchers_count":152,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":76,"mirror_url":"git://git.apache.org/incubator-beam.git","open_issues_count":20,"forks":76,"open_issues":20,"watchers":152,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-beam/pulls/273"},"html":{"href":"https://github.com/apache/incubator-beam/pull/273"},"issue":{"href":"https://api.github.com/repos/apache/incubator-beam/issues/273"},"comments":{"href":"https://api.github.com/repos/apache/incubator-beam/issues/273/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/incubator-beam/pulls/273/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/incubator-beam/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/incubator-beam/pulls/273/commits"},"statuses":{"href":"https://api.github.com/repos/apache/incubator-beam/statuses/36fb782c6486b62cc998730d00b902cd19d30433"}}}}