{"action":"created","comment":{"url":"https://api.github.com/repos/rjsk/BankTWO/pulls/comments/51930380","id":51930380,"diff_hunk":"@@ -0,0 +1,88 @@\n+package bank.two.tests;\n+\n+import static org.junit.Assert.assertArrayEquals;\n+import static org.junit.Assert.assertEquals;\n+\n+import bank.two.Account;\n+import bank.two.Bank;\n+import bank.two.BankMediator;\n+import org.junit.Before;\n+import org.junit.Test;\n+\n+public class DebtAccountDecoratorTest {\n+    Bank firstBank;\n+    Bank secondBank;\n+    BankMediator bankMediator;\n+    Account firstAccount;\n+    Account secondAccount;\n+    Account thirdAccount;\n+\n+    @Before\n+    public void setUp() throws Exception {\n+        bankMediator = new BankMediator();\n+        firstBank = new Bank();\n+        secondBank = new Bank();\n+        bankMediator.addBank(firstBank);\n+        bankMediator.addBank(secondBank);\n+\n+        firstAccount = firstBank.createDebtAccount(100);\n+        secondAccount = firstBank.createStandardAccount();\n+        thirdAccount = secondBank.createStandardAccount();\n+\n+    }\n+    @Test\n+    public void checkInitialDebt() {\n+        assertEquals(0, firstAccount.getBalance());\n+    }\n+    @Test\n+    public void assignAccountNumber() {\n+        assertArrayEquals(new int[]{1,2,1}, new int[]{firstAccount.getNumber(),secondAccount.getNumber(),thirdAccount.getNumber()});\n+    }\n+    @Test\n+    public void depositMoney() {\n+        firstAccount.depositMoney(1000);\n+        assertEquals(1000, firstAccount.getBalance());\n+    }\n+    @Test\n+    public void withdrawMoney() {\n+        firstAccount.depositMoney(1000);\n+        firstAccount.withdrawMoney(100);\n+        assertEquals(900, firstAccount.getBalance());\n+    }\n+    @Test\n+    public void transferMoney() {\n+        firstAccount.depositMoney(1000);\n+        firstAccount.transferMoney(thirdAccount,100);\n+        firstBank.outSession();\n+        secondBank.inSession();\n+        assertArrayEquals(new int[]{900,100}, new int[]{firstAccount.getBalance(),thirdAccount.getBalance()});\n+    }\n+    @Test\n+    public void increaseDebt() {\n+        firstAccount.depositMoney(100);\n+        firstAccount.withdrawMoney(150);\n+        firstAccount.withdrawMoney(20);\n+        assertEquals(-70, firstAccount.getBalance());\n+    }\n+    @Test\n+    public void payDebt() {\n+        firstAccount.depositMoney(100);\n+        firstAccount.withdrawMoney(110);\n+        firstAccount.depositMoney(20);\n+        assertEquals(10, firstAccount.getBalance());\n+    }\n+    @Test\n+    public void exceedDebt() {\n+        firstAccount.depositMoney(100);\n+        firstAccount.withdrawMoney(150);\n+        firstAccount.transferMoney(thirdAccount,10);\n+        firstBank.outSession();\n+        secondBank.inSession();\n+        firstAccount.transferMoney(thirdAccount,200);\n+        firstBank.outSession();\n+        secondBank.inSession();\n+        assertArrayEquals(new int[]{-60,10}, new int[]{firstAccount.getBalance(),thirdAccount.getBalance()});\n+    }\n+","path":"src/bank/two/tests/DebtAccountDecoratorTest.java","position":86,"original_position":86,"commit_id":"a211a2af60523ac73e4234ceb2a387057ecaea88","original_commit_id":"a211a2af60523ac73e4234ceb2a387057ecaea88","user":{"login":"pawelurb","id":5851058,"avatar_url":"https://avatars.githubusercontent.com/u/5851058?v=3","gravatar_id":"","url":"https://api.github.com/users/pawelurb","html_url":"https://github.com/pawelurb","followers_url":"https://api.github.com/users/pawelurb/followers","following_url":"https://api.github.com/users/pawelurb/following{/other_user}","gists_url":"https://api.github.com/users/pawelurb/gists{/gist_id}","starred_url":"https://api.github.com/users/pawelurb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pawelurb/subscriptions","organizations_url":"https://api.github.com/users/pawelurb/orgs","repos_url":"https://api.github.com/users/pawelurb/repos","events_url":"https://api.github.com/users/pawelurb/events{/privacy}","received_events_url":"https://api.github.com/users/pawelurb/received_events","type":"User","site_admin":false},"body":"Zalecałbym jeszcze implementację metody tearDown która ustawia wartość wszystkich atrybutów przypisanych w setUp na null. Ma to dwie zasadnicze zalety: pierwsza to mniejsze ryzyko że obiekt będzie przechowywał poprzedni stan, dwa że wspomagasz w ten sposób nieco garbage collector. :)","created_at":"2016-02-04T20:09:33Z","updated_at":"2016-02-04T20:09:33Z","html_url":"https://github.com/rjsk/BankTWO/pull/1#discussion_r51930380","pull_request_url":"https://api.github.com/repos/rjsk/BankTWO/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/rjsk/BankTWO/pulls/comments/51930380"},"html":{"href":"https://github.com/rjsk/BankTWO/pull/1#discussion_r51930380"},"pull_request":{"href":"https://api.github.com/repos/rjsk/BankTWO/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/rjsk/BankTWO/pulls/1","id":57771862,"html_url":"https://github.com/rjsk/BankTWO/pull/1","diff_url":"https://github.com/rjsk/BankTWO/pull/1.diff","patch_url":"https://github.com/rjsk/BankTWO/pull/1.patch","issue_url":"https://api.github.com/repos/rjsk/BankTWO/issues/1","number":1,"state":"open","locked":false,"title":"[M-8] Implemented Decorator pattern","user":{"login":"rjsk","id":8105841,"avatar_url":"https://avatars.githubusercontent.com/u/8105841?v=3","gravatar_id":"","url":"https://api.github.com/users/rjsk","html_url":"https://github.com/rjsk","followers_url":"https://api.github.com/users/rjsk/followers","following_url":"https://api.github.com/users/rjsk/following{/other_user}","gists_url":"https://api.github.com/users/rjsk/gists{/gist_id}","starred_url":"https://api.github.com/users/rjsk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjsk/subscriptions","organizations_url":"https://api.github.com/users/rjsk/orgs","repos_url":"https://api.github.com/users/rjsk/repos","events_url":"https://api.github.com/users/rjsk/events{/privacy}","received_events_url":"https://api.github.com/users/rjsk/received_events","type":"User","site_admin":false},"body":"- Implemented Decorator pattern for debt accounts. \r\n- created test cases and moved them to tests folder","created_at":"2016-01-31T15:48:49Z","updated_at":"2016-02-04T20:09:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"687003d8e388a6738015eac117641e8d155a3183","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rjsk/BankTWO/pulls/1/commits","review_comments_url":"https://api.github.com/repos/rjsk/BankTWO/pulls/1/comments","review_comment_url":"https://api.github.com/repos/rjsk/BankTWO/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rjsk/BankTWO/issues/1/comments","statuses_url":"https://api.github.com/repos/rjsk/BankTWO/statuses/a211a2af60523ac73e4234ceb2a387057ecaea88","head":{"label":"rjsk:M-8","ref":"M-8","sha":"a211a2af60523ac73e4234ceb2a387057ecaea88","user":{"login":"rjsk","id":8105841,"avatar_url":"https://avatars.githubusercontent.com/u/8105841?v=3","gravatar_id":"","url":"https://api.github.com/users/rjsk","html_url":"https://github.com/rjsk","followers_url":"https://api.github.com/users/rjsk/followers","following_url":"https://api.github.com/users/rjsk/following{/other_user}","gists_url":"https://api.github.com/users/rjsk/gists{/gist_id}","starred_url":"https://api.github.com/users/rjsk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjsk/subscriptions","organizations_url":"https://api.github.com/users/rjsk/orgs","repos_url":"https://api.github.com/users/rjsk/repos","events_url":"https://api.github.com/users/rjsk/events{/privacy}","received_events_url":"https://api.github.com/users/rjsk/received_events","type":"User","site_admin":false},"repo":{"id":49232950,"name":"BankTWO","full_name":"rjsk/BankTWO","owner":{"login":"rjsk","id":8105841,"avatar_url":"https://avatars.githubusercontent.com/u/8105841?v=3","gravatar_id":"","url":"https://api.github.com/users/rjsk","html_url":"https://github.com/rjsk","followers_url":"https://api.github.com/users/rjsk/followers","following_url":"https://api.github.com/users/rjsk/following{/other_user}","gists_url":"https://api.github.com/users/rjsk/gists{/gist_id}","starred_url":"https://api.github.com/users/rjsk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjsk/subscriptions","organizations_url":"https://api.github.com/users/rjsk/orgs","repos_url":"https://api.github.com/users/rjsk/repos","events_url":"https://api.github.com/users/rjsk/events{/privacy}","received_events_url":"https://api.github.com/users/rjsk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rjsk/BankTWO","description":"Design Patterns in bank example","fork":false,"url":"https://api.github.com/repos/rjsk/BankTWO","forks_url":"https://api.github.com/repos/rjsk/BankTWO/forks","keys_url":"https://api.github.com/repos/rjsk/BankTWO/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rjsk/BankTWO/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rjsk/BankTWO/teams","hooks_url":"https://api.github.com/repos/rjsk/BankTWO/hooks","issue_events_url":"https://api.github.com/repos/rjsk/BankTWO/issues/events{/number}","events_url":"https://api.github.com/repos/rjsk/BankTWO/events","assignees_url":"https://api.github.com/repos/rjsk/BankTWO/assignees{/user}","branches_url":"https://api.github.com/repos/rjsk/BankTWO/branches{/branch}","tags_url":"https://api.github.com/repos/rjsk/BankTWO/tags","blobs_url":"https://api.github.com/repos/rjsk/BankTWO/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rjsk/BankTWO/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rjsk/BankTWO/git/refs{/sha}","trees_url":"https://api.github.com/repos/rjsk/BankTWO/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rjsk/BankTWO/statuses/{sha}","languages_url":"https://api.github.com/repos/rjsk/BankTWO/languages","stargazers_url":"https://api.github.com/repos/rjsk/BankTWO/stargazers","contributors_url":"https://api.github.com/repos/rjsk/BankTWO/contributors","subscribers_url":"https://api.github.com/repos/rjsk/BankTWO/subscribers","subscription_url":"https://api.github.com/repos/rjsk/BankTWO/subscription","commits_url":"https://api.github.com/repos/rjsk/BankTWO/commits{/sha}","git_commits_url":"https://api.github.com/repos/rjsk/BankTWO/git/commits{/sha}","comments_url":"https://api.github.com/repos/rjsk/BankTWO/comments{/number}","issue_comment_url":"https://api.github.com/repos/rjsk/BankTWO/issues/comments{/number}","contents_url":"https://api.github.com/repos/rjsk/BankTWO/contents/{+path}","compare_url":"https://api.github.com/repos/rjsk/BankTWO/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rjsk/BankTWO/merges","archive_url":"https://api.github.com/repos/rjsk/BankTWO/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rjsk/BankTWO/downloads","issues_url":"https://api.github.com/repos/rjsk/BankTWO/issues{/number}","pulls_url":"https://api.github.com/repos/rjsk/BankTWO/pulls{/number}","milestones_url":"https://api.github.com/repos/rjsk/BankTWO/milestones{/number}","notifications_url":"https://api.github.com/repos/rjsk/BankTWO/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rjsk/BankTWO/labels{/name}","releases_url":"https://api.github.com/repos/rjsk/BankTWO/releases{/id}","deployments_url":"https://api.github.com/repos/rjsk/BankTWO/deployments","created_at":"2016-01-07T21:52:44Z","updated_at":"2016-01-11T18:51:49Z","pushed_at":"2016-01-31T16:02:54Z","git_url":"git://github.com/rjsk/BankTWO.git","ssh_url":"git@github.com:rjsk/BankTWO.git","clone_url":"https://github.com/rjsk/BankTWO.git","svn_url":"https://github.com/rjsk/BankTWO","homepage":null,"size":7,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"rjsk:master","ref":"master","sha":"9bf43dd1fe32f3623be780e6c37de7bd34c3dd21","user":{"login":"rjsk","id":8105841,"avatar_url":"https://avatars.githubusercontent.com/u/8105841?v=3","gravatar_id":"","url":"https://api.github.com/users/rjsk","html_url":"https://github.com/rjsk","followers_url":"https://api.github.com/users/rjsk/followers","following_url":"https://api.github.com/users/rjsk/following{/other_user}","gists_url":"https://api.github.com/users/rjsk/gists{/gist_id}","starred_url":"https://api.github.com/users/rjsk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjsk/subscriptions","organizations_url":"https://api.github.com/users/rjsk/orgs","repos_url":"https://api.github.com/users/rjsk/repos","events_url":"https://api.github.com/users/rjsk/events{/privacy}","received_events_url":"https://api.github.com/users/rjsk/received_events","type":"User","site_admin":false},"repo":{"id":49232950,"name":"BankTWO","full_name":"rjsk/BankTWO","owner":{"login":"rjsk","id":8105841,"avatar_url":"https://avatars.githubusercontent.com/u/8105841?v=3","gravatar_id":"","url":"https://api.github.com/users/rjsk","html_url":"https://github.com/rjsk","followers_url":"https://api.github.com/users/rjsk/followers","following_url":"https://api.github.com/users/rjsk/following{/other_user}","gists_url":"https://api.github.com/users/rjsk/gists{/gist_id}","starred_url":"https://api.github.com/users/rjsk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjsk/subscriptions","organizations_url":"https://api.github.com/users/rjsk/orgs","repos_url":"https://api.github.com/users/rjsk/repos","events_url":"https://api.github.com/users/rjsk/events{/privacy}","received_events_url":"https://api.github.com/users/rjsk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rjsk/BankTWO","description":"Design Patterns in bank example","fork":false,"url":"https://api.github.com/repos/rjsk/BankTWO","forks_url":"https://api.github.com/repos/rjsk/BankTWO/forks","keys_url":"https://api.github.com/repos/rjsk/BankTWO/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rjsk/BankTWO/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rjsk/BankTWO/teams","hooks_url":"https://api.github.com/repos/rjsk/BankTWO/hooks","issue_events_url":"https://api.github.com/repos/rjsk/BankTWO/issues/events{/number}","events_url":"https://api.github.com/repos/rjsk/BankTWO/events","assignees_url":"https://api.github.com/repos/rjsk/BankTWO/assignees{/user}","branches_url":"https://api.github.com/repos/rjsk/BankTWO/branches{/branch}","tags_url":"https://api.github.com/repos/rjsk/BankTWO/tags","blobs_url":"https://api.github.com/repos/rjsk/BankTWO/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rjsk/BankTWO/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rjsk/BankTWO/git/refs{/sha}","trees_url":"https://api.github.com/repos/rjsk/BankTWO/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rjsk/BankTWO/statuses/{sha}","languages_url":"https://api.github.com/repos/rjsk/BankTWO/languages","stargazers_url":"https://api.github.com/repos/rjsk/BankTWO/stargazers","contributors_url":"https://api.github.com/repos/rjsk/BankTWO/contributors","subscribers_url":"https://api.github.com/repos/rjsk/BankTWO/subscribers","subscription_url":"https://api.github.com/repos/rjsk/BankTWO/subscription","commits_url":"https://api.github.com/repos/rjsk/BankTWO/commits{/sha}","git_commits_url":"https://api.github.com/repos/rjsk/BankTWO/git/commits{/sha}","comments_url":"https://api.github.com/repos/rjsk/BankTWO/comments{/number}","issue_comment_url":"https://api.github.com/repos/rjsk/BankTWO/issues/comments{/number}","contents_url":"https://api.github.com/repos/rjsk/BankTWO/contents/{+path}","compare_url":"https://api.github.com/repos/rjsk/BankTWO/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rjsk/BankTWO/merges","archive_url":"https://api.github.com/repos/rjsk/BankTWO/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rjsk/BankTWO/downloads","issues_url":"https://api.github.com/repos/rjsk/BankTWO/issues{/number}","pulls_url":"https://api.github.com/repos/rjsk/BankTWO/pulls{/number}","milestones_url":"https://api.github.com/repos/rjsk/BankTWO/milestones{/number}","notifications_url":"https://api.github.com/repos/rjsk/BankTWO/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rjsk/BankTWO/labels{/name}","releases_url":"https://api.github.com/repos/rjsk/BankTWO/releases{/id}","deployments_url":"https://api.github.com/repos/rjsk/BankTWO/deployments","created_at":"2016-01-07T21:52:44Z","updated_at":"2016-01-11T18:51:49Z","pushed_at":"2016-01-31T16:02:54Z","git_url":"git://github.com/rjsk/BankTWO.git","ssh_url":"git@github.com:rjsk/BankTWO.git","clone_url":"https://github.com/rjsk/BankTWO.git","svn_url":"https://github.com/rjsk/BankTWO","homepage":null,"size":7,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rjsk/BankTWO/pulls/1"},"html":{"href":"https://github.com/rjsk/BankTWO/pull/1"},"issue":{"href":"https://api.github.com/repos/rjsk/BankTWO/issues/1"},"comments":{"href":"https://api.github.com/repos/rjsk/BankTWO/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/rjsk/BankTWO/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/rjsk/BankTWO/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rjsk/BankTWO/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/rjsk/BankTWO/statuses/a211a2af60523ac73e4234ceb2a387057ecaea88"}}}}