@Test
public void testSubsegmentConsumerExceptionWhenMissingContext() {

    IllegalStateException expectedException = new IllegalStateException("To be thrown by consumer");
    Consumer<Subsegment> consumer = (subsegment) -> {
        throw expectedException;
    };
    AWSXRayRecorder recorder = AWSXRayRecorderBuilder.standard()
                                                     .withContextMissingStrategy(new IgnoreErrorContextMissingStrategy())
                                                     .build();
    assertThatThrownBy(() -> recorder.createSubsegment("test", consumer)).isEqualTo(expectedException);
}