// Test no actions.
assertTrue(pc.performProductCrawlerActions(
Collections.<CrawlerAction>emptyList(), p, m));
// Test 1 action pass.
CrawlerAction action = createMock(CrawlerAction.class);
expect(action.getId()).andReturn("ActionId");
expect(action.getDescription()).andReturn("Action Description");
expect(action.performAction(p, m)).andReturn(true);
replay(action);
assertTrue(pc.performProductCrawlerActions(
Lists.newArrayList(action), p, m));
verify(action);
// Test 1 action fail.
action = createMock(CrawlerAction.class);
expect(action.getId()).andReturn("ActionId");
expect(action.getDescription()).andReturn("Action Description");
expect(action.performAction(p, m)).andReturn(false);
expect(action.getId()).andReturn("ActionId");
expect(action.getDescription()).andReturn("Action Description");
replay(action);
assertFalse(pc.performProductCrawlerActions(
Lists.newArrayList(action), p, m));
verify(action);
// Test 1 action pass and 1 action fail.
CrawlerAction passAction = createMock(CrawlerAction.class);
expect(passAction.getId()).andReturn("ActionId");
expect(passAction.getDescription()).andReturn("Action Description");
expect(passAction.performAction(p, m)).andReturn(true);
replay(passAction);
CrawlerAction failAction = createMock(CrawlerAction.class);
expect(failAction.getId()).andReturn("ActionId");
expect(failAction.getDescription()).andReturn("Action Description");
expect(failAction.performAction(p, m)).andReturn(false);
expect(failAction.getId()).andReturn("ActionId");
expect(failAction.getDescription()).andReturn("Action Description");
replay(failAction);
assertFalse(pc.performProductCrawlerActions(
Lists.newArrayList(passAction, failAction), p, m));
verify(passAction);
verify(failAction);