@@ -0,0 +1,2681 @@
+package net.sf.jabref.logic.importer.fetcher;%0A%0Aimport java.util.Optional;%0A%0Aimport net.sf.jabref.Globals;%0Aimport net.sf.jabref.logic.importer.FetcherException;%0Aimport net.sf.jabref.logic.importer.ParserResult;%0Aimport net.sf.jabref.model.entry.BibEntry;%0Aimport net.sf.jabref.model.entry.BibLatexEntryTypes;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0Apublic class DoiFetcherTest %7B%0A%0A    private DoiFetcher fetcher;%0A    private BibEntry bibEntry;%0A%0A    @Before%0A    public void setUp() %7B%0A        fetcher = new DoiFetcher(Globals.prefs.getImportFormatPreferences());%0A%0A        bibEntry = new BibEntry();%0A        bibEntry.setType(BibLatexEntryTypes.BOOK);%0A        bibEntry.setField(%22bibtexkey%22, %22Burd_2011%22);%0A        bibEntry.setField(%22title%22, %22Java%7B%5C%5Ctextregistered%7D For Dummies%7B%5C%5Ctextregistered%7D%22);%0A        bibEntry.setField(%22publisher%22, %22Wiley-Blackwell%22);%0A        bibEntry.setField(%22year%22, %222011%22);%0A        bibEntry.setField(%22author%22, %22Barry Burd%22);%0A        bibEntry.setField(%22month%22, %22jul%22);%0A        bibEntry.setField(%22doi%22, %2210.1002/9781118257517%22);%0A        bibEntry.setField(%22url%22, %22http://dx.doi.org/10.1002/9781118257517%22);%0A    %7D%0A%0A%0A    @Test%0A    public void testGetName() %7B%0A        assertEquals(%22DOI to BibTeX%22, fetcher.getName());%0A    %7D%0A%0A    @Test%0A    public void testGetHelpPage() %7B%0A        assertEquals(%22DOItoBibTeXHelp%22, fetcher.getHelpPage().getPageName());%0A    %7D%0A%0A    @Test%0A    public void testPerformSearch() throws FetcherException %7B%0A        Optional%3CBibEntry%3E fetchedEntry = fetcher.performSearchById(%2210.1002/9781118257517%22);%0A        assertEquals(Optional.of(bibEntry), fetchedEntry);%0A    %7D%0A%0A    @Test%0A    public void testPerformSearchEmpty() throws FetcherException %7B%0A        Optional%3CBibEntry%3E fetchedEntry = fetcher.performSearchById(%22%22);%0A        assertEquals(Optional.empty(), fetchedEntry);%0A    %7D%0A%0A    @Test(expected = FetcherException.class)%0A    public void testPerformSearchFetcherException() throws FetcherException %7B%0A        Optional%3CBibEntry%3E fetchedEntry = fetcher.performSearchById(%2210.1002/9781118257517F%22);%0A        assertEquals(Optional.empty(), fetchedEntry);%0A    %7D%0A%0A    @Test(expected = NullPointerException.class)%0A    public void testGetEntryFromDOILongNullPointerException() throws FetcherException %7B%0A        assertEquals(Optional.empty(), DoiFetcher.getEntryFromDOI(%2210.1002/9781118257517F%22, null, Globals.prefs.getImportFormatPreferences()));%0A    %7D%0A%0A    @Test%0A    public void testGetEntryFromDOILong() throws FetcherException %7B%0A        assertEquals(Optional.of(bibEntry), DoiFetcher.getEntryFromDOI(%2210.1002/9781118257517%22, new ParserResult(), Globals.prefs.getImportFormatPreferences()));%0A    %7D%0A%0A%7D%0A

add test for doifetcher