Code example for ArrayBlockingQueue

Methods: poll

  public void processMessage(Chat chat, Message 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);
Connect your IDE to all the code out there  Get Codota for Java