Search in sources :

Example 96 with ParserResult

use of org.jabref.logic.importer.ParserResult in project jabref by JabRef.

the class MrDLibImporterTest method testImportDatabaseIsTitleSetCorrectly.

@Test
public void testImportDatabaseIsTitleSetCorrectly() throws IOException {
    ParserResult parserResult = importer.importDatabase(inputMax);
    List<BibEntry> resultList = parserResult.getDatabase().getEntries();
    assertEquals("Gesundheit von Arbeitslosen fördern!: ein Handbuch für Wissenschaft und Praxis", resultList.get(0).getLatexFreeField(FieldName.TITLE).get());
}
Also used : ParserResult(org.jabref.logic.importer.ParserResult) BibEntry(org.jabref.model.entry.BibEntry) Test(org.junit.Test)

Example 97 with ParserResult

use of org.jabref.logic.importer.ParserResult in project jabref by JabRef.

the class MrDLibImporterTest method testImportDatabaseIsYearSetCorrectly.

@Test
public void testImportDatabaseIsYearSetCorrectly() throws IOException {
    ParserResult parserResult = importer.importDatabase(inputMax);
    List<BibEntry> resultList = parserResult.getDatabase().getEntries();
    assertEquals("2009", resultList.get(0).getLatexFreeField(FieldName.YEAR).get());
}
Also used : ParserResult(org.jabref.logic.importer.ParserResult) BibEntry(org.jabref.model.entry.BibEntry) Test(org.junit.Test)

Example 98 with ParserResult

use of org.jabref.logic.importer.ParserResult in project jabref by JabRef.

the class PdfXmpImporterTest method importEncryptedFileReturnsError.

@Test
public void importEncryptedFileReturnsError() throws URISyntaxException {
    Path file = Paths.get(PdfXmpImporterTest.class.getResource("/pdfs/encrypted.pdf").toURI());
    ParserResult result = importer.importDatabase(file, StandardCharsets.UTF_8);
    Assert.assertTrue(result.hasWarnings());
}
Also used : Path(java.nio.file.Path) ParserResult(org.jabref.logic.importer.ParserResult) Test(org.junit.Test)

Example 99 with ParserResult

use of org.jabref.logic.importer.ParserResult in project jabref by JabRef.

the class ConvertLegacyExplicitGroupsTest method generateParserResult.

private ParserResult generateParserResult(GroupTreeNode groupRoot) {
    ParserResult parserResult = new ParserResult(Collections.singletonList(entry));
    parserResult.getMetaData().setGroups(groupRoot);
    return parserResult;
}
Also used : ParserResult(org.jabref.logic.importer.ParserResult)

Example 100 with ParserResult

use of org.jabref.logic.importer.ParserResult in project jabref by JabRef.

the class ConvertLegacyExplicitGroupsTest method performActionClearsLegacyKeys.

@Test
public void performActionClearsLegacyKeys() throws Exception {
    ParserResult parserResult = generateParserResult(GroupTreeNode.fromGroup(group));
    action.performAction(parserResult);
    assertEquals(Collections.emptyList(), group.getLegacyEntryKeys());
}
Also used : ParserResult(org.jabref.logic.importer.ParserResult) Test(org.junit.Test)

Aggregations

ParserResult (org.jabref.logic.importer.ParserResult)196 Test (org.junit.Test)145 BibEntry (org.jabref.model.entry.BibEntry)131 StringReader (java.io.StringReader)130 BibtexParser (org.jabref.logic.importer.fileformat.BibtexParser)38 BibtexString (org.jabref.model.entry.BibtexString)30 ArrayList (java.util.ArrayList)23 BibDatabase (org.jabref.model.database.BibDatabase)20 Path (java.nio.file.Path)14 IOException (java.io.IOException)12 StringWriter (java.io.StringWriter)12 File (java.io.File)10 InputStreamReader (java.io.InputStreamReader)10 HashMap (java.util.HashMap)10 BibDatabaseContext (org.jabref.model.database.BibDatabaseContext)9 InputStream (java.io.InputStream)8 Defaults (org.jabref.model.Defaults)8 Charset (java.nio.charset.Charset)6 Scanner (java.util.Scanner)5 BufferedReader (java.io.BufferedReader)4