From 8f68de937e53213bb3e778230c9b91a515f29ac9 Mon Sep 17 00:00:00 2001 From: Stefan Kolb Date: Sun, 15 Mar 2020 15:13:05 +0100 Subject: [PATCH] Improve arXiv fetcher --- .../java/org/jabref/logic/importer/fetcher/ArXiv.java | 4 +--- .../org/jabref/logic/importer/fetcher/ArXivTest.java | 11 ++++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jabref/logic/importer/fetcher/ArXiv.java b/src/main/java/org/jabref/logic/importer/fetcher/ArXiv.java index de3539d8184..28a521a8022 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/ArXiv.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/ArXiv.java @@ -74,10 +74,8 @@ public Optional findFullText(BibEntry entry) throws IOException { .filter(Optional::isPresent) .map(Optional::get) .findFirst(); + pdfUrl.ifPresent(url -> LOGGER.info("Fulltext PDF found @ arXiv.")); - if (pdfUrl.isPresent()) { - LOGGER.info("Fulltext PDF found @ arXiv."); - } return pdfUrl; } catch (FetcherException e) { LOGGER.warn("arXiv API request failed", e); diff --git a/src/test/java/org/jabref/logic/importer/fetcher/ArXivTest.java b/src/test/java/org/jabref/logic/importer/fetcher/ArXivTest.java index 523cf9f651a..8bee0365c5b 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/ArXivTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/ArXivTest.java @@ -23,7 +23,6 @@ @FetcherTest class ArXivTest { - private ArXiv finder; private BibEntry entry; private BibEntry sliceTheoremPaper; @@ -121,6 +120,16 @@ void findFullTextByDOINotAvailableInCatalog() throws IOException { assertEquals(Optional.empty(), finder.findFullText(entry)); } + @Test + void findFullTextEntityWithoutDoi() throws IOException { + assertEquals(Optional.empty(), finder.findFullText(entry)); + } + + @Test + void findFullTextTrustLevel() { + assertEquals(TrustLevel.PREPRINT, finder.getTrustLevel()); + } + @Test void searchEntryByPartOfTitle() throws Exception { assertEquals(Collections.singletonList(sliceTheoremPaper),