Search in sources :

Example 21 with BibDatabaseContext

use of org.jabref.model.database.BibDatabaseContext in project jabref by JabRef.

the class ModsExportFormatTest method setUp.

@Before
public void setUp() throws Exception {
    databaseContext = new BibDatabaseContext();
    charset = StandardCharsets.UTF_8;
    modsExportFormat = new ModsExportFormat();
    bibtexImporter = new BibtexImporter(mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS));
    tempFile = testFolder.newFile();
    importFile = Paths.get(ModsExportFormatTest.class.getResource("ModsExportFormatTestAllFields.bib").toURI());
}
Also used : BibtexImporter(org.jabref.logic.importer.fileformat.BibtexImporter) BibDatabaseContext(org.jabref.model.database.BibDatabaseContext) Before(org.junit.Before)

Example 22 with BibDatabaseContext

use of org.jabref.model.database.BibDatabaseContext in project jabref by JabRef.

the class ModsExportFormatTestFiles method setUp.

@Before
public void setUp() throws Exception {
    databaseContext = new BibDatabaseContext();
    importFile = Paths.get(ModsExportFormatTestFiles.class.getResource(filename).toURI());
    charset = StandardCharsets.UTF_8;
    modsExportFormat = new ModsExportFormat();
    tempFile = testFolder.newFile();
    bibtexImporter = new BibtexImporter(mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS));
    modsImporter = new ModsImporter();
}
Also used : ModsImporter(org.jabref.logic.importer.fileformat.ModsImporter) BibtexImporter(org.jabref.logic.importer.fileformat.BibtexImporter) BibDatabaseContext(org.jabref.model.database.BibDatabaseContext) Before(org.junit.Before)

Example 23 with BibDatabaseContext

use of org.jabref.model.database.BibDatabaseContext in project jabref by JabRef.

the class IntegrityCheckTest method createContext.

private BibDatabaseContext createContext(String field, String value, MetaData metaData) {
    BibEntry entry = new BibEntry();
    entry.setField(field, value);
    BibDatabase bibDatabase = new BibDatabase();
    bibDatabase.insertEntry(entry);
    return new BibDatabaseContext(bibDatabase, metaData, new Defaults());
}
Also used : BibEntry(org.jabref.model.entry.BibEntry) Defaults(org.jabref.model.Defaults) BibDatabase(org.jabref.model.database.BibDatabase) BibDatabaseContext(org.jabref.model.database.BibDatabaseContext)

Example 24 with BibDatabaseContext

use of org.jabref.model.database.BibDatabaseContext in project jabref by JabRef.

the class BibDatabaseContextTest method testTypeBasedOnInferredModeBiblatex.

@Test
public void testTypeBasedOnInferredModeBiblatex() {
    BibDatabase db = new BibDatabase();
    BibEntry e1 = new BibEntry("electronic");
    db.insertEntry(e1);
    BibDatabaseContext bibDatabaseContext = new BibDatabaseContext(db);
    assertEquals(BibDatabaseMode.BIBLATEX, bibDatabaseContext.getMode());
}
Also used : BibEntry(org.jabref.model.entry.BibEntry) BibDatabase(org.jabref.model.database.BibDatabase) BibDatabaseContext(org.jabref.model.database.BibDatabaseContext) Test(org.junit.Test)

Example 25 with BibDatabaseContext

use of org.jabref.model.database.BibDatabaseContext in project jabref by JabRef.

the class BibDatabaseContextTest method testTypeBasedOnInferredModeBibTeX.

@Test
public void testTypeBasedOnInferredModeBibTeX() {
    BibDatabase db = new BibDatabase();
    BibEntry e1 = new BibEntry();
    db.insertEntry(e1);
    BibDatabaseContext bibDatabaseContext = new BibDatabaseContext(db);
    assertEquals(BibDatabaseMode.BIBTEX, bibDatabaseContext.getMode());
}
Also used : BibEntry(org.jabref.model.entry.BibEntry) BibDatabase(org.jabref.model.database.BibDatabase) BibDatabaseContext(org.jabref.model.database.BibDatabaseContext) Test(org.junit.Test)

Aggregations

BibDatabaseContext (org.jabref.model.database.BibDatabaseContext)48 Defaults (org.jabref.model.Defaults)24 Before (org.junit.Before)16 BibDatabase (org.jabref.model.database.BibDatabase)15 Test (org.junit.Test)13 BibEntry (org.jabref.model.entry.BibEntry)11 ParserResult (org.jabref.logic.importer.ParserResult)9 MetaData (org.jabref.model.metadata.MetaData)8 Charset (java.nio.charset.Charset)6 BibtexParser (org.jabref.logic.importer.fileformat.BibtexParser)6 Path (java.nio.file.Path)5 Scanner (java.util.Scanner)5 BibtexDatabaseWriter (org.jabref.logic.exporter.BibtexDatabaseWriter)5 SavePreferences (org.jabref.logic.exporter.SavePreferences)5 IOException (java.io.IOException)4 SaveException (org.jabref.logic.exporter.SaveException)4 BibtexImporter (org.jabref.logic.importer.fileformat.BibtexImporter)4 LayoutFormatterPreferences (org.jabref.logic.layout.LayoutFormatterPreferences)4 FileSaveSession (org.jabref.logic.exporter.FileSaveSession)3 SaveSession (org.jabref.logic.exporter.SaveSession)3