use of software.amazon.awssdk.core.interceptor.ExecutionAttributes in project aws-xray-sdk-java by aws.
the class TracingInterceptorTest method testNoHeaderAddedWhenPropagationOff.
@Test
public void testNoHeaderAddedWhenPropagationOff() {
Subsegment subsegment = Subsegment.noOp(AWSXRay.getGlobalRecorder(), false);
TracingInterceptor interceptor = new TracingInterceptor();
Context.ModifyHttpRequest context = Mockito.mock(Context.ModifyHttpRequest.class);
SdkHttpRequest mockRequest = Mockito.mock(SdkHttpRequest.class);
SdkHttpRequest.Builder mockRequestBuilder = Mockito.mock(SdkHttpRequest.Builder.class);
when(context.httpRequest()).thenReturn(mockRequest);
Mockito.lenient().when(context.httpRequest().toBuilder()).thenReturn(mockRequestBuilder);
ExecutionAttributes attributes = new ExecutionAttributes();
attributes.putAttribute(TracingInterceptor.entityKey, subsegment);
interceptor.modifyHttpRequest(context, attributes);
verify(mockRequest.toBuilder(), never()).appendHeader(anyString(), anyString());
}
Aggregations