Code example for ArrayBlockingQueue

Methods: poll

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