### Question:
RepairGroup extends ScheduledTask { @VisibleForTesting Collection<RepairTask> getRepairTasks() { Collection<RepairTask> tasks = new ArrayList<>(); RepairTask.Builder builder = new RepairTask.Builder() .withJMXProxyFactory(myJmxProxyFactory) .withTableReference(myTableReference) .withTableRepairMetrics(myTableRepairMetrics) .withRepairConfiguration(myRepairConfiguration) .withReplicas(myReplicaRepairGroup.getReplicas()); for (LongTokenRange range : myReplicaRepairGroup) { builder.withTokenRanges(Collections.singletonList(range)); tasks.add(builder.build()); } return tasks; } RepairGroup(int priority,
                       TableReference tableReference,
                       RepairConfiguration repairConfiguration,
                       ReplicaRepairGroup replicaRepairGroup,
                       JmxProxyFactory jmxProxyFactory,
                       TableRepairMetrics tableRepairMetrics,
                       RepairResourceFactory repairResourceFactory,
                       RepairLockFactory repairLockFactory);  RepairGroup(int priority,
            TableReference tableReference,
            RepairConfiguration repairConfiguration,
            ReplicaRepairGroup replicaRepairGroup,
            JmxProxyFactory jmxProxyFactory,
            TableRepairMetrics tableRepairMetrics,
            RepairResourceFactory repairResourceFactory,
            RepairLockFactory repairLockFactory,
            List<TableRepairPolicy> tableRepairPolicies); @Override boolean execute(); @Override LockFactory.DistributedLock getLock(LockFactory lockFactory); @Override String toString();  }### Answer:
@Test public void testGetPartialRepairTasks() { Host host = mockHost("DC1"); Host host2 = mockHost("DC1"); ImmutableList<LongTokenRange> vnodes = ImmutableList.of( new LongTokenRange(1, 2), new LongTokenRange(2, 3), new LongTokenRange(4, 5)); ReplicaRepairGroup replicaRepairGroup = new ReplicaRepairGroup(ImmutableSet.of(host, host2), vnodes); RepairGroup repairGroup = new RepairGroup(priority, tableReference, repairConfiguration, replicaRepairGroup, myJmxProxyFactory, myTableRepairMetrics, myRepairResourceFactory, myRepairLockFactory); Collection<RepairTask> tasks = repairGroup.getRepairTasks(); assertThat(tasks.size()).isEqualTo(3); Set<LongTokenRange> repairTaskRanges = new HashSet<>(); for (RepairTask repairTask : tasks) { assertThat(repairTask.getTokenRanges().size()).isEqualTo(1); LongTokenRange range = repairTask.getTokenRanges().iterator().next(); repairTaskRanges.add(range); assertThat(repairTask.getReplicas()).containsExactlyInAnyOrder(host, host2); assertThat(repairTask.getTableReference()).isEqualTo(tableReference); assertThat(repairTask.getRepairConfiguration().getRepairParallelism()).isEqualTo(RepairOptions.RepairParallelism.PARALLEL); } assertThat(repairTaskRanges).containsExactlyElementsOf(vnodes); }
@Test public void testGetRepairTask() { Host host = mockHost("DC1"); LongTokenRange range = new LongTokenRange(1, 2); ImmutableSet<Host> hosts = ImmutableSet.of(host); Set<LongTokenRange> ranges = new HashSet<>(); ranges.add(range); ReplicaRepairGroup replicaRepairGroup = new ReplicaRepairGroup(hosts, ImmutableList.of(range)); RepairGroup repairGroup = new RepairGroup(priority, tableReference, repairConfiguration, replicaRepairGroup, myJmxProxyFactory, myTableRepairMetrics, myRepairResourceFactory, myRepairLockFactory); Collection<RepairTask> repairTasks = repairGroup.getRepairTasks(); assertThat((repairTasks).isEmpty()).isFalse(); RepairTask repairTask = repairTasks.iterator().next(); assertThat(repairTask.getReplicas()).isEqualTo(hosts); assertThat(repairTask.getTokenRanges()).isEqualTo(ranges); assertThat(repairTask.getTableReference()).isEqualTo(tableReference); assertThat(repairTask.getRepairConfiguration().getRepairParallelism()).isEqualTo(RepairOptions.RepairParallelism.PARALLEL); }