@Test
public void updateRepairRunIntensityTest() throws ReaperException, InterruptedException {

  final String clusterName = "reaper";
  AppContext context = new AppContext();
  context.config = new ReaperApplicationConfiguration();
  context.storage = mock(IStorage.class);
  context.storage
      .addCluster(Cluster.builder().withName(clusterName).withSeedHosts(ImmutableSet.of("127.0.0.1")).build());
  context.repairManager = RepairManager.create(
      context,
      Executors.newScheduledThreadPool(1),
      500,
      TimeUnit.MILLISECONDS,
      1,
      TimeUnit.MILLISECONDS);
  final String ksName = "reaper";
  final Set<String> cfNames = Sets.newHashSet("reaper");
  final boolean incrementalRepair = false;
  final Set<String> nodes = Sets.newHashSet("127.0.0.1");
  final Set<String> datacenters = Collections.emptySet();
  final int repairThreadCount = 1;
  final RepairUnit cf = RepairUnit.builder()
      .clusterName(clusterName)
      .keyspaceName(ksName)
      .columnFamilies(cfNames)
      .incrementalRepair(incrementalRepair)
      .nodes(nodes)
      .datacenters(datacenters)
      .repairThreadCount(repairThreadCount)
      .build(UUIDs.timeBased());
  double intensity = 0.5f;
  final RepairRun run = RepairRun.builder(clusterName, cf.getId())
          .intensity(intensity)
          .segmentCount(1)
          .repairParallelism(RepairParallelism.PARALLEL)
          .tables(TABLES)
          .build(UUIDs.timeBased());
  when(context.storage.updateRepairRun(any(), any())).thenReturn(true);
  intensity = 0.1;
  RepairRun updated = context.repairManager.updateRepairRunIntensity(run, intensity);
  Assertions.assertThat(updated.getId()).isEqualTo(run.getId());
  Assertions.assertThat(updated.getIntensity()).isEqualTo(intensity);
  Mockito.verify(context.storage, Mockito.times(1)).updateRepairRun(any(), any());
}