@Test
  public void shouldNotAttemptReQueueIfNoTestHasBeenPulled() {
    final Collection<String> additions = newLinkedList();
    Queue<String> queue =
        new LinkedList<String>() {
          private static final long serialVersionUID = -1L;

          @Override
          public boolean add(String o) {
            return additions.add(o);
          }
        };
    QueueProcessor processor = createMock(QueueProcessor.class);
    processor.close();
    replay(processor);

    ProcessorRunnable runnable =
        new ProcessorRunnable(
            queue, processor, null, 1, createNiceMock(ConcurrencyController.class));
    Thread.currentThread().interrupt();
    runnable.run();
    assertTrue(additions.isEmpty());
    verify(processor);
  }
 private void enablePartition() {
   if ("LEADER".equals(getNodeStatus())) {
     return;
   }
   participantManager
       .getClusterManagmentTool()
       .enablePartition(
           true, clusterName, instanceName, resourceName, asList(resourceName + "_0"));
   while (!"LEADER".equals(getNodeStatus())) {
     try {
       Thread.sleep(10);
     } catch (InterruptedException e) {
     }
   }
 }
  /**
   * Forks this repository into an organization.
   *
   * @return Newly forked repository that belong to you.
   */
  public GHRepository forkTo(GHOrganization org) throws IOException {
    new Requester(root)
        .to(String.format("/repos/%s/%s/forks?org=%s", owner.login, name, org.getLogin()));

    // this API is asynchronous. we need to wait for a bit
    for (int i = 0; i < 10; i++) {
      GHRepository r = org.getRepository(name);
      if (r != null) return r;
      try {
        Thread.sleep(3000);
      } catch (InterruptedException e) {
        throw (IOException) new InterruptedIOException().initCause(e);
      }
    }
    throw new IOException(
        this + " was forked into " + org.getLogin() + " but can't find the new repository");
  }
  private void disablePartition() {
    String nodeStatus = getNodeStatus();
    if ("STANDBY".equals(nodeStatus) || "OFFLINE".equals(nodeStatus)) {
      return;
    }
    participantManager
        .getClusterManagmentTool()
        .enablePartition(
            false, clusterName, instanceName, resourceName, asList(resourceName + "_0"));

    while (!("STANDBY".equals(nodeStatus) || "OFFLINE".equals(nodeStatus))) {
      try {
        Thread.sleep(10);
        nodeStatus = getNodeStatus();
      } catch (InterruptedException e) {
      }
    }
  }
 @After
 public void cleanup() {
   // Clear interrupted state
   Thread.interrupted();
 }