@@ -0,0 +1,2564 @@
+package org.jabref.es2;%0A%0Aimport java.io.BufferedReader;%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.io.InputStreamReader;%0Aimport java.util.List;%0Aimport java.util.Optional;%0A%0Aimport org.jabref.Globals;%0Aimport org.jabref.logic.importer.ImportFormatReader;%0Aimport org.jabref.logic.importer.ParserResult;%0Aimport org.jabref.logic.importer.fileformat.BibtexImporter;%0Aimport org.jabref.model.database.BibDatabase;%0Aimport org.jabref.model.entry.BibEntry;%0Aimport org.jabref.preferences.JabRefPreferences;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport static org.junit.Assert.*;%0A%0A%0Apublic class TestImport %7B%0A%0A    private BibtexImporter importer;%0A%0A    @Before%0A    public void setUp() throws Exception %7B%0A        Globals.prefs = JabRefPreferences.getInstance();%0A        importer = new BibtexImporter(Globals.prefs.getImportFormatPreferences());%0A    %7D%0A%0A    @Test%0A    public void testeImportArquivo() throws IOException %7B%0A        BibDatabase database = new BibDatabase();%0A        InputStream stream = TestImport.class.getResourceAsStream(%22testeImport.bib%22);%0A        BufferedReader reader = new BufferedReader(new InputStreamReader(stream, Globals.prefs.getDefaultEncoding()));%0A        ParserResult pr = importer.importDatabase(reader);%0A        ImportFormatReader.UnknownFormatImport importResult = new ImportFormatReader.UnknownFormatImport(importer.getName(), pr);%0A        ParserResult pares = importResult.parserResult;%0A        database = pares.getDatabase();%0A        List%3CBibEntry%3E entries = database.getEntries();%0A%0A        assertEquals(2, entries.size());%0A%0A        for (BibEntry entry : entries) %7B%0A            if (entry.getCiteKey().equals(%22teste1%22)) %7B%0A                assertEquals(Optional.of(%22title_teste%22), entry.getField(%22title%22));%0A                assertEquals(Optional.of(%22publisher_teste%22), entry.getField(%22publisher%22));%0A                assertEquals(Optional.of(%222017%22), entry.getField(%22year%22));%0A                assertEquals(Optional.of(%22author_teste%22), entry.getField(%22author%22));%0A                assertEquals(Optional.of(%22editor_teste%22), entry.getField(%22editor%22));%0A            %7D else if (entry.getCiteKey().equals(%22teste2%22)) %7B%0A                Optional%3CString%3E empty = Optional.empty();%0A                assertEquals(empty, entry.getField(%22title%22));%0A                assertEquals(empty, entry.getField(%22publisher%22));%0A                assertEquals(empty, entry.getField(%22year%22));%0A                assertEquals(empty, entry.getField(%22author%22));%0A                assertEquals(empty, entry.getField(%22editor%22));%0A            %7D%0A        %7D%0A%0A    %7D%0A%0A%7D%0A

Teste importação