From 3c5e6638a905da86a4254169e53e8f6040ecd5df Mon Sep 17 00:00:00 2001 From: Sascha Zeller Date: Fri, 15 Apr 2016 10:56:31 +0200 Subject: [PATCH] BibTeXMLImporterTest (#511) Test BibTeXMLImporter - Remove other field from BibTeXMLHandler - Add .gitignore for backup files ending with '~' --- .gitignore | 2 + .../jabref/importer/ImportFormatReader.java | 2 +- .../importer/fileformat/BibTeXMLHandler.java | 62 ++++++------- ...XMLImporter.java => BibTeXMLImporter.java} | 6 +- .../fileformat/BibTeXMLImporterTest.java | 93 +++++++++++++++++++ .../fileformat/BibTeXMLImporterTestFiles.java | 81 ++++++++++++++++ .../fileformat/BibTeXMLImporterTestTypes.java | 70 ++++++++++++++ .../BibTeXMLImporterTestArticle.bib | 11 +++ .../BibTeXMLImporterTestArticle.xml | 14 +++ .../BibTeXMLImporterTestArticle2.xml | 14 +++ .../BibTeXMLImporterTestArticleWithoutID.bib | 11 +++ .../BibTeXMLImporterTestArticleWithoutID.xml | 14 +++ .../fileformat/BibTeXMLImporterTestBook.bib | 11 +++ .../fileformat/BibTeXMLImporterTestBook.xml | 14 +++ .../BibTeXMLImporterTestBooklet.bib | 10 ++ .../BibTeXMLImporterTestBooklet.xml | 13 +++ .../BibTeXMLImporterTestConference.bib | 18 ++++ .../fileformat/BibTeXMLImporterTestEmpty.xml | 4 + .../fileformat/BibTeXMLImporterTestInBook.bib | 13 +++ .../fileformat/BibTeXMLImporterTestInBook.xml | 16 ++++ .../BibTeXMLImporterTestInCollection.bib | 16 ++++ .../BibTeXMLImporterTestInCollection.xml | 19 ++++ .../BibTeXMLImporterTestInProceedings.bib | 12 +++ .../BibTeXMLImporterTestInProceedings.xml | 15 +++ .../fileformat/BibTeXMLImporterTestManual.bib | 11 +++ .../fileformat/BibTeXMLImporterTestManual.xml | 14 +++ .../BibTeXMLImporterTestMasterThesis.bib | 12 +++ .../BibTeXMLImporterTestMasterThesis.xml | 15 +++ .../fileformat/BibTeXMLImporterTestMisc.bib | 10 ++ .../fileformat/BibTeXMLImporterTestMisc.xml | 13 +++ .../BibTeXMLImporterTestPhdThesis.bib | 12 +++ .../BibTeXMLImporterTestPhdThesis.xml | 15 +++ .../BibTeXMLImporterTestProceedings.bib | 11 +++ .../BibTeXMLImporterTestProceedings.xml | 14 +++ .../BibTeXMLImporterTestTechReport.bib | 12 +++ .../BibTeXMLImporterTestTechReport.xml | 17 ++++ .../BibTeXMLImporterTestUnpublished.bib | 9 ++ .../BibTeXMLImporterTestUnpublished.xml | 12 +++ 38 files changed, 682 insertions(+), 36 deletions(-) rename src/main/java/net/sf/jabref/importer/fileformat/{BibteXMLImporter.java => BibTeXMLImporter.java} (96%) create mode 100644 src/test/java/net/sf/jabref/importer/fileformat/BibTeXMLImporterTest.java create mode 100644 src/test/java/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestFiles.java create mode 100644 src/test/java/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestTypes.java create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestArticle.bib create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestArticle.xml create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestArticle2.xml create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestArticleWithoutID.bib create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestArticleWithoutID.xml create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestBook.bib create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestBook.xml create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestBooklet.bib create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestBooklet.xml create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestConference.bib create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestEmpty.xml create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInBook.bib create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInBook.xml create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInCollection.bib create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInCollection.xml create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInProceedings.bib create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInProceedings.xml create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestManual.bib create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestManual.xml create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestMasterThesis.bib create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestMasterThesis.xml create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestMisc.bib create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestMisc.xml create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestPhdThesis.bib create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestPhdThesis.xml create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestProceedings.bib create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestProceedings.xml create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestTechReport.bib create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestTechReport.xml create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestUnpublished.bib create mode 100644 src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestUnpublished.xml diff --git a/.gitignore b/.gitignore index 65484d18d1e..255904bcfe7 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ src/main/gen/ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err* +# backup files +*~ # backup files from JabRef itself *.bak diff --git a/src/main/java/net/sf/jabref/importer/ImportFormatReader.java b/src/main/java/net/sf/jabref/importer/ImportFormatReader.java index 68bee96588a..f1c72d61f7e 100644 --- a/src/main/java/net/sf/jabref/importer/ImportFormatReader.java +++ b/src/main/java/net/sf/jabref/importer/ImportFormatReader.java @@ -46,7 +46,7 @@ public void resetImportFormats() { formats.add(new BiblioscapeImporter()); formats.add(new BibtexImporter()); - formats.add(new BibteXMLImporter()); + formats.add(new BibTeXMLImporter()); formats.add(new CopacImporter()); formats.add(new EndnoteImporter()); formats.add(new FreeCiteImporter()); diff --git a/src/main/java/net/sf/jabref/importer/fileformat/BibTeXMLHandler.java b/src/main/java/net/sf/jabref/importer/fileformat/BibTeXMLHandler.java index 069413642b7..0f497fc6a91 100644 --- a/src/main/java/net/sf/jabref/importer/fileformat/BibTeXMLHandler.java +++ b/src/main/java/net/sf/jabref/importer/fileformat/BibTeXMLHandler.java @@ -32,6 +32,8 @@ */ class BibTeXMLHandler extends DefaultHandler { + private static final String BIBTEXML_URI = "http://bibtexml.sf.net/"; + private List bibitems; private BibEntry b; // the entry being read @@ -39,6 +41,7 @@ class BibTeXMLHandler extends DefaultHandler { // XML parsing stuff private String currentChars; + public List getItems() { if (bibitems == null) { return Collections.emptyList(); @@ -53,11 +56,6 @@ public void startDocument() { bibitems = new ArrayList<>(); } - @Override - public void endDocument() { - // Empty method - } - @Override public void characters(char[] ch, int start, int length) { String s = new String(ch, start, length).trim(); @@ -66,41 +64,41 @@ public void characters(char[] ch, int start, int length) { @Override public void startElement(String uri, String local, String raw, Attributes atts) { - if ("bibtex:entry".equals(raw)) { - String articleID = null; - for (int i = 0; i < atts.getLength(); i++) { - if ("bibtex:id".equals(atts.getQName(i)) || - "id".equals(atts.getQName(i))) { - articleID = atts.getValue(i); + if (BIBTEXML_URI.equals(uri)) { + if ("entry".equals(local)) { + b = new BibEntry(IdGenerator.next()); + // Determine and-set bibtex key + String bibtexKey = null; + for (int i = 0; i < atts.getLength(); i++) { + String attrURI = atts.getURI(i); + if ((BIBTEXML_URI.equals(attrURI) || "".equals(attrURI)) && "id".equals(atts.getLocalName(i))) { + bibtexKey = atts.getValue(i); + } + } + if (bibtexKey != null) { + b.setField(BibEntry.KEY_FIELD, bibtexKey); } + } else if ("article".equals(local) || "inbook".equals(local) || "book".equals(local) + || "booklet".equals(local) || "incollection".equals(local) || "inproceedings".equals(local) + || "proceedings".equals(local) || "manual".equals(local) || "mastersthesis".equals(local) + || "phdthesis".equals(local) || "techreport".equals(local) || "unpublished".equals(local) + || "misc".equals(local)) { + b.setType(local); } - b = new BibEntry(IdGenerator.next()); - b.setField(BibEntry.KEY_FIELD, articleID); - } else if ("bibtex:article".equals(raw) || - "bibtex:inbook".equals(raw) || - "bibtex:book".equals(raw) || - "bibtex:booklet".equals(raw) || - "bibtex:incollection".equals(raw) || - "bibtex:inproceedings".equals(raw) || - "bibtex:proceedings".equals(raw) || - "bibtex:manual".equals(raw) || - "bibtex:mastersthesis".equals(raw) || - "bibtex:phdthesis".equals(raw) || - "bibtex:techreport".equals(raw) || - "bibtex:unpublished".equals(raw) || - "bibtex:misc".equals(raw) || - "bibtex:other".equals(raw)) { - b.setType(local); } currentChars = ""; } @Override public void endElement(String uri, String local, String raw) { - if ("bibtex:entry".equals(raw)) { - bibitems.add(b); - } else if (raw.startsWith("bibtex:")) { - b.setField(local, currentChars); + if (BIBTEXML_URI.equals(uri)) { + if ("entry".equals(local)) { + bibitems.add(b); + } else { + if (!currentChars.trim().isEmpty()) { + b.setField(local, currentChars); + } + } } currentChars = ""; } diff --git a/src/main/java/net/sf/jabref/importer/fileformat/BibteXMLImporter.java b/src/main/java/net/sf/jabref/importer/fileformat/BibTeXMLImporter.java similarity index 96% rename from src/main/java/net/sf/jabref/importer/fileformat/BibteXMLImporter.java rename to src/main/java/net/sf/jabref/importer/fileformat/BibTeXMLImporter.java index 665b96c53f2..239559ff9f7 100644 --- a/src/main/java/net/sf/jabref/importer/fileformat/BibteXMLImporter.java +++ b/src/main/java/net/sf/jabref/importer/fileformat/BibTeXMLImporter.java @@ -37,11 +37,11 @@ * check here for details on the format * http://www.ecst.csuchico.edu/~jacobsd/bib/formats/endnote.html */ -public class BibteXMLImporter extends ImportFormat { +public class BibTeXMLImporter extends ImportFormat { - private static final Log LOGGER = LogFactory.getLog(BibteXMLImporter.class); + private static final Log LOGGER = LogFactory.getLog(BibTeXMLImporter.class); - private static final Pattern START_PATTERN = Pattern.compile(" getTestFiles() throws IOException { + List files = new ArrayList<>(); + try (DirectoryStream stream = Files.newDirectoryStream(Paths.get(FILEFORMAT_PATH))) { + stream.forEach(n -> files.add(n.getFileName().toString())); + } + return files; + + } + + @BeforeClass + public static void setUp() { + Globals.prefs = JabRefPreferences.getInstance(); + } + + @Test + public void testExceptionOnInputStream() throws IOException { + try (InputStream is = Mockito.mock(InputStream.class)) { + Mockito.doThrow(new IOException()).when(is).read(); + + BibTeXMLImporter importer = new BibTeXMLImporter(); + List entry = importer.importEntries(is, new OutputPrinterToNull()); + Assert.assertTrue(entry.isEmpty()); + } + } + + @Test + public void testGetItemsEmpty() { + BibTeXMLHandler handler = new BibTeXMLHandler(); + Assert.assertEquals(Collections.emptyList(), handler.getItems()); + } + + @Test + public void testGetFormatName() { + BibTeXMLImporter importer = new BibTeXMLImporter(); + Assert.assertEquals("BibTeXML", importer.getFormatName()); + } + + @Test + public void testGetCLIId() { + BibTeXMLImporter importer = new BibTeXMLImporter(); + Assert.assertEquals("bibtexml", importer.getCLIId()); + } + + @Test + public void testIsRecognizedFormatReject() throws IOException { + BibTeXMLImporter importer = new BibTeXMLImporter(); + + List list = getTestFiles().stream().filter(n -> !n.startsWith("BibTeXMLImporterTest")) + .collect(Collectors.toList()); + + for (String str : list) { + try (InputStream is = BibTeXMLImporter.class.getResourceAsStream(str)) { + Assert.assertFalse(importer.isRecognizedFormat(is)); + } + } + } +} diff --git a/src/test/java/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestFiles.java b/src/test/java/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestFiles.java new file mode 100644 index 00000000000..b6551253a06 --- /dev/null +++ b/src/test/java/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestFiles.java @@ -0,0 +1,81 @@ +package net.sf.jabref.importer.fileformat; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.DirectoryStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import net.sf.jabref.Globals; +import net.sf.jabref.JabRefPreferences; +import net.sf.jabref.bibtex.BibtexEntryAssert; +import net.sf.jabref.importer.OutputPrinterToNull; +import net.sf.jabref.model.entry.BibEntry; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameter; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class BibTeXMLImporterTestFiles { + + private static final Pattern PATTERN = Pattern.compile("\\D*[0123456789]"); + private final static String FILEFORMAT_PATH = "src/test/resources/net/sf/jabref/importer/fileformat"; + + private BibTeXMLImporter bibtexmlImporter; + + @Parameter + public String fileName; + + + @Before + public void setUp() { + Globals.prefs = JabRefPreferences.getInstance(); + bibtexmlImporter = new BibTeXMLImporter(); + } + + @Parameters(name = "{0}") + public static Collection fileNames() throws IOException { + List files = new ArrayList<>(); + try (DirectoryStream stream = Files.newDirectoryStream(Paths.get(FILEFORMAT_PATH))) { + stream.forEach(n -> files.add(n.getFileName().toString())); + } + return files.stream().filter(n -> n.startsWith("BibTeXMLImporterTest")).filter(n -> n.endsWith(".xml")) + .collect(Collectors.toList()); + } + + @Test + public void testIsRecognizedFormat() throws IOException { + try (InputStream stream = BibTeXMLImporterTest.class.getResourceAsStream(fileName)) { + Assert.assertTrue(bibtexmlImporter.isRecognizedFormat(stream)); + } + } + + @Test + public void testImportEntries() throws IOException { + try (InputStream bitexmlStream = BibTeXMLImporterTest.class.getResourceAsStream(fileName)) { + List bibtexmlEntries = bibtexmlImporter.importEntries(bitexmlStream, new OutputPrinterToNull()); + + String bibFileName = fileName.replace(".xml", ".bib"); + while (PATTERN.matcher(bibFileName).find()) { + bibFileName = bibFileName.replaceFirst("[0123456789]", ""); + } + if (bibtexmlEntries.isEmpty()) { + Assert.assertEquals(Collections.emptyList(), bibtexmlEntries); + } else { + BibtexEntryAssert.assertEquals(BibTeXMLImporterTest.class, bibFileName, bibtexmlEntries); + } + } + } +} \ No newline at end of file diff --git a/src/test/java/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestTypes.java b/src/test/java/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestTypes.java new file mode 100644 index 00000000000..f0d207719fb --- /dev/null +++ b/src/test/java/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestTypes.java @@ -0,0 +1,70 @@ +package net.sf.jabref.importer.fileformat; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +import net.sf.jabref.Globals; +import net.sf.jabref.JabRefPreferences; +import net.sf.jabref.bibtex.BibtexEntryAssert; +import net.sf.jabref.importer.OutputPrinterToNull; +import net.sf.jabref.model.entry.BibEntry; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameter; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class BibTeXMLImporterTestTypes { + + private BibTeXMLImporter bibteXMLImporter; + + @Parameter(value = 0) + public String bibteXMLType; + + @Parameter(value = 1) + public String expectedBibType; + + + @Parameters + public static Collection types() { + return Arrays.asList(new String[][] {{"journal", "article"}, {"book section", "inbook"}, {"book", "book"}, + {"conference", "inproceedings"}, {"proceedings", "inproceedings"}, {"report", "techreport"}, + {"master thesis", "mastersthesis"}, {"thesis", "phdthesis"}, {"master", "misc"}}); + } + + @Before + public void setUp() throws Exception { + Globals.prefs = JabRefPreferences.getInstance(); + bibteXMLImporter = new BibTeXMLImporter(); + } + + @Test + public void importConvertsToCorrectBibType() throws IOException { + String bibteXMLInput = "\n" + "\n" + + "\n" + "\n" + + "Max Mustermann\n" + "java\n" + + "Java tricks\n" + "2016\n" + "\n" + "\n" + ""; + + List bibEntries = bibteXMLImporter.importEntries( + new ByteArrayInputStream(bibteXMLInput.getBytes(StandardCharsets.UTF_8)), new OutputPrinterToNull()); + + BibEntry entry = new BibEntry(); + entry.setField("author", "Max Mustermann"); + entry.setField("keywords", "java"); + entry.setField("title", "Java tricks"); + entry.setField("year", "2016"); + entry.setType(expectedBibType); + + Assert.assertEquals(1, bibEntries.size()); + BibtexEntryAssert.assertEquals(entry, bibEntries.get(0)); + } +} diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestArticle.bib b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestArticle.bib new file mode 100644 index 00000000000..f170c7f5e10 --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestArticle.bib @@ -0,0 +1,11 @@ +% Encoding: UTF-8 + +@Article{Mustermann2016, + author = {Max Mustermann}, + title = {Java tricks}, + journal = {Java Journal}, + year = {2016}, + pages = {2}, + month = {February}, + keywords = {java} +} diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestArticle.xml b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestArticle.xml new file mode 100644 index 00000000000..9cbeb4328da --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestArticle.xml @@ -0,0 +1,14 @@ + + + + + Max Mustermann + Java tricks + Java Journal + 2016 + February + 2 + java + + + \ No newline at end of file diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestArticle2.xml b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestArticle2.xml new file mode 100644 index 00000000000..87742eff6c4 --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestArticle2.xml @@ -0,0 +1,14 @@ + + + +
+ Max Mustermann + Java tricks + Java Journal + 2016 + 2 + February + java +
+
+
diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestArticleWithoutID.bib b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestArticleWithoutID.bib new file mode 100644 index 00000000000..b759fbeebf0 --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestArticleWithoutID.bib @@ -0,0 +1,11 @@ +% Encoding: UTF-8 + +@Article{, + author = {Max Mustermann}, + title = {Java tricks}, + journal = {Java Journal}, + year = {2016}, + pages = {2}, + month = {February}, + keywords = {java} +} diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestArticleWithoutID.xml b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestArticleWithoutID.xml new file mode 100644 index 00000000000..7cb1a5e677d --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestArticleWithoutID.xml @@ -0,0 +1,14 @@ + + + +
+ Max Mustermann + Java tricks + Java Journal + 2016 + 2 + February + java +
+
+
diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestBook.bib b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestBook.bib new file mode 100644 index 00000000000..d4b21de4684 --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestBook.bib @@ -0,0 +1,11 @@ +% Encoding: UTF-8 + +@Book{Mustermann2016, + title = {Java Book}, + publisher = {Java Book Publisher}, + year = {2016}, + author = {Max Mustermann}, + volume = {1}, + month = {February}, + keywords = {java} +} diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestBook.xml b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestBook.xml new file mode 100644 index 00000000000..1b7ef1bf0b2 --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestBook.xml @@ -0,0 +1,14 @@ + + + + + Max Mustermann + Java Book + Java Book Publisher + 2016 + 1 + February + java + + + \ No newline at end of file diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestBooklet.bib b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestBooklet.bib new file mode 100644 index 00000000000..3dad334bf5f --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestBooklet.bib @@ -0,0 +1,10 @@ +% Encoding: UTF-8 + +@Booklet{Mustermann2016, + title = {Java Booklet}, + author = {Max Mustermann}, + address = {Stuttgart}, + month = {February}, + year = {2016}, + keywords = {java} +} diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestBooklet.xml b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestBooklet.xml new file mode 100644 index 00000000000..274ccd2047a --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestBooklet.xml @@ -0,0 +1,13 @@ + + + + + Max Mustermann + Java Booklet + 2016 + February + Stuttgart + java + + + \ No newline at end of file diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestConference.bib b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestConference.bib new file mode 100644 index 00000000000..e7709cedf11 --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestConference.bib @@ -0,0 +1,18 @@ +% Encoding: UTF-8 + +@Conference{Mustermann2016, + author = {Max Mustermann}, + title = {Java Conference}, + booktitle = {Java Booktitle}, + year = {2016}, + editor = {Maxima Musterfrau}, + volume = {1}, + number = {1}, + series = {1}, + pages = {3-9}, + address = {Stuttgart}, + month = {February}, + organization = {Java Org}, + publisher = {Java Publisher}, + keywords = {java} +} diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestEmpty.xml b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestEmpty.xml new file mode 100644 index 00000000000..8e70e5d0768 --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestEmpty.xml @@ -0,0 +1,4 @@ + + + + diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInBook.bib b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInBook.bib new file mode 100644 index 00000000000..d0e1c4d6686 --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInBook.bib @@ -0,0 +1,13 @@ +% Encoding: UTF-8 + +@InBook{Mustermann2016, + chapter = {8}, + pages = {18-25}, + title = {Java 8 Lambdas}, + publisher = {Java Book Publisher}, + year = {2016}, + author = {Max Mustermann}, + volume = {1}, + month = {February}, + keywords = {java} +} diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInBook.xml b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInBook.xml new file mode 100644 index 00000000000..cee6d4a353b --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInBook.xml @@ -0,0 +1,16 @@ + + + + + Max Mustermann + Java 8 Lambdas + Java Book Publisher + 2016 + 1 + February + 8 + 18-25 + java + + + \ No newline at end of file diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInCollection.bib b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInCollection.bib new file mode 100644 index 00000000000..9fa735acd67 --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInCollection.bib @@ -0,0 +1,16 @@ +% Encoding: UTF-8 + +@InCollection{Mustermann2016, + author = {Max Mustermann}, + title = {Java InCollection}, + booktitle = {Java Testing}, + publisher = {Java Publisher}, + year = {2016}, + editor = {Maxima Musterfrau}, + volume = {1}, + number = {1}, + chapter = {3}, + pages = {18-26}, + month = {February}, + keywords = {java} +} diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInCollection.xml b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInCollection.xml new file mode 100644 index 00000000000..f66b6214526 --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInCollection.xml @@ -0,0 +1,19 @@ + + + + + Max Mustermann + Maxima Musterfrau + Java InCollection + Java Testing + Java Publisher + 2016 + 1 + February + 3 + 18-26 + 1 + java + + + \ No newline at end of file diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInProceedings.bib b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInProceedings.bib new file mode 100644 index 00000000000..0a9546563d9 --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInProceedings.bib @@ -0,0 +1,12 @@ +% Encoding: UTF-8 + +@InProceedings{Mustermann2016, + author = {Max Mustermann}, + title = {Java InProceedings}, + booktitle = {Java Book}, + year = {2016}, + month = {February}, + organization = {Java Org}, + publisher = {Java Publisher}, + keywords = {java} +} diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInProceedings.xml b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInProceedings.xml new file mode 100644 index 00000000000..94ced358458 --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestInProceedings.xml @@ -0,0 +1,15 @@ + + + + + Max Mustermann + Java InProceedings + Java Book + Java Publisher + 2016 + February + Java Org + java + + + \ No newline at end of file diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestManual.bib b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestManual.bib new file mode 100644 index 00000000000..21a7961789e --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestManual.bib @@ -0,0 +1,11 @@ +% Encoding: UTF-8 + +@Manual{Mustermann2016, + title = {How to install Java}, + author = {Max Mustermann}, + organization = {Java Users}, + address = {Stuttgart}, + month = {February}, + year = {2016}, + keywords = {java} +} diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestManual.xml b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestManual.xml new file mode 100644 index 00000000000..4dad3437139 --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestManual.xml @@ -0,0 +1,14 @@ + + + + + Max Mustermann + How to install Java + 2016 + February + Java Users + Stuttgart + java + + + \ No newline at end of file diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestMasterThesis.bib b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestMasterThesis.bib new file mode 100644 index 00000000000..003c2879c6c --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestMasterThesis.bib @@ -0,0 +1,12 @@ +% Encoding: UTF-8 + +@MastersThesis{Mustermann2016, + author = {Max Mustermann}, + title = {Java MasterThesis}, + school = {University}, + year = {2016}, + type = {Thesis}, + address = {Stuttgart}, + month = {February}, + keywords = {java} +} diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestMasterThesis.xml b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestMasterThesis.xml new file mode 100644 index 00000000000..3ac80b46a5f --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestMasterThesis.xml @@ -0,0 +1,15 @@ + + + + + Max Mustermann + Java MasterThesis + 2016 + February + University + Stuttgart + Thesis + java + + + \ No newline at end of file diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestMisc.bib b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestMisc.bib new file mode 100644 index 00000000000..9101bba68e2 --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestMisc.bib @@ -0,0 +1,10 @@ +% Encoding: UTF-8 + +@Misc{Mustermann2016, + author = {Max Mustermann}, + title = {Java Misc}, + howpublished = {Internet}, + month = {February}, + year = {2016}, + keywords = {java} +} diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestMisc.xml b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestMisc.xml new file mode 100644 index 00000000000..9c303ccf4b1 --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestMisc.xml @@ -0,0 +1,13 @@ + + + + + Max Mustermann + Java Misc + 2016 + February + Internet + java + + + \ No newline at end of file diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestPhdThesis.bib b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestPhdThesis.bib new file mode 100644 index 00000000000..6121bc38d24 --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestPhdThesis.bib @@ -0,0 +1,12 @@ +% Encoding: UTF-8 + +@PhdThesis{Mustermann2016, + author = {Max Mustermann}, + title = {Java PhdThesis}, + school = {University}, + year = {2016}, + type = {Thesis}, + address = {Stuttgart}, + month = {February}, + keywords = {java} +} diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestPhdThesis.xml b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestPhdThesis.xml new file mode 100644 index 00000000000..efbb458a89d --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestPhdThesis.xml @@ -0,0 +1,15 @@ + + + + + Max Mustermann + Java PhdThesis + 2016 + February + University + Stuttgart + Thesis + java + + + \ No newline at end of file diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestProceedings.bib b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestProceedings.bib new file mode 100644 index 00000000000..8d6cbe4c661 --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestProceedings.bib @@ -0,0 +1,11 @@ +% Encoding: UTF-8 + +@Proceedings{Musterfrau2016, + title = {Java Proceedings}, + year = {2016}, + editor = {Maxima Musterfrau}, + address = {Stuttgart}, + publisher = {Java Pub}, + month = {February}, + organization = {Java Org} +} diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestProceedings.xml b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestProceedings.xml new file mode 100644 index 00000000000..47d6875093f --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestProceedings.xml @@ -0,0 +1,14 @@ + + + + + Maxima Musterfrau + Java Proceedings + Java Pub + 2016 + February + Java Org + Stuttgart + + + \ No newline at end of file diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestTechReport.bib b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestTechReport.bib new file mode 100644 index 00000000000..b23017cbc0a --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestTechReport.bib @@ -0,0 +1,12 @@ +@TechReport{Mustermann2016, + author = {Max Mustermann}, + title = {Java TechReport}, + institution = {JIOT}, + year = {2016}, + type = {Report}, + number = {1}, + address = {Stuttgart}, + month = {February}, + keywords = {java}, + school = {JIOT} +} \ No newline at end of file diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestTechReport.xml b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestTechReport.xml new file mode 100644 index 00000000000..d66e83d9860 --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestTechReport.xml @@ -0,0 +1,17 @@ + + + + + Max Mustermann + Java TechReport + 2016 + February + 1 + JIOT + JIOT + Stuttgart + Report + java + + + \ No newline at end of file diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestUnpublished.bib b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestUnpublished.bib new file mode 100644 index 00000000000..f1720ddef2b --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestUnpublished.bib @@ -0,0 +1,9 @@ +% Encoding: UTF-8 + +@Unpublished{Mustermann2016, + author = {Max Mustermann}, + title = {Java Unpublished}, + month = {February}, + year = {2016}, + keywords = {java} +} diff --git a/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestUnpublished.xml b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestUnpublished.xml new file mode 100644 index 00000000000..8affb43fe9b --- /dev/null +++ b/src/test/resources/net/sf/jabref/importer/fileformat/BibTeXMLImporterTestUnpublished.xml @@ -0,0 +1,12 @@ + + + + + Max Mustermann + Java Unpublished + 2016 + February + java + + + \ No newline at end of file