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

  DateTimeUtils.setCurrentMillisFixed(TIME_CREATE);
  RepairRunResource resource = new RepairRunResource(context);
  Response response = addDefaultRepairRun(resource);
  assertTrue(response.getEntity().toString(), response.getEntity() instanceof RepairRunStatus);
  RepairRunStatus repairRunStatus = (RepairRunStatus) response.getEntity();
  UUID runId = repairRunStatus.getId();
  DateTimeUtils.setCurrentMillisFixed(TIME_START);
  Optional<String> newState = Optional.of(RepairRun.RunState.RUNNING.toString());
  resource.modifyRunState(uriInfo, runId, newState);
  Thread.sleep(1000);
  response = resource.modifyRunState(uriInfo, runId, newState);
  assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
  // Adding a second run that we'll try to set to RUNNING status
  RepairRunResource newResource = new RepairRunResource(context);
  Response newResponse = addDefaultRepairRun(newResource);
  RepairRunStatus newRepairRunStatus = (RepairRunStatus) newResponse.getEntity();
  UUID newRunId = newRepairRunStatus.getId();
  DateTimeUtils.setCurrentMillisFixed(TIME_START);
  Optional<String> newRunState = Optional.of(RepairRun.RunState.RUNNING.toString());
  response = resource.modifyRunState(uriInfo, newRunId, newRunState);
  // We expect it to fail as we cannot have 2 running runs for the same repair unit at once
  assertEquals(Response.Status.CONFLICT.getStatusCode(), response.getStatus());
}