@Test
public void testPollBatch() {

	try {
		ClosableBlockingQueue<String> queue = new ClosableBlockingQueue<>();
		assertNull(queue.pollBatch());
		
		queue.add("a");
		queue.add("b");
		
		assertEquals(asList("a", "b"), queue.pollBatch());
		assertNull(queue.pollBatch());
		
		queue.add("c");
		assertEquals(singletonList("c"), queue.pollBatch());
		assertNull(queue.pollBatch());
		assertTrue(queue.close());
		try {
			queue.pollBatch();
			fail("should cause an exception");
		} catch (IllegalStateException ignored) {
			// expected
		}
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}