コード例 #1
1
  @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);
  }
コード例 #2
0
 @After
 public void cleanup() {
   // Clear interrupted state
   Thread.interrupted();
 }