{"action":"created","comment":{"url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/pulls/comments/106334126","pull_request_review_id":27250329,"id":106334126,"diff_hunk":"@@ -0,0 +1,297 @@\n+// Copyright 2004-present Facebook. All Rights Reserved.\n+\n+#pragma once\n+\n+#include \"reactivestreams/ReactiveStreams.h\"\n+\n+namespace yarpl {\n+namespace flowable {\n+\n+/**\n+ * A utility class for unit testing or experimenting with Flowables.\n+ *\n+ * Example usage:\n+ *\n+ * auto flowable = ...\n+ * auto ts = TestSubscriber<int>::create();\n+ * flowable->subscribe(ts->unique_subscriber());\n+ * ts->awaitTerminalEvent();\n+ * ts->assert...\n+ *\n+ * If you have a Subscriber impl with specific logic you want used,\n+ * you can pass it into the TestSubscriber and the on* events will be\n+ * delegated to your implementation.\n+ *\n+ * For example:\n+ *\n+ * auto ts = TestSubscriber<int>::create(std::make_unique<MySubscriber>());\n+ * flowable->subscribe(ts->unique_subscriber());\n+ *\n+ * Now when 'flowable' is subscribed to, the TestSubscriber behavior\n+ * will be used, but 'MySubscriber' on* methods will also be invoked.\n+ *\n+ * @tparam T\n+ */\n+template <typename T>\n+class TestSubscriber : public reactivestreams_yarpl::Subscriber<T>,\n+                       public std::enable_shared_from_this<TestSubscriber<T>> {\n+  using Subscription = reactivestreams_yarpl::Subscription;\n+  using Subscriber = reactivestreams_yarpl::Subscriber<T>;\n+\n+ public:\n+  /**\n+   * Create a TestSubscriber that will subscribe upwards\n+   * with no flow control (max value) and store all values it receives.\n+   * @return\n+   */\n+  static std::shared_ptr<TestSubscriber<T>> create();\n+\n+  /**\n+   * Create a TestSubscriber that will subscribe upwards\n+   * with the initial requestN value and store all values it receives.\n+   * @param n\n+   * @return\n+   */\n+  static std::shared_ptr<TestSubscriber<T>> create(long initialRequestN);\n+\n+  /**\n+   * Create a TestSubscriber that will delegate all on* method calls\n+   * to the provided Subscriber.\n+   *\n+   * This will store all values it receives to allow assertions.\n+   * @return\n+   */\n+  static std::shared_ptr<TestSubscriber<T>> create(std::unique_ptr<Subscriber>);\n+\n+  TestSubscriber(std::unique_ptr<Subscriber> delegate);\n+  TestSubscriber(long initialRequestN);","path":"experimental/yarpl/include/yarpl/Flowable_TestSubscriber.h","position":69,"original_position":67,"commit_id":"4c79a2dcb1b77b269cf7a6acd4195dc3434aa9e3","original_commit_id":"edb1187a63fb01e194fe43b4e81f78feeb66aa37","user":{"login":"benjchristensen","id":813492,"avatar_url":"https://avatars3.githubusercontent.com/u/813492?v=3","gravatar_id":"","url":"https://api.github.com/users/benjchristensen","html_url":"https://github.com/benjchristensen","followers_url":"https://api.github.com/users/benjchristensen/followers","following_url":"https://api.github.com/users/benjchristensen/following{/other_user}","gists_url":"https://api.github.com/users/benjchristensen/gists{/gist_id}","starred_url":"https://api.github.com/users/benjchristensen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjchristensen/subscriptions","organizations_url":"https://api.github.com/users/benjchristensen/orgs","repos_url":"https://api.github.com/users/benjchristensen/repos","events_url":"https://api.github.com/users/benjchristensen/events{/privacy}","received_events_url":"https://api.github.com/users/benjchristensen/received_events","type":"User","site_admin":false},"body":"Does this have to be done whenever there is a single argument constructor?","created_at":"2017-03-16T03:46:41Z","updated_at":"2017-03-16T03:46:41Z","html_url":"https://github.com/ReactiveSocket/reactivesocket-cpp/pull/323#discussion_r106334126","pull_request_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/pulls/323","_links":{"self":{"href":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/pulls/comments/106334126"},"html":{"href":"https://github.com/ReactiveSocket/reactivesocket-cpp/pull/323#discussion_r106334126"},"pull_request":{"href":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/pulls/323"}}},"pull_request":{"url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/pulls/323","id":110698977,"html_url":"https://github.com/ReactiveSocket/reactivesocket-cpp/pull/323","diff_url":"https://github.com/ReactiveSocket/reactivesocket-cpp/pull/323.diff","patch_url":"https://github.com/ReactiveSocket/reactivesocket-cpp/pull/323.patch","issue_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/issues/323","number":323,"state":"open","locked":false,"title":"Yarpl (for review only)","user":{"login":"benjchristensen","id":813492,"avatar_url":"https://avatars3.githubusercontent.com/u/813492?v=3","gravatar_id":"","url":"https://api.github.com/users/benjchristensen","html_url":"https://github.com/benjchristensen","followers_url":"https://api.github.com/users/benjchristensen/followers","following_url":"https://api.github.com/users/benjchristensen/following{/other_user}","gists_url":"https://api.github.com/users/benjchristensen/gists{/gist_id}","starred_url":"https://api.github.com/users/benjchristensen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjchristensen/subscriptions","organizations_url":"https://api.github.com/users/benjchristensen/orgs","repos_url":"https://api.github.com/users/benjchristensen/repos","events_url":"https://api.github.com/users/benjchristensen/events{/privacy}","received_events_url":"https://api.github.com/users/benjchristensen/received_events","type":"User","site_admin":false},"body":"Do not merge. Just want to share and get feedback. ","created_at":"2017-03-14T19:25:24Z","updated_at":"2017-03-16T03:46:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0dc917bc3f062b13906758f9608d80d76a765ba7","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/pulls/323/commits","review_comments_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/pulls/323/comments","review_comment_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/issues/323/comments","statuses_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/statuses/4c79a2dcb1b77b269cf7a6acd4195dc3434aa9e3","head":{"label":"benjchristensen:yarpl-vjn","ref":"yarpl-vjn","sha":"4c79a2dcb1b77b269cf7a6acd4195dc3434aa9e3","user":{"login":"benjchristensen","id":813492,"avatar_url":"https://avatars3.githubusercontent.com/u/813492?v=3","gravatar_id":"","url":"https://api.github.com/users/benjchristensen","html_url":"https://github.com/benjchristensen","followers_url":"https://api.github.com/users/benjchristensen/followers","following_url":"https://api.github.com/users/benjchristensen/following{/other_user}","gists_url":"https://api.github.com/users/benjchristensen/gists{/gist_id}","starred_url":"https://api.github.com/users/benjchristensen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjchristensen/subscriptions","organizations_url":"https://api.github.com/users/benjchristensen/orgs","repos_url":"https://api.github.com/users/benjchristensen/repos","events_url":"https://api.github.com/users/benjchristensen/events{/privacy}","received_events_url":"https://api.github.com/users/benjchristensen/received_events","type":"User","site_admin":false},"repo":{"id":58233163,"name":"reactivesocket-cpp","full_name":"benjchristensen/reactivesocket-cpp","owner":{"login":"benjchristensen","id":813492,"avatar_url":"https://avatars3.githubusercontent.com/u/813492?v=3","gravatar_id":"","url":"https://api.github.com/users/benjchristensen","html_url":"https://github.com/benjchristensen","followers_url":"https://api.github.com/users/benjchristensen/followers","following_url":"https://api.github.com/users/benjchristensen/following{/other_user}","gists_url":"https://api.github.com/users/benjchristensen/gists{/gist_id}","starred_url":"https://api.github.com/users/benjchristensen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjchristensen/subscriptions","organizations_url":"https://api.github.com/users/benjchristensen/orgs","repos_url":"https://api.github.com/users/benjchristensen/repos","events_url":"https://api.github.com/users/benjchristensen/events{/privacy}","received_events_url":"https://api.github.com/users/benjchristensen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/benjchristensen/reactivesocket-cpp","description":"C++ implementation of ReactiveSocket","fork":true,"url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp","forks_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/forks","keys_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/teams","hooks_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/hooks","issue_events_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/issues/events{/number}","events_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/events","assignees_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/assignees{/user}","branches_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/branches{/branch}","tags_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/tags","blobs_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/git/refs{/sha}","trees_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/statuses/{sha}","languages_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/languages","stargazers_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/stargazers","contributors_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/contributors","subscribers_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/subscribers","subscription_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/subscription","commits_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/commits{/sha}","git_commits_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/git/commits{/sha}","comments_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/comments{/number}","issue_comment_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/issues/comments{/number}","contents_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/contents/{+path}","compare_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/merges","archive_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/downloads","issues_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/issues{/number}","pulls_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/pulls{/number}","milestones_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/milestones{/number}","notifications_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/labels{/name}","releases_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/releases{/id}","deployments_url":"https://api.github.com/repos/benjchristensen/reactivesocket-cpp/deployments","created_at":"2016-05-06T20:29:04Z","updated_at":"2016-05-06T20:29:05Z","pushed_at":"2017-03-16T03:30:18Z","git_url":"git://github.com/benjchristensen/reactivesocket-cpp.git","ssh_url":"git@github.com:benjchristensen/reactivesocket-cpp.git","clone_url":"https://github.com/benjchristensen/reactivesocket-cpp.git","svn_url":"https://github.com/benjchristensen/reactivesocket-cpp","homepage":null,"size":2686,"stargazers_count":0,"watchers_count":0,"language":"C++","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":"ReactiveSocket:master","ref":"master","sha":"48461a59959a865a32b658aa828c880572ada234","user":{"login":"ReactiveSocket","id":13168916,"avatar_url":"https://avatars2.githubusercontent.com/u/13168916?v=3","gravatar_id":"","url":"https://api.github.com/users/ReactiveSocket","html_url":"https://github.com/ReactiveSocket","followers_url":"https://api.github.com/users/ReactiveSocket/followers","following_url":"https://api.github.com/users/ReactiveSocket/following{/other_user}","gists_url":"https://api.github.com/users/ReactiveSocket/gists{/gist_id}","starred_url":"https://api.github.com/users/ReactiveSocket/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReactiveSocket/subscriptions","organizations_url":"https://api.github.com/users/ReactiveSocket/orgs","repos_url":"https://api.github.com/users/ReactiveSocket/repos","events_url":"https://api.github.com/users/ReactiveSocket/events{/privacy}","received_events_url":"https://api.github.com/users/ReactiveSocket/received_events","type":"Organization","site_admin":false},"repo":{"id":53889141,"name":"reactivesocket-cpp","full_name":"ReactiveSocket/reactivesocket-cpp","owner":{"login":"ReactiveSocket","id":13168916,"avatar_url":"https://avatars2.githubusercontent.com/u/13168916?v=3","gravatar_id":"","url":"https://api.github.com/users/ReactiveSocket","html_url":"https://github.com/ReactiveSocket","followers_url":"https://api.github.com/users/ReactiveSocket/followers","following_url":"https://api.github.com/users/ReactiveSocket/following{/other_user}","gists_url":"https://api.github.com/users/ReactiveSocket/gists{/gist_id}","starred_url":"https://api.github.com/users/ReactiveSocket/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReactiveSocket/subscriptions","organizations_url":"https://api.github.com/users/ReactiveSocket/orgs","repos_url":"https://api.github.com/users/ReactiveSocket/repos","events_url":"https://api.github.com/users/ReactiveSocket/events{/privacy}","received_events_url":"https://api.github.com/users/ReactiveSocket/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ReactiveSocket/reactivesocket-cpp","description":"C++ implementation of ReactiveSocket","fork":false,"url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp","forks_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/forks","keys_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/teams","hooks_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/hooks","issue_events_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/issues/events{/number}","events_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/events","assignees_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/assignees{/user}","branches_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/branches{/branch}","tags_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/tags","blobs_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/git/refs{/sha}","trees_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/statuses/{sha}","languages_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/languages","stargazers_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/stargazers","contributors_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/contributors","subscribers_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/subscribers","subscription_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/subscription","commits_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/commits{/sha}","git_commits_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/git/commits{/sha}","comments_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/comments{/number}","issue_comment_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/issues/comments{/number}","contents_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/contents/{+path}","compare_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/merges","archive_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/downloads","issues_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/issues{/number}","pulls_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/pulls{/number}","milestones_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/milestones{/number}","notifications_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/labels{/name}","releases_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/releases{/id}","deployments_url":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/deployments","created_at":"2016-03-14T20:20:55Z","updated_at":"2017-03-04T04:03:36Z","pushed_at":"2017-03-16T03:30:19Z","git_url":"git://github.com/ReactiveSocket/reactivesocket-cpp.git","ssh_url":"git@github.com:ReactiveSocket/reactivesocket-cpp.git","clone_url":"https://github.com/ReactiveSocket/reactivesocket-cpp.git","svn_url":"https://github.com/ReactiveSocket/reactivesocket-cpp","homepage":null,"size":2666,"stargazers_count":26,"watchers_count":26,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":20,"forks":22,"open_issues":20,"watchers":26,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/pulls/323"},"html":{"href":"https://github.com/ReactiveSocket/reactivesocket-cpp/pull/323"},"issue":{"href":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/issues/323"},"comments":{"href":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/issues/323/comments"},"review_comments":{"href":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/pulls/323/comments"},"review_comment":{"href":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/pulls/323/commits"},"statuses":{"href":"https://api.github.com/repos/ReactiveSocket/reactivesocket-cpp/statuses/4c79a2dcb1b77b269cf7a6acd4195dc3434aa9e3"}}}}
{"actor":{"display_login":"benjchristensen"}}