@Test
public void testGetBatchBlocking() {

	try {
		ClosableBlockingQueue<String> queue = new ClosableBlockingQueue<>();
		assertEquals(emptyList(), queue.getBatchBlocking(1));
		assertEquals(emptyList(), queue.getBatchBlocking(3));
		assertEquals(emptyList(), queue.getBatchBlocking(2));
		queue.add("a");
		queue.add("b");
		assertEquals(asList("a", "b"), queue.getBatchBlocking(900000009));
		queue.add("c");
		queue.add("d");
		assertEquals(asList("c", "d"), queue.getBatchBlocking());
		assertEquals(emptyList(), queue.getBatchBlocking(2));
		queue.add("e");
		assertEquals(singletonList("e"), queue.getBatchBlocking(0));
		queue.add("f");
		assertEquals(singletonList("f"), queue.getBatchBlocking(1000000000));
		assertEquals(0, queue.size());
		assertEquals(emptyList(), queue.getBatchBlocking(1));
		assertEquals(emptyList(), queue.getBatchBlocking(3));
		assertEquals(emptyList(), queue.getBatchBlocking(2));
		assertTrue(queue.close());
		try {
			queue.getBatchBlocking();
			fail("should cause an exception");
		} catch (IllegalStateException ignored) {
			// expected
		}
		try {
			queue.getBatchBlocking(1000000000L);
			fail("should cause an exception");
		} catch (IllegalStateException ignored) {
			// expected
		}
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}