Skip to content

Commit

Permalink
Fix Medline tests (#5774)
Browse files Browse the repository at this point in the history
- wait between calls to avoid 403
- remove assertion of entry not returned anymore
  • Loading branch information
koppor authored Dec 20, 2019
1 parent cb2173b commit 5ffb1b2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ default Optional<BibEntry> performSearchById(String identifier) throws FetcherEx
} catch (URISyntaxException e) {
throw new FetcherException("Search URI is malformed", e);
} catch (IOException e) {
// TODO: Catch HTTP Response 401 errors and report that user has no rights to access resource
// TODO: Catch HTTP Response 401 errors and report that user has no rights to access resource. It might be that there is an UnknownHostException (eutils.ncbi.nlm.nih.gov cannot be resolved).
throw new FetcherException("A network error occurred", e);
} catch (ParseException e) {
throw new FetcherException("An internal parser error occurred", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ public class MedlineFetcherTest {
private BibEntry entryWijedasa, entryEndharti, bibEntryIchikawa, bibEntrySari;

@BeforeEach
public void setUp() {
public void setUp() throws InterruptedException {
// pause between runs to avoid 403 and 429 at Medline
Thread.sleep(1000);

fetcher = new MedlineFetcher();

entryWijedasa = new BibEntry();
Expand Down Expand Up @@ -167,7 +170,6 @@ public void testMultipleEntries() throws Exception {
entryList.forEach(entry -> entry.clearField(StandardField.ABSTRACT)); //Remove abstract due to copyright);
assertEquals(50, entryList.size());
assertTrue(entryList.contains(bibEntryIchikawa));
assertTrue(entryList.contains(bibEntrySari));
}

@Test
Expand Down

0 comments on commit 5ffb1b2

Please sign in to comment.