@Test
public void testTakeWithException() throws Exception {

	AsyncBroker<String, String> asyncBroker = new AsyncBroker<>();
	Map<String, DefaultNoticeableFuture<String>> defaultNoticeableFutures =
		ReflectionTestUtil.getFieldValue(
			asyncBroker, "_defaultNoticeableFutures");
	Assert.assertTrue(
		defaultNoticeableFutures.toString(),
		defaultNoticeableFutures.isEmpty());
	Exception exception = new Exception();
	Assert.assertFalse(asyncBroker.takeWithException(_KEY, exception));
	NoticeableFuture<String> noticeableFuture = asyncBroker.post(_KEY);
	Assert.assertEquals(
		defaultNoticeableFutures.toString(), 1,
		defaultNoticeableFutures.size());
	Assert.assertSame(noticeableFuture, defaultNoticeableFutures.get(_KEY));
	Assert.assertTrue(asyncBroker.takeWithException(_KEY, exception));
	try {
		noticeableFuture.get();
		Assert.fail();
	}
	catch (ExecutionException executionException) {
		Assert.assertSame(exception, executionException.getCause());
	}
	Assert.assertTrue(
		defaultNoticeableFutures.toString(),
		defaultNoticeableFutures.isEmpty());
	Assert.assertFalse(asyncBroker.takeWithException(_KEY, exception));
}