{"action":"created","comment":{"url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/pulls/comments/55170345","id":55170345,"diff_hunk":"@@ -0,0 +1,82 @@\n+package cs2103.v15_1j.jimjim;\n+\n+import static org.junit.Assert.*;\n+\n+import java.io.BufferedReader;\n+import java.io.FileReader;\n+import java.io.IOException;\n+import java.time.LocalDateTime;\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+import org.junit.After;\n+import org.junit.Before;\n+import org.junit.Test;\n+\n+public class JJStorageTest {\n+\tprivate JJStorage storage;\n+\n+\t@Before\n+\tpublic void setUp() {\n+\t\tstorage = new JJStorage();\n+\t\tstorage.setSaveFiles(\"tasks-test.json\", \"events-test.json\");\n+\t}\n+\t\n+\t@After\n+\tpublic void tearDown() throws IOException {\n+\t\t// Delete test JSON files after every test\n+\t\tstorage.getSavedTasksFile().delete();\n+\t\tstorage.getSavedEventsFile().delete();\n+\t}\n+\t\n+\t/*\n+\t * Test that JJStorage is able to save file to disk\n+\t */\n+\t@Test\n+\tpublic void testSave() throws IOException {\n+\t\tTask task = new Task(\"task\", LocalDateTime.now());\n+\t\tList<TaskEvent> list = new ArrayList<TaskEvent>();\n+\t\tlist.add(task);\n+\t\t\n+\t\tif (storage.save(list)) {\n+\t\t\tBufferedReader bufferedReader = new BufferedReader(new FileReader(storage.getSavedTasksFile()));\n+\t\t\tassertNotNull(bufferedReader.readLine());\n+\t\t\tbufferedReader.close();\n+\t\t}\n+\t}\n+\t\n+\t/*\n+\t * Test that JJStorage is able to successfully load data from disk\n+\t */\n+\t@Test\n+\tpublic void testLoad() throws IOException {\n+\t\tLocalDateTime dateTime1 = LocalDateTime.of(2016, 3, 6, 4, 37);\n+\t\tLocalDateTime dateTime2 = LocalDateTime.of(2015, 3, 6, 4, 37);\n+\t\tTask task1 = new Task(\"task1\", dateTime1);\n+\t\tTask task2 = new Task(\"task2\", dateTime2);\n+\t\tList<TaskEvent> list = new ArrayList<TaskEvent>();\n+\t\tlist.add(task1);\n+\t\tlist.add(task2);\n+\t\t\n+\t\tif (storage.save(list)) {\n+\t\t\tList<TaskEvent> savedList = storage.load();\n+\t\t\tassertEquals(2, savedList.size());\n+\t\t\t\n+\t\t\tTask savedTask1 = (Task) savedList.get(0);\n+\t\t\tTask savedTask2 = (Task) savedList.get(1);\n+\t\t\t","path":"src/test/java/cs2103/v15_1j/jimjim/JJStorageTest.java","position":67,"original_position":67,"commit_id":"f9bcbb13bf5f52a9f976792a34874d46e060740f","original_commit_id":"f9bcbb13bf5f52a9f976792a34874d46e060740f","user":{"login":"tran-tien-dat","id":8559368,"avatar_url":"https://avatars.githubusercontent.com/u/8559368?v=3","gravatar_id":"","url":"https://api.github.com/users/tran-tien-dat","html_url":"https://github.com/tran-tien-dat","followers_url":"https://api.github.com/users/tran-tien-dat/followers","following_url":"https://api.github.com/users/tran-tien-dat/following{/other_user}","gists_url":"https://api.github.com/users/tran-tien-dat/gists{/gist_id}","starred_url":"https://api.github.com/users/tran-tien-dat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tran-tien-dat/subscriptions","organizations_url":"https://api.github.com/users/tran-tien-dat/orgs","repos_url":"https://api.github.com/users/tran-tien-dat/repos","events_url":"https://api.github.com/users/tran-tien-dat/events{/privacy}","received_events_url":"https://api.github.com/users/tran-tien-dat/received_events","type":"User","site_admin":false},"body":"you should test a mix of both Task and Event, not just Task","created_at":"2016-03-07T07:47:55Z","updated_at":"2016-03-07T07:47:55Z","html_url":"https://github.com/cs2103jan2016-v15-1j/main/pull/45#discussion_r55170345","pull_request_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/pulls/45","_links":{"self":{"href":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/pulls/comments/55170345"},"html":{"href":"https://github.com/cs2103jan2016-v15-1j/main/pull/45#discussion_r55170345"},"pull_request":{"href":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/pulls/45"}}},"pull_request":{"url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/pulls/45","id":61026832,"html_url":"https://github.com/cs2103jan2016-v15-1j/main/pull/45","diff_url":"https://github.com/cs2103jan2016-v15-1j/main/pull/45.diff","patch_url":"https://github.com/cs2103jan2016-v15-1j/main/pull/45.patch","issue_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/issues/45","number":45,"state":"open","locked":false,"title":"Storage create method","user":{"login":"shaunthium","id":10166415,"avatar_url":"https://avatars.githubusercontent.com/u/10166415?v=3","gravatar_id":"","url":"https://api.github.com/users/shaunthium","html_url":"https://github.com/shaunthium","followers_url":"https://api.github.com/users/shaunthium/followers","following_url":"https://api.github.com/users/shaunthium/following{/other_user}","gists_url":"https://api.github.com/users/shaunthium/gists{/gist_id}","starred_url":"https://api.github.com/users/shaunthium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shaunthium/subscriptions","organizations_url":"https://api.github.com/users/shaunthium/orgs","repos_url":"https://api.github.com/users/shaunthium/repos","events_url":"https://api.github.com/users/shaunthium/events{/privacy}","received_events_url":"https://api.github.com/users/shaunthium/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-29T04:31:46Z","updated_at":"2016-03-07T07:47:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"27bcab90d6d688c587a63b017059de2f6b3a1b39","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/pulls/45/commits","review_comments_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/pulls/45/comments","review_comment_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/issues/45/comments","statuses_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/statuses/f9bcbb13bf5f52a9f976792a34874d46e060740f","head":{"label":"cs2103jan2016-v15-1j:storage-create","ref":"storage-create","sha":"f9bcbb13bf5f52a9f976792a34874d46e060740f","user":{"login":"cs2103jan2016-v15-1j","id":16968761,"avatar_url":"https://avatars.githubusercontent.com/u/16968761?v=3","gravatar_id":"","url":"https://api.github.com/users/cs2103jan2016-v15-1j","html_url":"https://github.com/cs2103jan2016-v15-1j","followers_url":"https://api.github.com/users/cs2103jan2016-v15-1j/followers","following_url":"https://api.github.com/users/cs2103jan2016-v15-1j/following{/other_user}","gists_url":"https://api.github.com/users/cs2103jan2016-v15-1j/gists{/gist_id}","starred_url":"https://api.github.com/users/cs2103jan2016-v15-1j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cs2103jan2016-v15-1j/subscriptions","organizations_url":"https://api.github.com/users/cs2103jan2016-v15-1j/orgs","repos_url":"https://api.github.com/users/cs2103jan2016-v15-1j/repos","events_url":"https://api.github.com/users/cs2103jan2016-v15-1j/events{/privacy}","received_events_url":"https://api.github.com/users/cs2103jan2016-v15-1j/received_events","type":"Organization","site_admin":false},"repo":{"id":50709878,"name":"main","full_name":"cs2103jan2016-v15-1j/main","owner":{"login":"cs2103jan2016-v15-1j","id":16968761,"avatar_url":"https://avatars.githubusercontent.com/u/16968761?v=3","gravatar_id":"","url":"https://api.github.com/users/cs2103jan2016-v15-1j","html_url":"https://github.com/cs2103jan2016-v15-1j","followers_url":"https://api.github.com/users/cs2103jan2016-v15-1j/followers","following_url":"https://api.github.com/users/cs2103jan2016-v15-1j/following{/other_user}","gists_url":"https://api.github.com/users/cs2103jan2016-v15-1j/gists{/gist_id}","starred_url":"https://api.github.com/users/cs2103jan2016-v15-1j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cs2103jan2016-v15-1j/subscriptions","organizations_url":"https://api.github.com/users/cs2103jan2016-v15-1j/orgs","repos_url":"https://api.github.com/users/cs2103jan2016-v15-1j/repos","events_url":"https://api.github.com/users/cs2103jan2016-v15-1j/events{/privacy}","received_events_url":"https://api.github.com/users/cs2103jan2016-v15-1j/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cs2103jan2016-v15-1j/main","description":"CS2103 project of team v15-1j","fork":false,"url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main","forks_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/forks","keys_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/teams","hooks_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/hooks","issue_events_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/issues/events{/number}","events_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/events","assignees_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/assignees{/user}","branches_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/branches{/branch}","tags_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/tags","blobs_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/git/refs{/sha}","trees_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/statuses/{sha}","languages_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/languages","stargazers_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/stargazers","contributors_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/contributors","subscribers_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/subscribers","subscription_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/subscription","commits_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/commits{/sha}","git_commits_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/git/commits{/sha}","comments_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/comments{/number}","issue_comment_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/issues/comments{/number}","contents_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/contents/{+path}","compare_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/merges","archive_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/downloads","issues_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/issues{/number}","pulls_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/pulls{/number}","milestones_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/milestones{/number}","notifications_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/labels{/name}","releases_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/releases{/id}","deployments_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/deployments","created_at":"2016-01-30T05:03:02Z","updated_at":"2016-02-25T16:01:20Z","pushed_at":"2016-03-07T07:41:02Z","git_url":"git://github.com/cs2103jan2016-v15-1j/main.git","ssh_url":"git@github.com:cs2103jan2016-v15-1j/main.git","clone_url":"https://github.com/cs2103jan2016-v15-1j/main.git","svn_url":"https://github.com/cs2103jan2016-v15-1j/main","homepage":null,"size":110,"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":37,"forks":0,"open_issues":37,"watchers":0,"default_branch":"master"}},"base":{"label":"cs2103jan2016-v15-1j:master","ref":"master","sha":"dc8a2c967bf1a5f02ead957348d1616869dfc7ad","user":{"login":"cs2103jan2016-v15-1j","id":16968761,"avatar_url":"https://avatars.githubusercontent.com/u/16968761?v=3","gravatar_id":"","url":"https://api.github.com/users/cs2103jan2016-v15-1j","html_url":"https://github.com/cs2103jan2016-v15-1j","followers_url":"https://api.github.com/users/cs2103jan2016-v15-1j/followers","following_url":"https://api.github.com/users/cs2103jan2016-v15-1j/following{/other_user}","gists_url":"https://api.github.com/users/cs2103jan2016-v15-1j/gists{/gist_id}","starred_url":"https://api.github.com/users/cs2103jan2016-v15-1j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cs2103jan2016-v15-1j/subscriptions","organizations_url":"https://api.github.com/users/cs2103jan2016-v15-1j/orgs","repos_url":"https://api.github.com/users/cs2103jan2016-v15-1j/repos","events_url":"https://api.github.com/users/cs2103jan2016-v15-1j/events{/privacy}","received_events_url":"https://api.github.com/users/cs2103jan2016-v15-1j/received_events","type":"Organization","site_admin":false},"repo":{"id":50709878,"name":"main","full_name":"cs2103jan2016-v15-1j/main","owner":{"login":"cs2103jan2016-v15-1j","id":16968761,"avatar_url":"https://avatars.githubusercontent.com/u/16968761?v=3","gravatar_id":"","url":"https://api.github.com/users/cs2103jan2016-v15-1j","html_url":"https://github.com/cs2103jan2016-v15-1j","followers_url":"https://api.github.com/users/cs2103jan2016-v15-1j/followers","following_url":"https://api.github.com/users/cs2103jan2016-v15-1j/following{/other_user}","gists_url":"https://api.github.com/users/cs2103jan2016-v15-1j/gists{/gist_id}","starred_url":"https://api.github.com/users/cs2103jan2016-v15-1j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cs2103jan2016-v15-1j/subscriptions","organizations_url":"https://api.github.com/users/cs2103jan2016-v15-1j/orgs","repos_url":"https://api.github.com/users/cs2103jan2016-v15-1j/repos","events_url":"https://api.github.com/users/cs2103jan2016-v15-1j/events{/privacy}","received_events_url":"https://api.github.com/users/cs2103jan2016-v15-1j/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cs2103jan2016-v15-1j/main","description":"CS2103 project of team v15-1j","fork":false,"url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main","forks_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/forks","keys_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/teams","hooks_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/hooks","issue_events_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/issues/events{/number}","events_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/events","assignees_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/assignees{/user}","branches_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/branches{/branch}","tags_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/tags","blobs_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/git/refs{/sha}","trees_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/statuses/{sha}","languages_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/languages","stargazers_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/stargazers","contributors_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/contributors","subscribers_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/subscribers","subscription_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/subscription","commits_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/commits{/sha}","git_commits_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/git/commits{/sha}","comments_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/comments{/number}","issue_comment_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/issues/comments{/number}","contents_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/contents/{+path}","compare_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/merges","archive_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/downloads","issues_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/issues{/number}","pulls_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/pulls{/number}","milestones_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/milestones{/number}","notifications_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/labels{/name}","releases_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/releases{/id}","deployments_url":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/deployments","created_at":"2016-01-30T05:03:02Z","updated_at":"2016-02-25T16:01:20Z","pushed_at":"2016-03-07T07:41:02Z","git_url":"git://github.com/cs2103jan2016-v15-1j/main.git","ssh_url":"git@github.com:cs2103jan2016-v15-1j/main.git","clone_url":"https://github.com/cs2103jan2016-v15-1j/main.git","svn_url":"https://github.com/cs2103jan2016-v15-1j/main","homepage":null,"size":110,"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":37,"forks":0,"open_issues":37,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/pulls/45"},"html":{"href":"https://github.com/cs2103jan2016-v15-1j/main/pull/45"},"issue":{"href":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/issues/45"},"comments":{"href":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/issues/45/comments"},"review_comments":{"href":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/pulls/45/comments"},"review_comment":{"href":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/pulls/45/commits"},"statuses":{"href":"https://api.github.com/repos/cs2103jan2016-v15-1j/main/statuses/f9bcbb13bf5f52a9f976792a34874d46e060740f"}}}}