Skip to content

Commit

Permalink
Fixed testFatalHandlerException in CrawlerTest
Browse files Browse the repository at this point in the history
  • Loading branch information
lwj5 committed Feb 26, 2019
1 parent 4d14599 commit 9b19af7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/test/java/ai/preferred/venom/CrawlerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,15 @@ public void testUrlRouterIntegration() throws Exception {
@Test
public void testFatalHandlerException() {
Assertions.assertThrows(FatalHandlerException.class, () -> {
final List<FakeFetcher.Status> statuses = Arrays.asList(FakeFetcher.Status.COMPLETE, FakeFetcher.Status.COMPLETE,
final List<FakeFetcher.Status> statuses = Arrays.asList(
FakeFetcher.Status.COMPLETE,
FakeFetcher.Status.COMPLETE,
FakeFetcher.Status.COMPLETE);
final Fetcher fetcher = new FakeFetcher(new LinkedList<>(statuses));
try (final Crawler crawler = Crawler.builder()
.setFetcher(fetcher)
.setMaxTries(1)
.setMaxConnections(1)
.setScheduler(new FIFOScheduler())
.setSleepScheduler(new SleepScheduler(0))
.build()
Expand All @@ -292,11 +295,11 @@ public void testFatalHandlerException() {
});

crawler.getScheduler().add(vRequest, (request, response, scheduler, session, worker) -> {
throw new FatalHandlerException("FatalHandlerException #1");
throw new FatalHandlerException("FatalHandlerException");
});

crawler.getScheduler().add(vRequest, (request, response, scheduler, session, worker) -> {
throw new FatalHandlerException("FatalHandlerException #2");
// do nothing
});
}
});
Expand Down

0 comments on commit 9b19af7

Please sign in to comment.