{"action":"created","comment":{"url":"https://api.github.com/repos/novoda/sqlite-analyzer/pulls/comments/62195871","id":62195871,"diff_hunk":"@@ -0,0 +1,96 @@\n+package com.novoda.sqlite.impl;\n+\n+import java.io.IOException;\n+import java.io.StringReader;\n+import java.util.List;\n+\n+import org.junit.Test;\n+\n+import static org.junit.Assert.assertArrayEquals;\n+import static org.junit.Assert.assertEquals;\n+\n+public class SQLFileTest {\n+    private final static String STATEMENT_CREATE_TABLE = \"CREATE TABLE banana(_id INTEGER);\";\n+    private final static String STATEMENT_ALTER_TABLE = \"ALTER TABLE banana ADD COLUMN colour TEXT;\";\n+    private final static String NEW_LINE = \"\\n\";\n+    private final static String SPACE = \" \";\n+    private final static String[] EXPECTED_STATEMENTS = new String[]{STATEMENT_CREATE_TABLE, STATEMENT_ALTER_TABLE};\n+    private final static String LINE_COMMENT = \"-- this is a line comment\";\n+    private static final String BLOCK_COMMENT = \"/* this is a \\n block comment \\n spanning over \\n multiple lines */\";\n+    private final static String STATEMENT_FOR_COMMENTS_WITHIN_TESTS_1 = \"CREATE TABLE\";\n+    private final static String STATEMENT_FOR_COMMENTS_WITHIN_TESTS_2 = \"banana(_id INTEGER);\";\n+\n+    @Test\n+    public void givenSQLFile_whenParseAndGetStatements_thenGetCorrectStatements() throws IOException {\n+        SQLFile file = givenSQLFileParsedFromString(STATEMENT_CREATE_TABLE + NEW_LINE + STATEMENT_ALTER_TABLE);\n+\n+        String[] actual = getStatementsFromFile(file);\n+\n+        assertArrayEquals(actual, EXPECTED_STATEMENTS);","path":"analyzer/src/test/java/com/novoda/sqlite/impl/SQLFileTest.java","position":29,"original_position":29,"commit_id":"1fdb609db17f50381c5f37ad819a4765c841d40a","original_commit_id":"f7dad9e1e0332f27d8006cb087416d6dd44a9925","user":{"login":"frapontillo","id":1140238,"avatar_url":"https://avatars.githubusercontent.com/u/1140238?v=3","gravatar_id":"","url":"https://api.github.com/users/frapontillo","html_url":"https://github.com/frapontillo","followers_url":"https://api.github.com/users/frapontillo/followers","following_url":"https://api.github.com/users/frapontillo/following{/other_user}","gists_url":"https://api.github.com/users/frapontillo/gists{/gist_id}","starred_url":"https://api.github.com/users/frapontillo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frapontillo/subscriptions","organizations_url":"https://api.github.com/users/frapontillo/orgs","repos_url":"https://api.github.com/users/frapontillo/repos","events_url":"https://api.github.com/users/frapontillo/events{/privacy}","received_events_url":"https://api.github.com/users/frapontillo/received_events","type":"User","site_admin":false},"body":"Not currently available in the repo.","created_at":"2016-05-05T14:38:15Z","updated_at":"2016-05-05T14:38:15Z","html_url":"https://github.com/novoda/sqlite-analyzer/pull/48#discussion_r62195871","pull_request_url":"https://api.github.com/repos/novoda/sqlite-analyzer/pulls/48","_links":{"self":{"href":"https://api.github.com/repos/novoda/sqlite-analyzer/pulls/comments/62195871"},"html":{"href":"https://github.com/novoda/sqlite-analyzer/pull/48#discussion_r62195871"},"pull_request":{"href":"https://api.github.com/repos/novoda/sqlite-analyzer/pulls/48"}}},"pull_request":{"url":"https://api.github.com/repos/novoda/sqlite-analyzer/pulls/48","id":69009060,"html_url":"https://github.com/novoda/sqlite-analyzer/pull/48","diff_url":"https://github.com/novoda/sqlite-analyzer/pull/48.diff","patch_url":"https://github.com/novoda/sqlite-analyzer/pull/48.patch","issue_url":"https://api.github.com/repos/novoda/sqlite-analyzer/issues/48","number":48,"state":"open","locked":false,"title":"Test SQLFile with all the possible (handled) use cases","user":{"login":"frapontillo","id":1140238,"avatar_url":"https://avatars.githubusercontent.com/u/1140238?v=3","gravatar_id":"","url":"https://api.github.com/users/frapontillo","html_url":"https://github.com/frapontillo","followers_url":"https://api.github.com/users/frapontillo/followers","following_url":"https://api.github.com/users/frapontillo/following{/other_user}","gists_url":"https://api.github.com/users/frapontillo/gists{/gist_id}","starred_url":"https://api.github.com/users/frapontillo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frapontillo/subscriptions","organizations_url":"https://api.github.com/users/frapontillo/orgs","repos_url":"https://api.github.com/users/frapontillo/repos","events_url":"https://api.github.com/users/frapontillo/events{/privacy}","received_events_url":"https://api.github.com/users/frapontillo/received_events","type":"User","site_admin":false},"body":"#### Problem\r\n\r\n`SQLFile` handles a good part of the library behaviour, collecting all the statements needed to build the in-memory database. That database is later needed to generate the access Java classes.\r\n\r\nIf SQL files are incorrectly parsed, the generated classes won't match.\r\n\r\n#### Solution\r\n\r\nThis PR adds the `SQLFileTest` spec, defining all of the handled use cases:\r\n\r\n- middle case, two statements separated by a new line char\r\n- edge case, two statements surrounded by spaces\r\n- edge case, two statements separated by line comments\r\n- edge case, two statements separated by block comments\r\n- edge case, a statement with line comments in it\r\n- edge case, a statement with block comments in it\r\n\r\n##### Test(s) added \r\n\r\nDuh\r\n\r\n##### Screenshots\r\n\r\nNOPE\r\n\r\n###### Paired with \r\n\r\n/foreveralone","created_at":"2016-05-05T13:48:33Z","updated_at":"2016-05-05T14:38:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0ee541cd678332c6bcb07c482d70fb9a7c75a76d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/novoda/sqlite-analyzer/pulls/48/commits","review_comments_url":"https://api.github.com/repos/novoda/sqlite-analyzer/pulls/48/comments","review_comment_url":"https://api.github.com/repos/novoda/sqlite-analyzer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/novoda/sqlite-analyzer/issues/48/comments","statuses_url":"https://api.github.com/repos/novoda/sqlite-analyzer/statuses/1fdb609db17f50381c5f37ad819a4765c841d40a","head":{"label":"novoda:Test_SQL_file_parsing","ref":"Test_SQL_file_parsing","sha":"1fdb609db17f50381c5f37ad819a4765c841d40a","user":{"login":"novoda","id":74874,"avatar_url":"https://avatars.githubusercontent.com/u/74874?v=3","gravatar_id":"","url":"https://api.github.com/users/novoda","html_url":"https://github.com/novoda","followers_url":"https://api.github.com/users/novoda/followers","following_url":"https://api.github.com/users/novoda/following{/other_user}","gists_url":"https://api.github.com/users/novoda/gists{/gist_id}","starred_url":"https://api.github.com/users/novoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/novoda/subscriptions","organizations_url":"https://api.github.com/users/novoda/orgs","repos_url":"https://api.github.com/users/novoda/repos","events_url":"https://api.github.com/users/novoda/events{/privacy}","received_events_url":"https://api.github.com/users/novoda/received_events","type":"Organization","site_admin":false},"repo":{"id":16004885,"name":"sqlite-analyzer","full_name":"novoda/sqlite-analyzer","owner":{"login":"novoda","id":74874,"avatar_url":"https://avatars.githubusercontent.com/u/74874?v=3","gravatar_id":"","url":"https://api.github.com/users/novoda","html_url":"https://github.com/novoda","followers_url":"https://api.github.com/users/novoda/followers","following_url":"https://api.github.com/users/novoda/following{/other_user}","gists_url":"https://api.github.com/users/novoda/gists{/gist_id}","starred_url":"https://api.github.com/users/novoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/novoda/subscriptions","organizations_url":"https://api.github.com/users/novoda/orgs","repos_url":"https://api.github.com/users/novoda/repos","events_url":"https://api.github.com/users/novoda/events{/privacy}","received_events_url":"https://api.github.com/users/novoda/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/novoda/sqlite-analyzer","description":"Code generation for Java/Android database access.","fork":false,"url":"https://api.github.com/repos/novoda/sqlite-analyzer","forks_url":"https://api.github.com/repos/novoda/sqlite-analyzer/forks","keys_url":"https://api.github.com/repos/novoda/sqlite-analyzer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/novoda/sqlite-analyzer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/novoda/sqlite-analyzer/teams","hooks_url":"https://api.github.com/repos/novoda/sqlite-analyzer/hooks","issue_events_url":"https://api.github.com/repos/novoda/sqlite-analyzer/issues/events{/number}","events_url":"https://api.github.com/repos/novoda/sqlite-analyzer/events","assignees_url":"https://api.github.com/repos/novoda/sqlite-analyzer/assignees{/user}","branches_url":"https://api.github.com/repos/novoda/sqlite-analyzer/branches{/branch}","tags_url":"https://api.github.com/repos/novoda/sqlite-analyzer/tags","blobs_url":"https://api.github.com/repos/novoda/sqlite-analyzer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/novoda/sqlite-analyzer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/novoda/sqlite-analyzer/git/refs{/sha}","trees_url":"https://api.github.com/repos/novoda/sqlite-analyzer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/novoda/sqlite-analyzer/statuses/{sha}","languages_url":"https://api.github.com/repos/novoda/sqlite-analyzer/languages","stargazers_url":"https://api.github.com/repos/novoda/sqlite-analyzer/stargazers","contributors_url":"https://api.github.com/repos/novoda/sqlite-analyzer/contributors","subscribers_url":"https://api.github.com/repos/novoda/sqlite-analyzer/subscribers","subscription_url":"https://api.github.com/repos/novoda/sqlite-analyzer/subscription","commits_url":"https://api.github.com/repos/novoda/sqlite-analyzer/commits{/sha}","git_commits_url":"https://api.github.com/repos/novoda/sqlite-analyzer/git/commits{/sha}","comments_url":"https://api.github.com/repos/novoda/sqlite-analyzer/comments{/number}","issue_comment_url":"https://api.github.com/repos/novoda/sqlite-analyzer/issues/comments{/number}","contents_url":"https://api.github.com/repos/novoda/sqlite-analyzer/contents/{+path}","compare_url":"https://api.github.com/repos/novoda/sqlite-analyzer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/novoda/sqlite-analyzer/merges","archive_url":"https://api.github.com/repos/novoda/sqlite-analyzer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/novoda/sqlite-analyzer/downloads","issues_url":"https://api.github.com/repos/novoda/sqlite-analyzer/issues{/number}","pulls_url":"https://api.github.com/repos/novoda/sqlite-analyzer/pulls{/number}","milestones_url":"https://api.github.com/repos/novoda/sqlite-analyzer/milestones{/number}","notifications_url":"https://api.github.com/repos/novoda/sqlite-analyzer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/novoda/sqlite-analyzer/labels{/name}","releases_url":"https://api.github.com/repos/novoda/sqlite-analyzer/releases{/id}","deployments_url":"https://api.github.com/repos/novoda/sqlite-analyzer/deployments","created_at":"2014-01-17T16:27:22Z","updated_at":"2016-04-14T11:50:37Z","pushed_at":"2016-05-05T14:32:51Z","git_url":"git://github.com/novoda/sqlite-analyzer.git","ssh_url":"git@github.com:novoda/sqlite-analyzer.git","clone_url":"https://github.com/novoda/sqlite-analyzer.git","svn_url":"https://github.com/novoda/sqlite-analyzer","homepage":"","size":4932,"stargazers_count":56,"watchers_count":56,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":6,"mirror_url":null,"open_issues_count":8,"forks":6,"open_issues":8,"watchers":56,"default_branch":"master"}},"base":{"label":"novoda:master","ref":"master","sha":"5c4e0beeefa58b60908d4d948a3bb7e0b2b16bc4","user":{"login":"novoda","id":74874,"avatar_url":"https://avatars.githubusercontent.com/u/74874?v=3","gravatar_id":"","url":"https://api.github.com/users/novoda","html_url":"https://github.com/novoda","followers_url":"https://api.github.com/users/novoda/followers","following_url":"https://api.github.com/users/novoda/following{/other_user}","gists_url":"https://api.github.com/users/novoda/gists{/gist_id}","starred_url":"https://api.github.com/users/novoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/novoda/subscriptions","organizations_url":"https://api.github.com/users/novoda/orgs","repos_url":"https://api.github.com/users/novoda/repos","events_url":"https://api.github.com/users/novoda/events{/privacy}","received_events_url":"https://api.github.com/users/novoda/received_events","type":"Organization","site_admin":false},"repo":{"id":16004885,"name":"sqlite-analyzer","full_name":"novoda/sqlite-analyzer","owner":{"login":"novoda","id":74874,"avatar_url":"https://avatars.githubusercontent.com/u/74874?v=3","gravatar_id":"","url":"https://api.github.com/users/novoda","html_url":"https://github.com/novoda","followers_url":"https://api.github.com/users/novoda/followers","following_url":"https://api.github.com/users/novoda/following{/other_user}","gists_url":"https://api.github.com/users/novoda/gists{/gist_id}","starred_url":"https://api.github.com/users/novoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/novoda/subscriptions","organizations_url":"https://api.github.com/users/novoda/orgs","repos_url":"https://api.github.com/users/novoda/repos","events_url":"https://api.github.com/users/novoda/events{/privacy}","received_events_url":"https://api.github.com/users/novoda/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/novoda/sqlite-analyzer","description":"Code generation for Java/Android database access.","fork":false,"url":"https://api.github.com/repos/novoda/sqlite-analyzer","forks_url":"https://api.github.com/repos/novoda/sqlite-analyzer/forks","keys_url":"https://api.github.com/repos/novoda/sqlite-analyzer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/novoda/sqlite-analyzer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/novoda/sqlite-analyzer/teams","hooks_url":"https://api.github.com/repos/novoda/sqlite-analyzer/hooks","issue_events_url":"https://api.github.com/repos/novoda/sqlite-analyzer/issues/events{/number}","events_url":"https://api.github.com/repos/novoda/sqlite-analyzer/events","assignees_url":"https://api.github.com/repos/novoda/sqlite-analyzer/assignees{/user}","branches_url":"https://api.github.com/repos/novoda/sqlite-analyzer/branches{/branch}","tags_url":"https://api.github.com/repos/novoda/sqlite-analyzer/tags","blobs_url":"https://api.github.com/repos/novoda/sqlite-analyzer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/novoda/sqlite-analyzer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/novoda/sqlite-analyzer/git/refs{/sha}","trees_url":"https://api.github.com/repos/novoda/sqlite-analyzer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/novoda/sqlite-analyzer/statuses/{sha}","languages_url":"https://api.github.com/repos/novoda/sqlite-analyzer/languages","stargazers_url":"https://api.github.com/repos/novoda/sqlite-analyzer/stargazers","contributors_url":"https://api.github.com/repos/novoda/sqlite-analyzer/contributors","subscribers_url":"https://api.github.com/repos/novoda/sqlite-analyzer/subscribers","subscription_url":"https://api.github.com/repos/novoda/sqlite-analyzer/subscription","commits_url":"https://api.github.com/repos/novoda/sqlite-analyzer/commits{/sha}","git_commits_url":"https://api.github.com/repos/novoda/sqlite-analyzer/git/commits{/sha}","comments_url":"https://api.github.com/repos/novoda/sqlite-analyzer/comments{/number}","issue_comment_url":"https://api.github.com/repos/novoda/sqlite-analyzer/issues/comments{/number}","contents_url":"https://api.github.com/repos/novoda/sqlite-analyzer/contents/{+path}","compare_url":"https://api.github.com/repos/novoda/sqlite-analyzer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/novoda/sqlite-analyzer/merges","archive_url":"https://api.github.com/repos/novoda/sqlite-analyzer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/novoda/sqlite-analyzer/downloads","issues_url":"https://api.github.com/repos/novoda/sqlite-analyzer/issues{/number}","pulls_url":"https://api.github.com/repos/novoda/sqlite-analyzer/pulls{/number}","milestones_url":"https://api.github.com/repos/novoda/sqlite-analyzer/milestones{/number}","notifications_url":"https://api.github.com/repos/novoda/sqlite-analyzer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/novoda/sqlite-analyzer/labels{/name}","releases_url":"https://api.github.com/repos/novoda/sqlite-analyzer/releases{/id}","deployments_url":"https://api.github.com/repos/novoda/sqlite-analyzer/deployments","created_at":"2014-01-17T16:27:22Z","updated_at":"2016-04-14T11:50:37Z","pushed_at":"2016-05-05T14:32:51Z","git_url":"git://github.com/novoda/sqlite-analyzer.git","ssh_url":"git@github.com:novoda/sqlite-analyzer.git","clone_url":"https://github.com/novoda/sqlite-analyzer.git","svn_url":"https://github.com/novoda/sqlite-analyzer","homepage":"","size":4932,"stargazers_count":56,"watchers_count":56,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":6,"mirror_url":null,"open_issues_count":8,"forks":6,"open_issues":8,"watchers":56,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/novoda/sqlite-analyzer/pulls/48"},"html":{"href":"https://github.com/novoda/sqlite-analyzer/pull/48"},"issue":{"href":"https://api.github.com/repos/novoda/sqlite-analyzer/issues/48"},"comments":{"href":"https://api.github.com/repos/novoda/sqlite-analyzer/issues/48/comments"},"review_comments":{"href":"https://api.github.com/repos/novoda/sqlite-analyzer/pulls/48/comments"},"review_comment":{"href":"https://api.github.com/repos/novoda/sqlite-analyzer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/novoda/sqlite-analyzer/pulls/48/commits"},"statuses":{"href":"https://api.github.com/repos/novoda/sqlite-analyzer/statuses/1fdb609db17f50381c5f37ad819a4765c841d40a"}}}}