use of org.junitpioneer.jupiter.SetEnvironmentVariable in project aws-xray-sdk-java by aws.
the class LambdaSegmentContextTest method testEndSubsegmentUsesContextMissing.
@Test
@SetEnvironmentVariable(key = "_X_AMZN_TRACE_ID", value = TRACE_HEADER)
void testEndSubsegmentUsesContextMissing() {
AWSXRay.getGlobalRecorder().setContextMissingStrategy(new LogErrorContextMissingStrategy());
// No exception
AWSXRay.endSubsegment();
AWSXRay.getGlobalRecorder().setContextMissingStrategy(new RuntimeErrorContextMissingStrategy());
assertThatThrownBy(AWSXRay::endSubsegment).isInstanceOf(SubsegmentNotFoundException.class);
}
Aggregations