Skip to content

Commit

Permalink
Improve arXiv fetcher
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-kolb committed Mar 15, 2020
1 parent de790f9 commit 8f68de9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/main/java/org/jabref/logic/importer/fetcher/ArXiv.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,8 @@ public Optional<URL> 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);
Expand Down
11 changes: 10 additions & 1 deletion src/test/java/org/jabref/logic/importer/fetcher/ArXivTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

@FetcherTest
class ArXivTest {

private ArXiv finder;
private BibEntry entry;
private BibEntry sliceTheoremPaper;
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 8f68de9

Please sign in to comment.