ModelPageProcessor implements PageProcessor { private void extractLinks(Page page, Selector urlRegionSelector, List<Pattern> urlPatterns) { List<String> links; if (urlRegionSelector == null) { links = page.getHtml().links().all(); } else { links = page.getHtml().selectList(urlRegionSelector).links().all(); } for (String link : links) { for (Pattern targetUrlPattern : urlPatterns) { Matcher matcher = targetUrlPattern.matcher(link); if (matcher.find()) { page.addTargetRequest(new Request(matcher.group(0))); } } } } private  ModelPageProcessor(Site site); static ModelPageProcessor create(Site site, Class... clazzs); ModelPageProcessor addPageModel(Class clazz); @Override void process(Page page); @Override Site getSite(); boolean isExtractLinks(); void setExtractLinks(boolean extractLinks);  }
@Test public void testExtractLinks() throws Exception { ModelPageProcessor modelPageProcessor = ModelPageProcessor.create(null, MockModel.class); Page page = pageMocker.getMockPage(); modelPageProcessor.process(page); assertThat(page.getTargetRequests()).containsExactly(new Request("http: }