@Test
public void testGetElementBlocking() {

	try {
		ClosableBlockingQueue<String> queue = new ClosableBlockingQueue<>();
		assertNull(queue.getElementBlocking(1));
		assertNull(queue.getElementBlocking(3));
		assertNull(queue.getElementBlocking(2));
		assertEquals(0, queue.size());
		queue.add("a");
		queue.add("b");
		queue.add("c");
		queue.add("d");
		queue.add("e");
		queue.add("f");
		assertEquals(6, queue.size());
		assertEquals("a", queue.getElementBlocking(99));
		assertEquals("b", queue.getElementBlocking());
		assertEquals(4, queue.size());
		assertEquals("c", queue.getElementBlocking(0));
		assertEquals("d", queue.getElementBlocking(1000000));
		assertEquals("e", queue.getElementBlocking());
		assertEquals("f", queue.getElementBlocking(1786598));
		assertEquals(0, queue.size());
		assertNull(queue.getElementBlocking(1));
		assertNull(queue.getElementBlocking(3));
		assertNull(queue.getElementBlocking(2));
		assertTrue(queue.close());
		try {
			queue.getElementBlocking();
			fail("should cause an exception");
		} catch (IllegalStateException ignored) {
			// expected
		}
		try {
			queue.getElementBlocking(1000000000L);
			fail("should cause an exception");
		} catch (IllegalStateException ignored) {
			// expected
		}
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}