{"action":"created","comment":{"url":"https://api.github.com/repos/JabRef/jabref/pulls/comments/56217406","id":56217406,"diff_hunk":"@@ -0,0 +1,121 @@\n+package net.sf.jabref.importer.fileformat;\n+\n+import java.io.InputStream;\n+import java.util.Arrays;\n+import java.util.List;\n+import net.sf.jabref.Globals;\n+import net.sf.jabref.JabRefPreferences;\n+import net.sf.jabref.importer.OutputPrinterToNull;\n+import net.sf.jabref.importer.fileformat.BiblioscapeImporter;\n+import net.sf.jabref.model.entry.BibEntry;\n+import org.junit.Assert;\n+import org.junit.Before;\n+import org.junit.Test;\n+\n+/*\n+ * Biblioscape Tag File with an example:\n+ * https://web.archive.org/web/20080820010408/http://www.biblioscape.com/manual_bsp/Biblioscape_Tag_File.htm\n+ */\n+\n+public class BiblioscapeImporterTest {\n+\n+    @Before\n+    public void setUp() throws Exception {\n+        if (Globals.prefs == null) {\n+            Globals.prefs = JabRefPreferences.getInstance();\n+        }\n+    }\n+\n+    @Test\n+    public void testGetFormatName() {\n+        BiblioscapeImporter importer = new BiblioscapeImporter();\n+        Assert.assertEquals(importer.getFormatName(), \"Biblioscape\");\n+    }\n+\n+    @Test\n+    public void testGetCLIID() {\n+        BiblioscapeImporter importer = new BiblioscapeImporter();\n+        Assert.assertEquals(importer.getCLIId(), \"biblioscape\");\n+    }\n+\n+    @Test\n+    public void testIsRecognizedFormat() throws Throwable {\n+        BiblioscapeImporter importer = new BiblioscapeImporter();\n+        List<String> list = Arrays.asList(\"BiblioscapeImporterTest.txt\", \"CopacImporterTest1.txt\",\n+                \"CopacImporterTest2.txt\", \"CopacImporterTest3.txt\", \"IEEEImport1.txt\", \"IsiImporterTest1.isi\",\n+                \"IsiImporterTestInspec.isi\", \"IsiImporterTestWOS.isi\", \"IsiImporterTestMedline.isi\",\n+                \"RisImporterTest1.ris\");\n+        for (String str : list) {\n+            try (InputStream is = BiblioscapeImporterTest.class.getResourceAsStream(str)) {\n+                    Assert.assertTrue(importer.isRecognizedFormat(is));\n+            }\n+        }\n+    }\n+\n+    @Test\n+    public void testImportEntries() throws Throwable {\n+        BiblioscapeImporter importer = new BiblioscapeImporter();\n+        BibtexImporter bibtexImporter = new BibtexImporter();\n+\n+        try (InputStream bScapeStream = BiblioscapeImporter.class.getResourceAsStream(\"BiblioscapeImporterTest.txt\");\n+                InputStream bibStream = BiblioscapeImporter.class\n+                        .getResourceAsStream(\"BiblioscapeImporterTest_comparefile.txt\")) {\n+            List<BibEntry> bScapeEntries = importer.importEntries(bScapeStream, new OutputPrinterToNull());\n+            List<BibEntry> bibEntries = bibtexImporter.importEntries(bibStream, new OutputPrinterToNull());\n+\n+            Assert.assertEquals(bScapeEntries.size(), bibEntries.size());\n+\n+            int c = 0;\n+            for (int i = 0; i < bScapeEntries.size(); i++) {\n+                for (int j = 0; j < bibEntries.size(); j++) {\n+                    BibEntry be1 = bScapeEntries.get(i);\n+                    BibEntry be2 = bibEntries.get(j);\n+                    if (be1.getField(\"isbn\").equals(be2.getField(\"isbn\"))) {\n+                        Assert.assertEquals(be1.getField(\"abstract\"), be2.getField(\"abstract\"));\n+                        Assert.assertEquals(be1.getField(\"address\"), be2.getField(\"address\"));\n+                        Assert.assertEquals(be1.getField(\"annote\"), be2.getField(\"annote\"));\n+                        Assert.assertEquals(be1.getField(\"author\"), be2.getField(\"author\"));\n+                        Assert.assertEquals(be1.getField(\"chapter\"), be2.getField(\"chapter\"));\n+                        Assert.assertEquals(be1.getField(\"edition\"), be2.getField(\"edition\"));\n+                        Assert.assertEquals(be1.getField(\"journal\"), be2.getField(\"journal\"));\n+                        Assert.assertEquals(be1.getField(\"note\"), be2.getField(\"note\"));\n+                        Assert.assertEquals(be1.getField(\"number\"), be2.getField(\"number\"));\n+                        Assert.assertEquals(be1.getField(\"pages\"), be2.getField(\"pages\"));\n+                        Assert.assertEquals(be1.getField(\"pdf\"), be2.getField(\"pdf\"));\n+                        Assert.assertEquals(be1.getField(\"publisher\"), be2.getField(\"publisher\"));\n+                        Assert.assertEquals(be1.getField(\"title\"), be2.getField(\"title\"));\n+                        Assert.assertEquals(be1.getField(\"url\"), be2.getField(\"url\"));\n+                        Assert.assertEquals(be1.getField(\"volume\"), be2.getField(\"volume\"));\n+                        Assert.assertEquals(be1.getField(\"year\"), be2.getField(\"year\"));\n+                        Assert.assertEquals(be1.getField(\"comment\"), be2.getField(\"comment\"));\n+\n+                        c++;\n+                    }\n+                }\n+            }\n+\n+            Assert.assertEquals(c, bScapeEntries.size());\n+\n+        }\n+\n+\n+        try (InputStream is = BiblioscapeImporter.class.getResourceAsStream(\"BiblioscapeImporterTest1.txt\")) {\n+            List<BibEntry> entries = importer.importEntries(is, new OutputPrinterToNull());\n+            Assert.assertEquals(17, entries.size());\n+\n+            for (int i = 0; i < entries.size(); i++) {\n+                // Extract the bibtex entry type\n+                BibEntry be = entries.get(i);\n+                String type = be.getField(\"note\").split(\": \")[1];","path":"src/test/java/net/sf/jabref/importer/fileformat/BiblioscapeImporterTest.java","position":null,"original_position":109,"commit_id":"658c059aed3eadecb4e9881cb5779f4e662d00ef","original_commit_id":"ab091ca2589da1ce95f575f4d68b3c01c33f4e86","user":{"login":"simonharrer","id":375693,"avatar_url":"https://avatars.githubusercontent.com/u/375693?v=3","gravatar_id":"","url":"https://api.github.com/users/simonharrer","html_url":"https://github.com/simonharrer","followers_url":"https://api.github.com/users/simonharrer/followers","following_url":"https://api.github.com/users/simonharrer/following{/other_user}","gists_url":"https://api.github.com/users/simonharrer/gists{/gist_id}","starred_url":"https://api.github.com/users/simonharrer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonharrer/subscriptions","organizations_url":"https://api.github.com/users/simonharrer/orgs","repos_url":"https://api.github.com/users/simonharrer/repos","events_url":"https://api.github.com/users/simonharrer/events{/privacy}","received_events_url":"https://api.github.com/users/simonharrer/received_events","type":"User","site_admin":false},"body":"Ok, but then the comparison scheme of the previous method can be reused as well, as one can also create a .bib file which matches the import, simplifying the test logic even further. ","created_at":"2016-03-15T18:37:00Z","updated_at":"2016-03-15T18:37:00Z","html_url":"https://github.com/JabRef/jabref/pull/504#discussion_r56217406","pull_request_url":"https://api.github.com/repos/JabRef/jabref/pulls/504","_links":{"self":{"href":"https://api.github.com/repos/JabRef/jabref/pulls/comments/56217406"},"html":{"href":"https://github.com/JabRef/jabref/pull/504#discussion_r56217406"},"pull_request":{"href":"https://api.github.com/repos/JabRef/jabref/pulls/504"}}},"pull_request":{"url":"https://api.github.com/repos/JabRef/jabref/pulls/504","id":53489834,"html_url":"https://github.com/JabRef/jabref/pull/504","diff_url":"https://github.com/JabRef/jabref/pull/504.diff","patch_url":"https://github.com/JabRef/jabref/pull/504.patch","issue_url":"https://api.github.com/repos/JabRef/jabref/issues/504","number":504,"state":"open","locked":false,"title":"BiblioscapeImporterTest","user":{"login":"obraliar","id":15609468,"avatar_url":"https://avatars.githubusercontent.com/u/15609468?v=3","gravatar_id":"","url":"https://api.github.com/users/obraliar","html_url":"https://github.com/obraliar","followers_url":"https://api.github.com/users/obraliar/followers","following_url":"https://api.github.com/users/obraliar/following{/other_user}","gists_url":"https://api.github.com/users/obraliar/gists{/gist_id}","starred_url":"https://api.github.com/users/obraliar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obraliar/subscriptions","organizations_url":"https://api.github.com/users/obraliar/orgs","repos_url":"https://api.github.com/users/obraliar/repos","events_url":"https://api.github.com/users/obraliar/events{/privacy}","received_events_url":"https://api.github.com/users/obraliar/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-13T00:54:23Z","updated_at":"2016-03-15T18:37:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5ce40ec8f7c0027cd4a4543a9e1f089ece255ea8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JabRef/jabref/pulls/504/commits","review_comments_url":"https://api.github.com/repos/JabRef/jabref/pulls/504/comments","review_comment_url":"https://api.github.com/repos/JabRef/jabref/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JabRef/jabref/issues/504/comments","statuses_url":"https://api.github.com/repos/JabRef/jabref/statuses/658c059aed3eadecb4e9881cb5779f4e662d00ef","head":{"label":"obraliar:BiblioscapeImporterTest","ref":"BiblioscapeImporterTest","sha":"658c059aed3eadecb4e9881cb5779f4e662d00ef","user":{"login":"obraliar","id":15609468,"avatar_url":"https://avatars.githubusercontent.com/u/15609468?v=3","gravatar_id":"","url":"https://api.github.com/users/obraliar","html_url":"https://github.com/obraliar","followers_url":"https://api.github.com/users/obraliar/followers","following_url":"https://api.github.com/users/obraliar/following{/other_user}","gists_url":"https://api.github.com/users/obraliar/gists{/gist_id}","starred_url":"https://api.github.com/users/obraliar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obraliar/subscriptions","organizations_url":"https://api.github.com/users/obraliar/orgs","repos_url":"https://api.github.com/users/obraliar/repos","events_url":"https://api.github.com/users/obraliar/events{/privacy}","received_events_url":"https://api.github.com/users/obraliar/received_events","type":"User","site_admin":false},"repo":{"id":47899956,"name":"jabref","full_name":"obraliar/jabref","owner":{"login":"obraliar","id":15609468,"avatar_url":"https://avatars.githubusercontent.com/u/15609468?v=3","gravatar_id":"","url":"https://api.github.com/users/obraliar","html_url":"https://github.com/obraliar","followers_url":"https://api.github.com/users/obraliar/followers","following_url":"https://api.github.com/users/obraliar/following{/other_user}","gists_url":"https://api.github.com/users/obraliar/gists{/gist_id}","starred_url":"https://api.github.com/users/obraliar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obraliar/subscriptions","organizations_url":"https://api.github.com/users/obraliar/orgs","repos_url":"https://api.github.com/users/obraliar/repos","events_url":"https://api.github.com/users/obraliar/events{/privacy}","received_events_url":"https://api.github.com/users/obraliar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/obraliar/jabref","description":"Graphical Java application for managing bibtex (.bib) databases","fork":true,"url":"https://api.github.com/repos/obraliar/jabref","forks_url":"https://api.github.com/repos/obraliar/jabref/forks","keys_url":"https://api.github.com/repos/obraliar/jabref/keys{/key_id}","collaborators_url":"https://api.github.com/repos/obraliar/jabref/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/obraliar/jabref/teams","hooks_url":"https://api.github.com/repos/obraliar/jabref/hooks","issue_events_url":"https://api.github.com/repos/obraliar/jabref/issues/events{/number}","events_url":"https://api.github.com/repos/obraliar/jabref/events","assignees_url":"https://api.github.com/repos/obraliar/jabref/assignees{/user}","branches_url":"https://api.github.com/repos/obraliar/jabref/branches{/branch}","tags_url":"https://api.github.com/repos/obraliar/jabref/tags","blobs_url":"https://api.github.com/repos/obraliar/jabref/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/obraliar/jabref/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/obraliar/jabref/git/refs{/sha}","trees_url":"https://api.github.com/repos/obraliar/jabref/git/trees{/sha}","statuses_url":"https://api.github.com/repos/obraliar/jabref/statuses/{sha}","languages_url":"https://api.github.com/repos/obraliar/jabref/languages","stargazers_url":"https://api.github.com/repos/obraliar/jabref/stargazers","contributors_url":"https://api.github.com/repos/obraliar/jabref/contributors","subscribers_url":"https://api.github.com/repos/obraliar/jabref/subscribers","subscription_url":"https://api.github.com/repos/obraliar/jabref/subscription","commits_url":"https://api.github.com/repos/obraliar/jabref/commits{/sha}","git_commits_url":"https://api.github.com/repos/obraliar/jabref/git/commits{/sha}","comments_url":"https://api.github.com/repos/obraliar/jabref/comments{/number}","issue_comment_url":"https://api.github.com/repos/obraliar/jabref/issues/comments{/number}","contents_url":"https://api.github.com/repos/obraliar/jabref/contents/{+path}","compare_url":"https://api.github.com/repos/obraliar/jabref/compare/{base}...{head}","merges_url":"https://api.github.com/repos/obraliar/jabref/merges","archive_url":"https://api.github.com/repos/obraliar/jabref/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/obraliar/jabref/downloads","issues_url":"https://api.github.com/repos/obraliar/jabref/issues{/number}","pulls_url":"https://api.github.com/repos/obraliar/jabref/pulls{/number}","milestones_url":"https://api.github.com/repos/obraliar/jabref/milestones{/number}","notifications_url":"https://api.github.com/repos/obraliar/jabref/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/obraliar/jabref/labels{/name}","releases_url":"https://api.github.com/repos/obraliar/jabref/releases{/id}","deployments_url":"https://api.github.com/repos/obraliar/jabref/deployments","created_at":"2015-12-13T00:19:54Z","updated_at":"2016-01-12T22:43:39Z","pushed_at":"2016-03-15T17:12:01Z","git_url":"git://github.com/obraliar/jabref.git","ssh_url":"git@github.com:obraliar/jabref.git","clone_url":"https://github.com/obraliar/jabref.git","svn_url":"https://github.com/obraliar/jabref","homepage":"http://www.jabref.org/","size":80270,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"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":"master"}},"base":{"label":"JabRef:master","ref":"master","sha":"7befb088babd5c56277cfb6c2bf86ca5b810268e","user":{"login":"JabRef","id":3914421,"avatar_url":"https://avatars.githubusercontent.com/u/3914421?v=3","gravatar_id":"","url":"https://api.github.com/users/JabRef","html_url":"https://github.com/JabRef","followers_url":"https://api.github.com/users/JabRef/followers","following_url":"https://api.github.com/users/JabRef/following{/other_user}","gists_url":"https://api.github.com/users/JabRef/gists{/gist_id}","starred_url":"https://api.github.com/users/JabRef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JabRef/subscriptions","organizations_url":"https://api.github.com/users/JabRef/orgs","repos_url":"https://api.github.com/users/JabRef/repos","events_url":"https://api.github.com/users/JabRef/events{/privacy}","received_events_url":"https://api.github.com/users/JabRef/received_events","type":"Organization","site_admin":false},"repo":{"id":17634071,"name":"jabref","full_name":"JabRef/jabref","owner":{"login":"JabRef","id":3914421,"avatar_url":"https://avatars.githubusercontent.com/u/3914421?v=3","gravatar_id":"","url":"https://api.github.com/users/JabRef","html_url":"https://github.com/JabRef","followers_url":"https://api.github.com/users/JabRef/followers","following_url":"https://api.github.com/users/JabRef/following{/other_user}","gists_url":"https://api.github.com/users/JabRef/gists{/gist_id}","starred_url":"https://api.github.com/users/JabRef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JabRef/subscriptions","organizations_url":"https://api.github.com/users/JabRef/orgs","repos_url":"https://api.github.com/users/JabRef/repos","events_url":"https://api.github.com/users/JabRef/events{/privacy}","received_events_url":"https://api.github.com/users/JabRef/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JabRef/jabref","description":"Graphical Java application for managing bibtex (.bib) databases","fork":false,"url":"https://api.github.com/repos/JabRef/jabref","forks_url":"https://api.github.com/repos/JabRef/jabref/forks","keys_url":"https://api.github.com/repos/JabRef/jabref/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JabRef/jabref/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JabRef/jabref/teams","hooks_url":"https://api.github.com/repos/JabRef/jabref/hooks","issue_events_url":"https://api.github.com/repos/JabRef/jabref/issues/events{/number}","events_url":"https://api.github.com/repos/JabRef/jabref/events","assignees_url":"https://api.github.com/repos/JabRef/jabref/assignees{/user}","branches_url":"https://api.github.com/repos/JabRef/jabref/branches{/branch}","tags_url":"https://api.github.com/repos/JabRef/jabref/tags","blobs_url":"https://api.github.com/repos/JabRef/jabref/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JabRef/jabref/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JabRef/jabref/git/refs{/sha}","trees_url":"https://api.github.com/repos/JabRef/jabref/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JabRef/jabref/statuses/{sha}","languages_url":"https://api.github.com/repos/JabRef/jabref/languages","stargazers_url":"https://api.github.com/repos/JabRef/jabref/stargazers","contributors_url":"https://api.github.com/repos/JabRef/jabref/contributors","subscribers_url":"https://api.github.com/repos/JabRef/jabref/subscribers","subscription_url":"https://api.github.com/repos/JabRef/jabref/subscription","commits_url":"https://api.github.com/repos/JabRef/jabref/commits{/sha}","git_commits_url":"https://api.github.com/repos/JabRef/jabref/git/commits{/sha}","comments_url":"https://api.github.com/repos/JabRef/jabref/comments{/number}","issue_comment_url":"https://api.github.com/repos/JabRef/jabref/issues/comments{/number}","contents_url":"https://api.github.com/repos/JabRef/jabref/contents/{+path}","compare_url":"https://api.github.com/repos/JabRef/jabref/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JabRef/jabref/merges","archive_url":"https://api.github.com/repos/JabRef/jabref/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JabRef/jabref/downloads","issues_url":"https://api.github.com/repos/JabRef/jabref/issues{/number}","pulls_url":"https://api.github.com/repos/JabRef/jabref/pulls{/number}","milestones_url":"https://api.github.com/repos/JabRef/jabref/milestones{/number}","notifications_url":"https://api.github.com/repos/JabRef/jabref/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JabRef/jabref/labels{/name}","releases_url":"https://api.github.com/repos/JabRef/jabref/releases{/id}","deployments_url":"https://api.github.com/repos/JabRef/jabref/deployments","created_at":"2014-03-11T14:48:42Z","updated_at":"2016-03-07T09:03:30Z","pushed_at":"2016-03-15T17:53:36Z","git_url":"git://github.com/JabRef/jabref.git","ssh_url":"git@github.com:JabRef/jabref.git","clone_url":"https://github.com/JabRef/jabref.git","svn_url":"https://github.com/JabRef/jabref","homepage":"http://www.jabref.org/","size":83632,"stargazers_count":240,"watchers_count":240,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":159,"mirror_url":null,"open_issues_count":167,"forks":159,"open_issues":167,"watchers":240,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JabRef/jabref/pulls/504"},"html":{"href":"https://github.com/JabRef/jabref/pull/504"},"issue":{"href":"https://api.github.com/repos/JabRef/jabref/issues/504"},"comments":{"href":"https://api.github.com/repos/JabRef/jabref/issues/504/comments"},"review_comments":{"href":"https://api.github.com/repos/JabRef/jabref/pulls/504/comments"},"review_comment":{"href":"https://api.github.com/repos/JabRef/jabref/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JabRef/jabref/pulls/504/commits"},"statuses":{"href":"https://api.github.com/repos/JabRef/jabref/statuses/658c059aed3eadecb4e9881cb5779f4e662d00ef"}}}}