{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/wsm_android/pulls/comments/134937230","pull_request_review_id":58287682,"id":134937230,"diff_hunk":"@@ -0,0 +1,141 @@\n+package com.framgia.wsm.screen.changepassword;\n+\n+import android.content.Context;\n+import com.framgia.wsm.data.model.User;\n+import com.framgia.wsm.data.source.UserRepository;\n+import com.framgia.wsm.utils.rx.ImmediateSchedulerProvider;\n+import com.framgia.wsm.utils.validator.Validator;\n+import io.reactivex.Observable;\n+import org.junit.After;\n+import org.junit.Assert;\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.Mockito;\n+import org.mockito.junit.MockitoJUnitRunner;\n+\n+import static org.mockito.Mockito.verify;\n+import static org.mockito.Mockito.when;\n+\n+/**\n+ * Created by nguyenhuy95dn on 8/23/2017.\n+ */\n+@RunWith(MockitoJUnitRunner.Silent.class)\n+public class ChangePasswordPresenterTest {\n+\n+    @InjectMocks\n+    ChangePasswordPresenter mPresenter;\n+\n+    @Mock\n+    ChangePasswordViewModel mViewModel;\n+\n+    @Mock\n+    UserRepository mUserRepository;\n+\n+    @Mock\n+    Validator mValidator;\n+\n+    @Mock\n+    Context mMockContext;\n+\n+    @InjectMocks\n+    ImmediateSchedulerProvider mBaseSchedulerProvider;\n+\n+    @Before\n+    public void setUp() throws Exception {\n+        mPresenter.setViewModel(mViewModel);\n+        mPresenter.setBaseSchedulerProvider(mBaseSchedulerProvider);\n+    }\n+\n+    @After\n+    public void tearDown() throws Exception {\n+\n+    }\n+\n+    @Test\n+    public void getUser() throws Exception {\n+        // Give\n+        User user = new User();\n+        user.setName(\"Huy\");\n+        user.setBirthday(\"11/1/1995\");\n+        // When\n+        when(mUserRepository.getUser()).thenReturn(Observable.just(user));\n+        // Then\n+        mPresenter.getUser();\n+        Mockito.verify(mViewModel, Mockito.never()).onChangePasswordError(null);\n+    }\n+\n+    @Test\n+    public void changePassword() throws Exception {\n+        // Give\n+        Object a = new Object();\n+        String currentPass = \"123456\";\n+        String newPass = \"12345\";\n+        String confirmPass = \"12345\";\n+        // When\n+        when(mUserRepository.changePassword(currentPass, newPass, confirmPass)).thenReturn(\n+                Observable.just(a));\n+        // Then\n+        mPresenter.changePassword(currentPass, newPass, confirmPass);\n+\n+        verify(mViewModel, Mockito.never()).onChangePasswordError(null);\n+        verify(mViewModel).onChangePasswordSuccess();\n+    }\n+\n+    @Test\n+    public void validateDataInput() throws Exception {\n+        // Give\n+        boolean expect = true;\n+        String currentPass = \"123456\";\n+        String newPass = \"12345\";\n+        String confirmPass = \"12345\";\n+        // When\n+        Mockito.when(mValidator.validateAll(mViewModel)).thenReturn(true);\n+        // Then\n+        boolean actual = mPresenter.validateDataInput(currentPass, newPass, confirmPass);\n+\n+        Assert.assertEquals(expect, actual);\n+    }\n+\n+    @Test\n+    public void validateCurrentPasswordInput() throws Exception {\n+        // Give\n+        String currentPass = \"123456\";\n+        String msg = \"Must not empty\";\n+        // When\n+        when(mValidator.validateValueNonEmpty(currentPass)).thenReturn(msg);\n+        // Then\n+        mPresenter.validateCurrentPasswordInput(currentPass);\n+\n+        verify(mViewModel, Mockito.never()).onInputCurrentPasswordError(null);\n+    }\n+\n+    @Test\n+    public void validateNewPasswordInput() throws Exception {\n+        // Give\n+        String newPass = \"12345\";\n+        String msg_empty = \"Must not empty\";\n+        String msg_range = \"Must range than 6\";","path":"app/src/test/java/com/framgia/wsm/screen/changepassword/ChangePasswordPresenterTest.java","position":120,"original_position":120,"commit_id":"1c1b4665625c6f96a761f864b693e303a9551577","original_commit_id":"1c1b4665625c6f96a761f864b693e303a9551577","user":{"login":"trainer-android-fr","id":6355989,"avatar_url":"https://avatars3.githubusercontent.com/u/6355989?v=4","gravatar_id":"","url":"https://api.github.com/users/trainer-android-fr","html_url":"https://github.com/trainer-android-fr","followers_url":"https://api.github.com/users/trainer-android-fr/followers","following_url":"https://api.github.com/users/trainer-android-fr/following{/other_user}","gists_url":"https://api.github.com/users/trainer-android-fr/gists{/gist_id}","starred_url":"https://api.github.com/users/trainer-android-fr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trainer-android-fr/subscriptions","organizations_url":"https://api.github.com/users/trainer-android-fr/orgs","repos_url":"https://api.github.com/users/trainer-android-fr/repos","events_url":"https://api.github.com/users/trainer-android-fr/events{/privacy}","received_events_url":"https://api.github.com/users/trainer-android-fr/received_events","type":"User","site_admin":false},"body":"WARNING: Name 'msg_range' must match pattern '^[a-z][a-zA-Z0-9]*$'.","created_at":"2017-08-24T06:39:40Z","updated_at":"2017-08-24T06:39:40Z","html_url":"https://github.com/framgia/wsm_android/pull/371#discussion_r134937230","pull_request_url":"https://api.github.com/repos/framgia/wsm_android/pulls/371","_links":{"self":{"href":"https://api.github.com/repos/framgia/wsm_android/pulls/comments/134937230"},"html":{"href":"https://github.com/framgia/wsm_android/pull/371#discussion_r134937230"},"pull_request":{"href":"https://api.github.com/repos/framgia/wsm_android/pulls/371"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/wsm_android/pulls/371","id":137367329,"html_url":"https://github.com/framgia/wsm_android/pull/371","diff_url":"https://github.com/framgia/wsm_android/pull/371.diff","patch_url":"https://github.com/framgia/wsm_android/pull/371.patch","issue_url":"https://api.github.com/repos/framgia/wsm_android/issues/371","number":371,"state":"open","locked":false,"title":"[Sprint Maintain]Create Unit Test In Change Password Screen","user":{"login":"nguyenhuy95dn","id":24884267,"avatar_url":"https://avatars3.githubusercontent.com/u/24884267?v=4","gravatar_id":"","url":"https://api.github.com/users/nguyenhuy95dn","html_url":"https://github.com/nguyenhuy95dn","followers_url":"https://api.github.com/users/nguyenhuy95dn/followers","following_url":"https://api.github.com/users/nguyenhuy95dn/following{/other_user}","gists_url":"https://api.github.com/users/nguyenhuy95dn/gists{/gist_id}","starred_url":"https://api.github.com/users/nguyenhuy95dn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguyenhuy95dn/subscriptions","organizations_url":"https://api.github.com/users/nguyenhuy95dn/orgs","repos_url":"https://api.github.com/users/nguyenhuy95dn/repos","events_url":"https://api.github.com/users/nguyenhuy95dn/events{/privacy}","received_events_url":"https://api.github.com/users/nguyenhuy95dn/received_events","type":"User","site_admin":false},"body":"Create Unit Test In Change Password Screen","created_at":"2017-08-24T04:30:52Z","updated_at":"2017-08-24T06:39:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"beb7024c92095d346f02d4a9dcf8cdd2e1a8a76f","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/framgia/wsm_android/pulls/371/commits","review_comments_url":"https://api.github.com/repos/framgia/wsm_android/pulls/371/comments","review_comment_url":"https://api.github.com/repos/framgia/wsm_android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/wsm_android/issues/371/comments","statuses_url":"https://api.github.com/repos/framgia/wsm_android/statuses/1c1b4665625c6f96a761f864b693e303a9551577","head":{"label":"nguyenhuy95dn:create_unit_test_in_change_password_screen","ref":"create_unit_test_in_change_password_screen","sha":"1c1b4665625c6f96a761f864b693e303a9551577","user":{"login":"nguyenhuy95dn","id":24884267,"avatar_url":"https://avatars3.githubusercontent.com/u/24884267?v=4","gravatar_id":"","url":"https://api.github.com/users/nguyenhuy95dn","html_url":"https://github.com/nguyenhuy95dn","followers_url":"https://api.github.com/users/nguyenhuy95dn/followers","following_url":"https://api.github.com/users/nguyenhuy95dn/following{/other_user}","gists_url":"https://api.github.com/users/nguyenhuy95dn/gists{/gist_id}","starred_url":"https://api.github.com/users/nguyenhuy95dn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguyenhuy95dn/subscriptions","organizations_url":"https://api.github.com/users/nguyenhuy95dn/orgs","repos_url":"https://api.github.com/users/nguyenhuy95dn/repos","events_url":"https://api.github.com/users/nguyenhuy95dn/events{/privacy}","received_events_url":"https://api.github.com/users/nguyenhuy95dn/received_events","type":"User","site_admin":false},"repo":{"id":98135765,"name":"wsm_android","full_name":"nguyenhuy95dn/wsm_android","owner":{"login":"nguyenhuy95dn","id":24884267,"avatar_url":"https://avatars3.githubusercontent.com/u/24884267?v=4","gravatar_id":"","url":"https://api.github.com/users/nguyenhuy95dn","html_url":"https://github.com/nguyenhuy95dn","followers_url":"https://api.github.com/users/nguyenhuy95dn/followers","following_url":"https://api.github.com/users/nguyenhuy95dn/following{/other_user}","gists_url":"https://api.github.com/users/nguyenhuy95dn/gists{/gist_id}","starred_url":"https://api.github.com/users/nguyenhuy95dn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguyenhuy95dn/subscriptions","organizations_url":"https://api.github.com/users/nguyenhuy95dn/orgs","repos_url":"https://api.github.com/users/nguyenhuy95dn/repos","events_url":"https://api.github.com/users/nguyenhuy95dn/events{/privacy}","received_events_url":"https://api.github.com/users/nguyenhuy95dn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nguyenhuy95dn/wsm_android","description":null,"fork":true,"url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android","forks_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/forks","keys_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/teams","hooks_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/hooks","issue_events_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/issues/events{/number}","events_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/events","assignees_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/assignees{/user}","branches_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/branches{/branch}","tags_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/tags","blobs_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/git/refs{/sha}","trees_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/statuses/{sha}","languages_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/languages","stargazers_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/stargazers","contributors_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/contributors","subscribers_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/subscribers","subscription_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/subscription","commits_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/commits{/sha}","git_commits_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/git/commits{/sha}","comments_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/comments{/number}","issue_comment_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/issues/comments{/number}","contents_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/contents/{+path}","compare_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/merges","archive_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/downloads","issues_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/issues{/number}","pulls_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/pulls{/number}","milestones_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/milestones{/number}","notifications_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/labels{/name}","releases_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/releases{/id}","deployments_url":"https://api.github.com/repos/nguyenhuy95dn/wsm_android/deployments","created_at":"2017-07-24T01:06:50Z","updated_at":"2017-07-24T01:06:52Z","pushed_at":"2017-08-24T06:29:21Z","git_url":"git://github.com/nguyenhuy95dn/wsm_android.git","ssh_url":"git@github.com:nguyenhuy95dn/wsm_android.git","clone_url":"https://github.com/nguyenhuy95dn/wsm_android.git","svn_url":"https://github.com/nguyenhuy95dn/wsm_android","homepage":null,"size":13640,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"framgia:develop","ref":"develop","sha":"0919bce656217776efa753f28e78d65d3bbfa3e9","user":{"login":"framgia","id":2322183,"avatar_url":"https://avatars3.githubusercontent.com/u/2322183?v=4","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"repo":{"id":91540013,"name":"wsm_android","full_name":"framgia/wsm_android","owner":{"login":"framgia","id":2322183,"avatar_url":"https://avatars3.githubusercontent.com/u/2322183?v=4","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/framgia/wsm_android","description":null,"fork":false,"url":"https://api.github.com/repos/framgia/wsm_android","forks_url":"https://api.github.com/repos/framgia/wsm_android/forks","keys_url":"https://api.github.com/repos/framgia/wsm_android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/wsm_android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/wsm_android/teams","hooks_url":"https://api.github.com/repos/framgia/wsm_android/hooks","issue_events_url":"https://api.github.com/repos/framgia/wsm_android/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/wsm_android/events","assignees_url":"https://api.github.com/repos/framgia/wsm_android/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/wsm_android/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/wsm_android/tags","blobs_url":"https://api.github.com/repos/framgia/wsm_android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/wsm_android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/wsm_android/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/wsm_android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/wsm_android/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/wsm_android/languages","stargazers_url":"https://api.github.com/repos/framgia/wsm_android/stargazers","contributors_url":"https://api.github.com/repos/framgia/wsm_android/contributors","subscribers_url":"https://api.github.com/repos/framgia/wsm_android/subscribers","subscription_url":"https://api.github.com/repos/framgia/wsm_android/subscription","commits_url":"https://api.github.com/repos/framgia/wsm_android/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/wsm_android/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/wsm_android/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/wsm_android/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/wsm_android/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/wsm_android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/wsm_android/merges","archive_url":"https://api.github.com/repos/framgia/wsm_android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/wsm_android/downloads","issues_url":"https://api.github.com/repos/framgia/wsm_android/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/wsm_android/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/wsm_android/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/wsm_android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/wsm_android/labels{/name}","releases_url":"https://api.github.com/repos/framgia/wsm_android/releases{/id}","deployments_url":"https://api.github.com/repos/framgia/wsm_android/deployments","created_at":"2017-05-17T06:11:46Z","updated_at":"2017-05-17T08:51:31Z","pushed_at":"2017-08-24T06:29:36Z","git_url":"git://github.com/framgia/wsm_android.git","ssh_url":"git@github.com:framgia/wsm_android.git","clone_url":"https://github.com/framgia/wsm_android.git","svn_url":"https://github.com/framgia/wsm_android","homepage":null,"size":13658,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":9,"forks":9,"open_issues":9,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/wsm_android/pulls/371"},"html":{"href":"https://github.com/framgia/wsm_android/pull/371"},"issue":{"href":"https://api.github.com/repos/framgia/wsm_android/issues/371"},"comments":{"href":"https://api.github.com/repos/framgia/wsm_android/issues/371/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/wsm_android/pulls/371/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/wsm_android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/wsm_android/pulls/371/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/wsm_android/statuses/1c1b4665625c6f96a761f864b693e303a9551577"}}}}
{"actor":{"display_login":"trainer-android-fr"}}