Code example for ArrayBlockingQueue

Methods: poll

0
    messages.add(message);
  } 
 
  public void receivesAMessage() throws InterruptedException 
  { 
    assertThat(messages.poll(5, TimeUnit.SECONDS)).isNotNull();
  } 
 
  public void receivesAMessage(Matcher<? super String> messageMatcher) throws InterruptedException
  { 
    final Message message = messages.poll(5, TimeUnit.SECONDS);
    assertThat(message).isNotNull();
    assertThat(message.getBody(), messageMatcher);
  } 
}