Skip to content

Commit 8f68de9

Browse files
committed
Improve arXiv fetcher
1 parent de790f9 commit 8f68de9

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

Diff for: src/main/java/org/jabref/logic/importer/fetcher/ArXiv.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,8 @@ public Optional<URL> findFullText(BibEntry entry) throws IOException {
7474
.filter(Optional::isPresent)
7575
.map(Optional::get)
7676
.findFirst();
77+
pdfUrl.ifPresent(url -> LOGGER.info("Fulltext PDF found @ arXiv."));
7778

78-
if (pdfUrl.isPresent()) {
79-
LOGGER.info("Fulltext PDF found @ arXiv.");
80-
}
8179
return pdfUrl;
8280
} catch (FetcherException e) {
8381
LOGGER.warn("arXiv API request failed", e);

Diff for: src/test/java/org/jabref/logic/importer/fetcher/ArXivTest.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
@FetcherTest
2525
class ArXivTest {
26-
2726
private ArXiv finder;
2827
private BibEntry entry;
2928
private BibEntry sliceTheoremPaper;
@@ -121,6 +120,16 @@ void findFullTextByDOINotAvailableInCatalog() throws IOException {
121120
assertEquals(Optional.empty(), finder.findFullText(entry));
122121
}
123122

123+
@Test
124+
void findFullTextEntityWithoutDoi() throws IOException {
125+
assertEquals(Optional.empty(), finder.findFullText(entry));
126+
}
127+
128+
@Test
129+
void findFullTextTrustLevel() {
130+
assertEquals(TrustLevel.PREPRINT, finder.getTrustLevel());
131+
}
132+
124133
@Test
125134
void searchEntryByPartOfTitle() throws Exception {
126135
assertEquals(Collections.singletonList(sliceTheoremPaper),

0 commit comments

Comments
 (0)