@Test
public void testSubsegmentRunnableExceptionWhenMissingContext() {

    RuntimeException expectedException = new RuntimeException("To be thrown by runnable");
    Runnable runnable = () -> {
        throw expectedException;
    };
    AWSXRayRecorder recorder = AWSXRayRecorderBuilder.standard()
                                                     .withContextMissingStrategy(new IgnoreErrorContextMissingStrategy())
                                                     .build();
    assertThatThrownBy(() -> recorder.createSubsegment("test", runnable)).isEqualTo(expectedException);
}