diff --git a/src/main/java/org/jabref/logic/help/HelpFile.java b/src/main/java/org/jabref/logic/help/HelpFile.java index c010dcd6981..fd64f2f5301 100644 --- a/src/main/java/org/jabref/logic/help/HelpFile.java +++ b/src/main/java/org/jabref/logic/help/HelpFile.java @@ -28,19 +28,19 @@ public enum HelpFile { FETCHER_BIBSONOMY_SCRAPER(""), FETCHER_CITESEERX("import-using-online-bibliographic-database/citeseer"), FETCHER_DBLP("import-using-online-bibliographic-database/dblp"), - FETCHER_DIVA("import-using-publication-identifiers/divatobibtex"), + FETCHER_DIVA("collect/add-entry-using-an-id"), FETCHER_DOAJ("import-using-online-bibliographic-database/doaj"), - FETCHER_DOI("import-using-publication-identifiers/doitobibtex"), + FETCHER_DOI("collect/add-entry-using-an-id"), FETCHER_GOOGLE_SCHOLAR("import-using-online-bibliographic-database/googlescholar"), FETCHER_GVK("import-using-online-bibliographic-database/gvk"), FETCHER_IEEEXPLORE("import-using-online-bibliographic-database/ieeexplore"), FETCHER_INSPIRE("import-using-online-bibliographic-database/inspire"), - FETCHER_ISBN("import-using-publication-identifiers/isbntobibtex"), + FETCHER_ISBN("collect/add-entry-using-an-id"), FETCHER_MEDLINE("import-using-online-bibliographic-database/medline"), FETCHER_OAI2_ARXIV("import-using-online-bibliographic-database/arxiv"), - FETCHER_RFC("import-using-publication-identifiers/rfctobibtex"), + FETCHER_RFC("collect/add-entry-using-an-id"), FETCHER_SPRINGER("import-using-online-bibliographic-database/springer"), - FETCHER_TITLE("import-using-publication-identifiers/titletobibtex"), + FETCHER_TITLE("collect/add-entry-using-an-id"), FETCHER_SCIENCEDIRECT(""), DATABASE_PROPERTIES("setup/databaseproperties"), FIND_DUPLICATES("finding-sorting-and-cleaning-entries/findduplicates"), diff --git a/src/main/java/org/jabref/logic/importer/WebFetchers.java b/src/main/java/org/jabref/logic/importer/WebFetchers.java index 72c3ace87ab..f21521fa6a8 100644 --- a/src/main/java/org/jabref/logic/importer/WebFetchers.java +++ b/src/main/java/org/jabref/logic/importer/WebFetchers.java @@ -19,7 +19,6 @@ import org.jabref.logic.importer.fetcher.DoiFetcher; import org.jabref.logic.importer.fetcher.DoiResolution; import org.jabref.logic.importer.fetcher.GoogleScholar; -import org.jabref.logic.importer.fetcher.GrobidCitationFetcher; import org.jabref.logic.importer.fetcher.GvkFetcher; import org.jabref.logic.importer.fetcher.IEEE; import org.jabref.logic.importer.fetcher.INSPIREFetcher; @@ -100,7 +99,6 @@ public static SortedSet getSearchBasedFetchers(ImportFormatP set.add(new CiteSeer()); set.add(new DOAJFetcher(importFormatPreferences)); set.add(new IEEE(importFormatPreferences)); - set.add(new GrobidCitationFetcher(importFormatPreferences)); return set; } @@ -140,8 +138,8 @@ public static SortedSet getEntryBasedFetchers(ImportFormatPre /** * @return sorted set containing id fetchers */ - public static SortedSet getIdFetchers(ImportFormatPreferences importFormatPreferences) { - SortedSet set = new TreeSet<>(Comparator.comparing(WebFetcher::getName)); + public static SortedSet> getIdFetchers(ImportFormatPreferences importFormatPreferences) { + SortedSet> set = new TreeSet<>(Comparator.comparing(WebFetcher::getName)); set.add(new CrossRef()); set.add(new ArXiv(importFormatPreferences)); return set; diff --git a/src/test/java/org/jabref/logic/help/HelpFileTest.java b/src/test/java/org/jabref/logic/help/HelpFileTest.java index 8395039b7ef..006c0383d0e 100644 --- a/src/test/java/org/jabref/logic/help/HelpFileTest.java +++ b/src/test/java/org/jabref/logic/help/HelpFileTest.java @@ -11,20 +11,19 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import static org.jabref.logic.help.HelpFile.values; import static org.junit.jupiter.api.Assertions.assertEquals; -public class HelpFileTest { +class HelpFileTest { private final String jabrefHelp = "https://docs.jabref.org/"; static Stream getAllHelpFiles() { - return Arrays.stream(values()); + return Arrays.stream(HelpFile.values()); } @ParameterizedTest @MethodSource("getAllHelpFiles") - public void referToValidPage(HelpFile help) throws IOException { + void referToValidPage(HelpFile help) throws IOException { URL url = new URL(jabrefHelp + help.getPageName()); HttpURLConnection http = (HttpURLConnection) url.openConnection(); http.setRequestProperty("User-Agent", URLDownload.USER_AGENT); diff --git a/src/test/java/org/jabref/logic/importer/WebFetchersTest.java b/src/test/java/org/jabref/logic/importer/WebFetchersTest.java index 904f8198716..f73df6dff24 100644 --- a/src/test/java/org/jabref/logic/importer/WebFetchersTest.java +++ b/src/test/java/org/jabref/logic/importer/WebFetchersTest.java @@ -1,11 +1,13 @@ package org.jabref.logic.importer; import java.util.Collection; +import java.util.HashSet; import java.util.Set; import java.util.stream.Collectors; import org.jabref.logic.importer.fetcher.ACMPortalFetcher; import org.jabref.logic.importer.fetcher.AbstractIsbnFetcher; +import org.jabref.logic.importer.fetcher.GrobidCitationFetcher; import org.jabref.logic.importer.fetcher.IsbnViaEbookDeFetcher; import org.jabref.logic.importer.fetcher.IsbnViaOttoBibFetcher; import org.jabref.logic.importer.fetcher.MrDLibFetcher; @@ -22,7 +24,7 @@ class WebFetchersTest { private ImportFormatPreferences importFormatPreferences; - private ClassGraph classGraph = new ClassGraph().enableAllInfo().whitelistPackages("org.jabref"); + private final ClassGraph classGraph = new ClassGraph().enableAllInfo().whitelistPackages("org.jabref"); @BeforeEach void setUp() throws Exception { @@ -36,7 +38,7 @@ void getIdBasedFetchersReturnsAllFetcherDerivingFromIdBasedFetcher() throws Exce try (ScanResult scanResult = classGraph.scan()) { ClassInfoList controlClasses = scanResult.getClassesImplementing(IdBasedFetcher.class.getCanonicalName()); - Set> expected = controlClasses.loadClasses().stream().collect(Collectors.toSet()); + Set> expected = new HashSet<>(controlClasses.loadClasses()); expected.remove(AbstractIsbnFetcher.class); expected.remove(IdBasedParserFetcher.class); @@ -58,7 +60,7 @@ void getEntryBasedFetchersReturnsAllFetcherDerivingFromEntryBasedFetcher() throw try (ScanResult scanResult = classGraph.scan()) { ClassInfoList controlClasses = scanResult.getClassesImplementing(EntryBasedFetcher.class.getCanonicalName()); - Set> expected = controlClasses.loadClasses().stream().collect(Collectors.toSet()); + Set> expected = new HashSet<>(controlClasses.loadClasses()); expected.remove(EntryBasedParserFetcher.class); expected.remove(MrDLibFetcher.class); @@ -71,13 +73,16 @@ void getSearchBasedFetchersReturnsAllFetcherDerivingFromSearchBasedFetcher() thr Set searchBasedFetchers = WebFetchers.getSearchBasedFetchers(importFormatPreferences); try (ScanResult scanResult = classGraph.scan()) { ClassInfoList controlClasses = scanResult.getClassesImplementing(SearchBasedFetcher.class.getCanonicalName()); - Set> expected = controlClasses.loadClasses().stream().collect(Collectors.toSet()); + Set> expected = new HashSet<>(controlClasses.loadClasses()); expected.remove(SearchBasedParserFetcher.class); // Remove ACM, because it doesn't work currently expected.remove(ACMPortalFetcher.class); + // Remove GROBID, because we don't want to show this to the user + expected.remove(GrobidCitationFetcher.class); + assertEquals(expected, getClasses(searchBasedFetchers)); } } @@ -88,18 +93,18 @@ void getFullTextFetchersReturnsAllFetcherDerivingFromFullTextFetcher() throws Ex try (ScanResult scanResult = classGraph.scan()) { ClassInfoList controlClasses = scanResult.getClassesImplementing(FulltextFetcher.class.getCanonicalName()); - Set> expected = controlClasses.loadClasses().stream().collect(Collectors.toSet()); + Set> expected = new HashSet<>(controlClasses.loadClasses()); assertEquals(expected, getClasses(fullTextFetchers)); } } @Test void getIdFetchersReturnsAllFetcherDerivingFromIdFetcher() throws Exception { - Set idFetchers = WebFetchers.getIdFetchers(importFormatPreferences); + Set> idFetchers = WebFetchers.getIdFetchers(importFormatPreferences); try (ScanResult scanResult = classGraph.scan()) { ClassInfoList controlClasses = scanResult.getClassesImplementing(IdFetcher.class.getCanonicalName()); - Set> expected = controlClasses.loadClasses().stream().collect(Collectors.toSet()); + Set> expected = new HashSet<>(controlClasses.loadClasses()); expected.remove(IdParserFetcher.class); assertEquals(expected, getClasses(idFetchers));