// The "crawler@domain.com" email address shouldn't trigger a match against the
// "crawler" user agent name in the robots.txt file.
final String simpleRobotsTxt = "User-agent: crawler" + "\r\n"
+ "Disallow: /";
BaseFetcher fetcher = Mockito.mock(BaseFetcher.class);
FetchedDatum datum = Mockito.mock(FetchedDatum.class);
Mockito.when(datum.getContentBytes()).thenReturn(simpleRobotsTxt.getBytes());
Mockito.when(fetcher.get(Mockito.any(ScoredUrlDatum.class))).thenReturn(datum);
UserAgent userAgent = new UserAgent("testAgent", "crawler@domain.com", "http://www.domain.com");
Mockito.when(fetcher.getUserAgent()).thenReturn(userAgent);
URL robotsUrl = new URL("http://www.domain.com/robots.txt");
SimpleRobotRulesParser parser = new SimpleRobotRulesParser();
BaseRobotRules rules = RobotUtils.getRobotRules(fetcher, parser, robotsUrl);