Source:
<code>public void criteriaScheduleStrategyPlanCRUD() { Schedule schedule1 = new Schedule(); schedule1.setLabel("Task 1"); schedule1.setScheduleType(ScheduleType.ONCE); schedule1.addActivity(new Activity("Do task",null,new TaskReference("task:AAA"))); Schedule schedule2 = new Schedule(); schedule2.setLabel("Task 2"); schedule2.setScheduleType(ScheduleType.ONCE); schedule2.addActivity(new Activity("Do task",null,new TaskReference("task:BBB"))); ScheduleCriteria criteria1 = new ScheduleCriteria.Builder() .withMinAppVersion(2) .withMaxAppVersion(5) .withSchedule(schedule1).build(); ScheduleCriteria criteria2 = new ScheduleCriteria.Builder() .withMinAppVersion(6) .withMaxAppVersion(10) .withSchedule(schedule2).build(); CriteriaScheduleStrategy strategy = new CriteriaScheduleStrategy(); strategy.addCriteria(criteria1); strategy.addCriteria(criteria2); SchedulePlan plan = new SchedulePlan(); plan.setLabel("Criteria schedule plan"); plan.setStrategy(strategy); GuidVersionHolder keys = developerClient.createSchedulePlan(plan); SchedulePlan retrievedPlan = developerClient.getSchedulePlan(keys.getGuid()); assertTrue(retrievedPlan.getStrategy() instanceof CriteriaScheduleStrategy); CriteriaScheduleStrategy retrievedStrategy = (CriteriaScheduleStrategy)retrievedPlan.getStrategy(); <START> assertEquals(2, retrievedStrategy.getScheduleCriteria().size()); <END> assertEquals("task:AAA", getTaskIdentifier(retrievedStrategy, 0)); assertEquals("task:BBB", getTaskIdentifier(retrievedStrategy, 1)); }</code><technical_language>Is worth validating contents of schedule criteria count</technical_language>

Target:
public void criteriaScheduleStrategyPlanCRUD() throws Exception { Schedule schedule1 = new Schedule(); schedule1.setLabel("Task 1"); schedule1.setScheduleType(ScheduleType.ONCE); schedule1.addActivity(new Activity("Do task",null,new TaskReference("task:AAA"))); Schedule schedule2 = new Schedule(); schedule2.setLabel("Task 2"); schedule2.setScheduleType(ScheduleType.ONCE); schedule2.addActivity(new Activity("Do task",null,new TaskReference("task:BBB"))); ScheduleCriteria criteria1 = new ScheduleCriteria.Builder() .withMinAppVersion(2) .withMaxAppVersion(5) .withSchedule(schedule1).build(); ScheduleCriteria criteria2 = new ScheduleCriteria.Builder() .withMinAppVersion(6) .withMaxAppVersion(10) .withSchedule(schedule2).build(); CriteriaScheduleStrategy strategy = new CriteriaScheduleStrategy(); strategy.addCriteria(criteria1); strategy.addCriteria(criteria2); SchedulePlan plan = new SchedulePlan(); plan.setLabel("Criteria schedule plan"); plan.setStrategy(strategy); GuidVersionHolder keys = developerClient.createSchedulePlan(plan); SchedulePlan retrievedPlan = developerClient.getSchedulePlan(keys.getGuid()); assertTrue(retrievedPlan.getStrategy() instanceof CriteriaScheduleStrategy); CriteriaScheduleStrategy retrievedStrategy = (CriteriaScheduleStrategy)retrievedPlan.getStrategy(); assertEquals(2, retrievedStrategy.getScheduleCriteria().size()); criteria1 = updateGuid(criteria1, retrievedStrategy, 0); criteria2 = updateGuid(criteria2, retrievedStrategy, 1); assertEquals(criteria1, retrievedStrategy.getScheduleCriteria().get(0)); assertEquals(criteria2, retrievedStrategy.getScheduleCriteria().get(1)); }