{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-app-android/pulls/comments/62072937","id":62072937,"diff_hunk":"@@ -0,0 +1,184 @@\n+package org.edx.mobile.discussions;\n+\n+import android.text.SpannableString;\n+import android.text.TextUtils;\n+import android.text.style.ClickableSpan;\n+import android.view.View;\n+import android.widget.TextView;\n+\n+import org.edx.mobile.R;\n+import org.edx.mobile.discussion.DiscussionTextUtils;\n+import org.edx.mobile.discussion.IAuthorData;\n+import org.edx.mobile.test.BaseTestCase;\n+import org.junit.Before;\n+import org.junit.Test;\n+import org.mockito.Mockito;\n+\n+import java.util.Date;\n+\n+import static junit.framework.Assert.assertEquals;\n+import static junit.framework.Assert.assertTrue;\n+\n+public class DiscussionTextUtilsTest extends BaseTestCase {\n+\n+    private TextView dummyTextView;\n+    private Runnable dummyClickListener;\n+    private String endorsePrefix;\n+    private String answerPrefix;\n+    private long now = System.currentTimeMillis();\n+\n+    @Before\n+    public void initValues() {\n+        dummyTextView = new TextView(context);\n+        dummyClickListener = Mockito.mock(Runnable.class);\n+        endorsePrefix = context.getString(R.string.discussion_post_endorsed);\n+        answerPrefix = context.getString(R.string.discussion_post_marked_as_answer);","path":"VideoLocker/src/test/java/org/edx/mobile/discussions/DiscussionTextUtilsTest.java","position":null,"original_position":35,"commit_id":"792a819147a01a33c6cdb163ea0f3563100c7fea","original_commit_id":"f334f80137ed0adc13b78e7d7d5a579413a3be55","user":{"login":"BenjiLee","id":7101723,"avatar_url":"https://avatars.githubusercontent.com/u/7101723?v=3","gravatar_id":"","url":"https://api.github.com/users/BenjiLee","html_url":"https://github.com/BenjiLee","followers_url":"https://api.github.com/users/BenjiLee/followers","following_url":"https://api.github.com/users/BenjiLee/following{/other_user}","gists_url":"https://api.github.com/users/BenjiLee/gists{/gist_id}","starred_url":"https://api.github.com/users/BenjiLee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenjiLee/subscriptions","organizations_url":"https://api.github.com/users/BenjiLee/orgs","repos_url":"https://api.github.com/users/BenjiLee/repos","events_url":"https://api.github.com/users/BenjiLee/events{/privacy}","received_events_url":"https://api.github.com/users/BenjiLee/received_events","type":"User","site_admin":false},"body":"It could go either way depending on what we want to catch. By hard coding it here, we are expecting this test to fail when the string resource changes. ","created_at":"2016-05-04T16:43:48Z","updated_at":"2016-05-04T16:43:48Z","html_url":"https://github.com/edx/edx-app-android/pull/684#discussion_r62072937","pull_request_url":"https://api.github.com/repos/edx/edx-app-android/pulls/684","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/comments/62072937"},"html":{"href":"https://github.com/edx/edx-app-android/pull/684#discussion_r62072937"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/684"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-app-android/pulls/684","id":68396743,"html_url":"https://github.com/edx/edx-app-android/pull/684","diff_url":"https://github.com/edx/edx-app-android/pull/684.diff","patch_url":"https://github.com/edx/edx-app-android/pull/684.patch","issue_url":"https://api.github.com/repos/edx/edx-app-android/issues/684","number":684,"state":"open","locked":false,"title":"Author Attribution in Discussion UIs","user":{"login":"miankhalid","id":1710804,"avatar_url":"https://avatars.githubusercontent.com/u/1710804?v=3","gravatar_id":"","url":"https://api.github.com/users/miankhalid","html_url":"https://github.com/miankhalid","followers_url":"https://api.github.com/users/miankhalid/followers","following_url":"https://api.github.com/users/miankhalid/following{/other_user}","gists_url":"https://api.github.com/users/miankhalid/gists{/gist_id}","starred_url":"https://api.github.com/users/miankhalid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miankhalid/subscriptions","organizations_url":"https://api.github.com/users/miankhalid/orgs","repos_url":"https://api.github.com/users/miankhalid/repos","events_url":"https://api.github.com/users/miankhalid/events{/privacy}","received_events_url":"https://api.github.com/users/miankhalid/received_events","type":"User","site_admin":false},"body":"Fixes [MA-2286](https://openedx.atlassian.net/browse/MA-2286)\r\n\r\nPrevious implementation of `removeDuplicateWhitespace` [done here] (https://github.com/edx/edx-app-android/pull/670/files#diff-f0965130e69dcf6a44193af8da3227b4R189) removed the Span properties from the `CharSequence` due to the usage of `replaceAll` function in the `String` class.\r\n\r\nI've now overhauled the `setAuthorAttributionText` function to construct the final string step-by-step using null checks on each input (matching the iOS implementation).\r\n\r\n@aleffert @1zaman @BenjiLee plz review","created_at":"2016-04-29T16:17:55Z","updated_at":"2016-05-04T16:43:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b425d7edb97d3d2424900daf6add68730e3aa76f","assignee":null,"milestone":{"url":"https://api.github.com/repos/edx/edx-app-android/milestones/2","html_url":"https://github.com/edx/edx-app-android/milestones/Discussions","labels_url":"https://api.github.com/repos/edx/edx-app-android/milestones/2/labels","id":1415822,"number":2,"title":"Discussions","description":null,"creator":{"login":"miankhalid","id":1710804,"avatar_url":"https://avatars.githubusercontent.com/u/1710804?v=3","gravatar_id":"","url":"https://api.github.com/users/miankhalid","html_url":"https://github.com/miankhalid","followers_url":"https://api.github.com/users/miankhalid/followers","following_url":"https://api.github.com/users/miankhalid/following{/other_user}","gists_url":"https://api.github.com/users/miankhalid/gists{/gist_id}","starred_url":"https://api.github.com/users/miankhalid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miankhalid/subscriptions","organizations_url":"https://api.github.com/users/miankhalid/orgs","repos_url":"https://api.github.com/users/miankhalid/repos","events_url":"https://api.github.com/users/miankhalid/events{/privacy}","received_events_url":"https://api.github.com/users/miankhalid/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":29,"state":"open","created_at":"2015-11-17T13:08:46Z","updated_at":"2016-04-29T16:18:01Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/edx/edx-app-android/pulls/684/commits","review_comments_url":"https://api.github.com/repos/edx/edx-app-android/pulls/684/comments","review_comment_url":"https://api.github.com/repos/edx/edx-app-android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/edx-app-android/issues/684/comments","statuses_url":"https://api.github.com/repos/edx/edx-app-android/statuses/792a819147a01a33c6cdb163ea0f3563100c7fea","head":{"label":"edx:khalid/MA-2286-RETURNS","ref":"khalid/MA-2286-RETURNS","sha":"792a819147a01a33c6cdb163ea0f3563100c7fea","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":29251742,"name":"edx-app-android","full_name":"edx/edx-app-android","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-app-android","description":"","fork":false,"url":"https://api.github.com/repos/edx/edx-app-android","forks_url":"https://api.github.com/repos/edx/edx-app-android/forks","keys_url":"https://api.github.com/repos/edx/edx-app-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-app-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-app-android/teams","hooks_url":"https://api.github.com/repos/edx/edx-app-android/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-app-android/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-app-android/events","assignees_url":"https://api.github.com/repos/edx/edx-app-android/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-app-android/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-app-android/tags","blobs_url":"https://api.github.com/repos/edx/edx-app-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-app-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-app-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-app-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-app-android/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-app-android/languages","stargazers_url":"https://api.github.com/repos/edx/edx-app-android/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-app-android/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-app-android/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-app-android/subscription","commits_url":"https://api.github.com/repos/edx/edx-app-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-app-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-app-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-app-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-app-android/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-app-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-app-android/merges","archive_url":"https://api.github.com/repos/edx/edx-app-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-app-android/downloads","issues_url":"https://api.github.com/repos/edx/edx-app-android/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-app-android/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-app-android/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-app-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-app-android/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-app-android/releases{/id}","deployments_url":"https://api.github.com/repos/edx/edx-app-android/deployments","created_at":"2015-01-14T15:49:47Z","updated_at":"2016-04-28T23:47:00Z","pushed_at":"2016-05-04T16:22:17Z","git_url":"git://github.com/edx/edx-app-android.git","ssh_url":"git@github.com:edx/edx-app-android.git","clone_url":"https://github.com/edx/edx-app-android.git","svn_url":"https://github.com/edx/edx-app-android","homepage":null,"size":22656,"stargazers_count":69,"watchers_count":69,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":85,"mirror_url":null,"open_issues_count":9,"forks":85,"open_issues":9,"watchers":69,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"3d5bf80c49a9065f7b2d72080ca5fabed3817a2b","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":29251742,"name":"edx-app-android","full_name":"edx/edx-app-android","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-app-android","description":"","fork":false,"url":"https://api.github.com/repos/edx/edx-app-android","forks_url":"https://api.github.com/repos/edx/edx-app-android/forks","keys_url":"https://api.github.com/repos/edx/edx-app-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-app-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-app-android/teams","hooks_url":"https://api.github.com/repos/edx/edx-app-android/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-app-android/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-app-android/events","assignees_url":"https://api.github.com/repos/edx/edx-app-android/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-app-android/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-app-android/tags","blobs_url":"https://api.github.com/repos/edx/edx-app-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-app-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-app-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-app-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-app-android/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-app-android/languages","stargazers_url":"https://api.github.com/repos/edx/edx-app-android/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-app-android/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-app-android/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-app-android/subscription","commits_url":"https://api.github.com/repos/edx/edx-app-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-app-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-app-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-app-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-app-android/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-app-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-app-android/merges","archive_url":"https://api.github.com/repos/edx/edx-app-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-app-android/downloads","issues_url":"https://api.github.com/repos/edx/edx-app-android/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-app-android/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-app-android/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-app-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-app-android/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-app-android/releases{/id}","deployments_url":"https://api.github.com/repos/edx/edx-app-android/deployments","created_at":"2015-01-14T15:49:47Z","updated_at":"2016-04-28T23:47:00Z","pushed_at":"2016-05-04T16:22:17Z","git_url":"git://github.com/edx/edx-app-android.git","ssh_url":"git@github.com:edx/edx-app-android.git","clone_url":"https://github.com/edx/edx-app-android.git","svn_url":"https://github.com/edx/edx-app-android","homepage":null,"size":22656,"stargazers_count":69,"watchers_count":69,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":85,"mirror_url":null,"open_issues_count":9,"forks":85,"open_issues":9,"watchers":69,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/684"},"html":{"href":"https://github.com/edx/edx-app-android/pull/684"},"issue":{"href":"https://api.github.com/repos/edx/edx-app-android/issues/684"},"comments":{"href":"https://api.github.com/repos/edx/edx-app-android/issues/684/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/684/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/684/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-app-android/statuses/792a819147a01a33c6cdb163ea0f3563100c7fea"}}}}