Code example for ArrayBlockingQueue

Methods: poll

public class SingleMessageListener implements MessageListener{ 
	private final ArrayBlockingQueue<Message> messages = new ArrayBlockingQueue<Message>(1);
	public void receivesAMessage() throws InterruptedException { 
		assertThat("Message", messages.poll(5, TimeUnit.SECONDS), is(notNullValue()));		
	public void processMessage(Chat chat, Message message) {
	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