{"action":"created","comment":{"url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/pulls/comments/44874973","id":44874973,"diff_hunk":"@@ -0,0 +1,124 @@\n+package ru.unn.agile.CurrencyConverter.viewmodel;\n+\n+import org.junit.After;\n+import org.junit.Before;\n+import org.junit.Test;\n+import ru.unn.agile.CurrencyConverter.Model.UnitCurrency;\n+\n+import static org.junit.Assert.*;\n+\n+public class ViewModelTests {\n+    private ViewModel viewModel;\n+\n+    @Before\n+    public void setUp() {\n+        viewModel = new ViewModel();\n+    }\n+\n+    @After\n+    public void tearDown() {\n+        viewModel = null;\n+    }\n+\n+    @Test\n+    public void canSetDefaultValueAndUnits() {\n+        assertEquals(\"0.00\", viewModel.inputValueProperty().get());\n+        assertEquals(\"0.00\", viewModel.inputValueProperty().get());\n+    }\n+\n+    @Test\n+    public void canSetDefaultUnits() {\n+        assertEquals(UnitCurrency.RUBLE, viewModel.inputUnitProperty().get());\n+        assertEquals(UnitCurrency.RUBLE, viewModel.outputUnitProperty().get());\n+    }\n+\n+    @Test\n+    public void canSetDefaultMessage() {\n+        assertEquals(Status.WAITING.toString(), viewModel.statusProperty().get());\n+    }\n+\n+    @Test\n+    public void statusIsWaitingWhenValueFieldEmpty() {\n+        viewModel.inputValueProperty().set(\"\");\n+\n+        viewModel.convert();\n+\n+        assertEquals(Status.WAITING.toString(), viewModel.statusProperty().get());\n+    }\n+\n+    @Test\n+    public void statusIsReadyWhenInputValueIsCorrect() {\n+        viewModel.inputValueProperty().set(\"500.70\");\n+\n+        assertEquals(Status.READY.toString(), viewModel.statusProperty().get());\n+    }\n+\n+    @Test\n+    public void canDetectWrongFormat() {\n+        viewModel.inputValueProperty().set(\"^-^\");\n+\n+        assertEquals(Status.WRONG_FORMAT.toString(), viewModel.statusProperty().get());\n+    }\n+\n+    @Test\n+    public void rubleIsDefaultCurrency() {\n+\n+        assertEquals(UnitCurrency.RUBLE, viewModel.inputUnitProperty().get());\n+        assertEquals(UnitCurrency.RUBLE, viewModel.outputUnitProperty().get());\n+    }\n+\n+    @Test\n+    public void convertButtonIsDisabledWhenFormatIsWrong() {\n+\n+        viewModel.inputValueProperty().set(\"1,1\");\n+\n+        assertTrue(viewModel.convertationDisableProperty().get());\n+    }\n+\n+    @Test\n+    public void calculateButtonIsDisabledWithIncompleteInput() {\n+        viewModel.inputValueProperty().set(\".\");\n+\n+        assertTrue(viewModel.convertationDisableProperty().get());\n+    }\n+\n+    @Test\n+    public void canSetDoneMessageWhenConvertationIsDone() {\n+        viewModel.inputValueProperty().set(\"70\");\n+        viewModel.inputUnitProperty().set(UnitCurrency.RUBLE);\n+        viewModel.outputUnitProperty().set(UnitCurrency.DOLLAR);\n+\n+        viewModel.convert();\n+\n+        assertEquals(Status.DONE.toString(), viewModel.statusProperty().get());\n+    }\n+\n+    @Test\n+    public void canSetWrongFormatMessage() {\n+        viewModel.inputValueProperty().set(\"^-^\");\n+\n+        assertEquals(Status.WRONG_FORMAT.toString(), viewModel.statusProperty().get());\n+    }\n+\n+    @Test\n+    public void statusIsReadyWhenDataIsCorrect() {\n+        viewModel.inputValueProperty().set(\"135.20\");\n+        viewModel.inputUnitProperty().set(UnitCurrency.EURO);\n+        viewModel.outputUnitProperty().set(UnitCurrency.DOLLAR);\n+\n+        assertEquals(Status.READY.toString(), viewModel.statusProperty().get());\n+    }\n+\n+    @Test\n+    public void convertRubleToDollarIsCorrect() {\n+        viewModel.inputValueProperty().set(\"100\");\n+        viewModel.inputUnitProperty().set(UnitCurrency.RUBLE);\n+        viewModel.outputUnitProperty().set(UnitCurrency.DOLLAR);\n+\n+        viewModel.convert();\n+\n+        assertEquals(\"1.6\", viewModel.outputValueProperty().get());\n+        assertEquals(UnitCurrency.DOLLAR, viewModel.outputUnitProperty().get());","path":"code/kochanova-ksenya/ViewModel/src/test/java/ru/unn/agile/CurrencyConverter/viewmodel/ViewModelTests.java","position":121,"original_position":121,"commit_id":"be82a2df5d41b8067fa2f39126ef09a6790dddd9","original_commit_id":"be82a2df5d41b8067fa2f39126ef09a6790dddd9","user":{"login":"dmitryvodop","id":5374181,"avatar_url":"https://avatars.githubusercontent.com/u/5374181?v=3","gravatar_id":"","url":"https://api.github.com/users/dmitryvodop","html_url":"https://github.com/dmitryvodop","followers_url":"https://api.github.com/users/dmitryvodop/followers","following_url":"https://api.github.com/users/dmitryvodop/following{/other_user}","gists_url":"https://api.github.com/users/dmitryvodop/gists{/gist_id}","starred_url":"https://api.github.com/users/dmitryvodop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmitryvodop/subscriptions","organizations_url":"https://api.github.com/users/dmitryvodop/orgs","repos_url":"https://api.github.com/users/dmitryvodop/repos","events_url":"https://api.github.com/users/dmitryvodop/events{/privacy}","received_events_url":"https://api.github.com/users/dmitryvodop/received_events","type":"User","site_admin":false},"body":"Лучше вынести в отдельный тест.","created_at":"2015-11-15T17:39:26Z","updated_at":"2015-11-15T17:39:26Z","html_url":"https://github.com/UNN-VMK-Software/agile-course-practice/pull/116#discussion_r44874973","pull_request_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/pulls/116","_links":{"self":{"href":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/pulls/comments/44874973"},"html":{"href":"https://github.com/UNN-VMK-Software/agile-course-practice/pull/116#discussion_r44874973"},"pull_request":{"href":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/pulls/116"}}},"pull_request":{"url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/pulls/116","id":50490356,"html_url":"https://github.com/UNN-VMK-Software/agile-course-practice/pull/116","diff_url":"https://github.com/UNN-VMK-Software/agile-course-practice/pull/116.diff","patch_url":"https://github.com/UNN-VMK-Software/agile-course-practice/pull/116.patch","issue_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/issues/116","number":116,"state":"open","locked":false,"title":"Кочанова - Лабораторная работа#2","user":{"login":"KsenyaKochanova","id":5374992,"avatar_url":"https://avatars.githubusercontent.com/u/5374992?v=3","gravatar_id":"","url":"https://api.github.com/users/KsenyaKochanova","html_url":"https://github.com/KsenyaKochanova","followers_url":"https://api.github.com/users/KsenyaKochanova/followers","following_url":"https://api.github.com/users/KsenyaKochanova/following{/other_user}","gists_url":"https://api.github.com/users/KsenyaKochanova/gists{/gist_id}","starred_url":"https://api.github.com/users/KsenyaKochanova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KsenyaKochanova/subscriptions","organizations_url":"https://api.github.com/users/KsenyaKochanova/orgs","repos_url":"https://api.github.com/users/KsenyaKochanova/repos","events_url":"https://api.github.com/users/KsenyaKochanova/events{/privacy}","received_events_url":"https://api.github.com/users/KsenyaKochanova/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-12T09:49:20Z","updated_at":"2015-11-15T17:39:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"77624b3e91e5fc30d2649944b743e85db87f4d96","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/pulls/116/commits","review_comments_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/pulls/116/comments","review_comment_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/pulls/comments{/number}","comments_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/issues/116/comments","statuses_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/statuses/be82a2df5d41b8067fa2f39126ef09a6790dddd9","head":{"label":"KsenyaKochanova:lab2-mvvm-ksenya-kochanova","ref":"lab2-mvvm-ksenya-kochanova","sha":"be82a2df5d41b8067fa2f39126ef09a6790dddd9","user":{"login":"KsenyaKochanova","id":5374992,"avatar_url":"https://avatars.githubusercontent.com/u/5374992?v=3","gravatar_id":"","url":"https://api.github.com/users/KsenyaKochanova","html_url":"https://github.com/KsenyaKochanova","followers_url":"https://api.github.com/users/KsenyaKochanova/followers","following_url":"https://api.github.com/users/KsenyaKochanova/following{/other_user}","gists_url":"https://api.github.com/users/KsenyaKochanova/gists{/gist_id}","starred_url":"https://api.github.com/users/KsenyaKochanova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KsenyaKochanova/subscriptions","organizations_url":"https://api.github.com/users/KsenyaKochanova/orgs","repos_url":"https://api.github.com/users/KsenyaKochanova/repos","events_url":"https://api.github.com/users/KsenyaKochanova/events{/privacy}","received_events_url":"https://api.github.com/users/KsenyaKochanova/received_events","type":"User","site_admin":false},"repo":{"id":44599054,"name":"agile-course-practice","full_name":"KsenyaKochanova/agile-course-practice","owner":{"login":"KsenyaKochanova","id":5374992,"avatar_url":"https://avatars.githubusercontent.com/u/5374992?v=3","gravatar_id":"","url":"https://api.github.com/users/KsenyaKochanova","html_url":"https://github.com/KsenyaKochanova","followers_url":"https://api.github.com/users/KsenyaKochanova/followers","following_url":"https://api.github.com/users/KsenyaKochanova/following{/other_user}","gists_url":"https://api.github.com/users/KsenyaKochanova/gists{/gist_id}","starred_url":"https://api.github.com/users/KsenyaKochanova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KsenyaKochanova/subscriptions","organizations_url":"https://api.github.com/users/KsenyaKochanova/orgs","repos_url":"https://api.github.com/users/KsenyaKochanova/repos","events_url":"https://api.github.com/users/KsenyaKochanova/events{/privacy}","received_events_url":"https://api.github.com/users/KsenyaKochanova/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/KsenyaKochanova/agile-course-practice","description":"Проект-шаблон для выполнения лабораторных работ по курсу Agile Development","fork":true,"url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice","forks_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/forks","keys_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/keys{/key_id}","collaborators_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/teams","hooks_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/hooks","issue_events_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/issues/events{/number}","events_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/events","assignees_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/assignees{/user}","branches_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/branches{/branch}","tags_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/tags","blobs_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/git/refs{/sha}","trees_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/git/trees{/sha}","statuses_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/statuses/{sha}","languages_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/languages","stargazers_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/stargazers","contributors_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/contributors","subscribers_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/subscribers","subscription_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/subscription","commits_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/commits{/sha}","git_commits_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/git/commits{/sha}","comments_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/comments{/number}","issue_comment_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/issues/comments{/number}","contents_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/contents/{+path}","compare_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/compare/{base}...{head}","merges_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/merges","archive_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/downloads","issues_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/issues{/number}","pulls_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/pulls{/number}","milestones_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/milestones{/number}","notifications_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/labels{/name}","releases_url":"https://api.github.com/repos/KsenyaKochanova/agile-course-practice/releases{/id}","created_at":"2015-10-20T10:29:30Z","updated_at":"2015-10-20T10:29:32Z","pushed_at":"2015-11-15T15:00:05Z","git_url":"git://github.com/KsenyaKochanova/agile-course-practice.git","ssh_url":"git@github.com:KsenyaKochanova/agile-course-practice.git","clone_url":"https://github.com/KsenyaKochanova/agile-course-practice.git","svn_url":"https://github.com/KsenyaKochanova/agile-course-practice","homepage":"","size":602,"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":"UNN-VMK-Software:master","ref":"master","sha":"7d9f56816219ff38a4e2dc2797cd241367d00510","user":{"login":"UNN-VMK-Software","id":5463209,"avatar_url":"https://avatars.githubusercontent.com/u/5463209?v=3","gravatar_id":"","url":"https://api.github.com/users/UNN-VMK-Software","html_url":"https://github.com/UNN-VMK-Software","followers_url":"https://api.github.com/users/UNN-VMK-Software/followers","following_url":"https://api.github.com/users/UNN-VMK-Software/following{/other_user}","gists_url":"https://api.github.com/users/UNN-VMK-Software/gists{/gist_id}","starred_url":"https://api.github.com/users/UNN-VMK-Software/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UNN-VMK-Software/subscriptions","organizations_url":"https://api.github.com/users/UNN-VMK-Software/orgs","repos_url":"https://api.github.com/users/UNN-VMK-Software/repos","events_url":"https://api.github.com/users/UNN-VMK-Software/events{/privacy}","received_events_url":"https://api.github.com/users/UNN-VMK-Software/received_events","type":"Organization","site_admin":false},"repo":{"id":44518750,"name":"agile-course-practice","full_name":"UNN-VMK-Software/agile-course-practice","owner":{"login":"UNN-VMK-Software","id":5463209,"avatar_url":"https://avatars.githubusercontent.com/u/5463209?v=3","gravatar_id":"","url":"https://api.github.com/users/UNN-VMK-Software","html_url":"https://github.com/UNN-VMK-Software","followers_url":"https://api.github.com/users/UNN-VMK-Software/followers","following_url":"https://api.github.com/users/UNN-VMK-Software/following{/other_user}","gists_url":"https://api.github.com/users/UNN-VMK-Software/gists{/gist_id}","starred_url":"https://api.github.com/users/UNN-VMK-Software/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UNN-VMK-Software/subscriptions","organizations_url":"https://api.github.com/users/UNN-VMK-Software/orgs","repos_url":"https://api.github.com/users/UNN-VMK-Software/repos","events_url":"https://api.github.com/users/UNN-VMK-Software/events{/privacy}","received_events_url":"https://api.github.com/users/UNN-VMK-Software/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/UNN-VMK-Software/agile-course-practice","description":"Проект-шаблон для выполнения лабораторных работ по курсу Agile Development","fork":false,"url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice","forks_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/forks","keys_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/teams","hooks_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/hooks","issue_events_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/issues/events{/number}","events_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/events","assignees_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/assignees{/user}","branches_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/branches{/branch}","tags_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/tags","blobs_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/git/refs{/sha}","trees_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/statuses/{sha}","languages_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/languages","stargazers_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/stargazers","contributors_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/contributors","subscribers_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/subscribers","subscription_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/subscription","commits_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/commits{/sha}","git_commits_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/git/commits{/sha}","comments_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/comments{/number}","issue_comment_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/issues/comments{/number}","contents_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/contents/{+path}","compare_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/merges","archive_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/downloads","issues_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/issues{/number}","pulls_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/pulls{/number}","milestones_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/milestones{/number}","notifications_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/labels{/name}","releases_url":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/releases{/id}","created_at":"2015-10-19T07:42:22Z","updated_at":"2015-10-29T19:46:12Z","pushed_at":"2015-11-15T16:55:38Z","git_url":"git://github.com/UNN-VMK-Software/agile-course-practice.git","ssh_url":"git@github.com:UNN-VMK-Software/agile-course-practice.git","clone_url":"https://github.com/UNN-VMK-Software/agile-course-practice.git","svn_url":"https://github.com/UNN-VMK-Software/agile-course-practice","homepage":"","size":3579,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":46,"mirror_url":null,"open_issues_count":16,"forks":46,"open_issues":16,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/pulls/116"},"html":{"href":"https://github.com/UNN-VMK-Software/agile-course-practice/pull/116"},"issue":{"href":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/issues/116"},"comments":{"href":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/issues/116/comments"},"review_comments":{"href":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/pulls/116/comments"},"review_comment":{"href":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/pulls/116/commits"},"statuses":{"href":"https://api.github.com/repos/UNN-VMK-Software/agile-course-practice/statuses/be82a2df5d41b8067fa2f39126ef09a6790dddd9"}}}}