mirror of https://github.com/apache/druid.git
Add test for exceptions in FutureUtils.transformAsync. (#17106)
Adds an additional test case to FutureUtilsTest.
This commit is contained in:
parent
ca0cb64ee8
commit
2d2882cdfe
|
@ -243,6 +243,32 @@ public class FutureUtilsTest
|
|||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_transformAsync_exceptionInFunction()
|
||||
{
|
||||
final ListenableFuture<Object> f = FutureUtils.transformAsync(
|
||||
Futures.immediateFuture("x"),
|
||||
s -> {
|
||||
throw new ISE("error!");
|
||||
}
|
||||
);
|
||||
|
||||
final ExecutionException e = Assert.assertThrows(
|
||||
ExecutionException.class,
|
||||
f::get
|
||||
);
|
||||
|
||||
MatcherAssert.assertThat(
|
||||
e,
|
||||
ThrowableCauseMatcher.hasCause(CoreMatchers.instanceOf(ISE.class))
|
||||
);
|
||||
|
||||
MatcherAssert.assertThat(
|
||||
e,
|
||||
ThrowableCauseMatcher.hasCause(ThrowableMessageMatcher.hasMessage(CoreMatchers.containsString("error!")))
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_coalesce_allOk() throws Exception
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue