@SdkInternalApi
    final TestSegmentPatternResult executeTestSegmentPattern(TestSegmentPatternRequest testSegmentPatternRequest) {

        ExecutionContext executionContext = createExecutionContext(testSegmentPatternRequest);
        AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
        awsRequestMetrics.startEvent(Field.ClientExecuteTime);
        Request<TestSegmentPatternRequest> request = null;
        Response<TestSegmentPatternResult> response = null;

        try {
            awsRequestMetrics.startEvent(Field.RequestMarshallTime);
            try {
                request = new TestSegmentPatternRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(testSegmentPatternRequest));
                // Binds the request metrics to the current request.
                request.setAWSRequestMetrics(awsRequestMetrics);
                request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
                request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
                request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
                request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Evidently");
                request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TestSegmentPattern");
                request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);

            } finally {
                awsRequestMetrics.endEvent(Field.RequestMarshallTime);
            }

            HttpResponseHandler<AmazonWebServiceResponse<TestSegmentPatternResult>> responseHandler = protocolFactory.createResponseHandler(
                    new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new TestSegmentPatternResultJsonUnmarshaller());
            response = invoke(request, responseHandler, executionContext);

            return response.getAwsResponse();

        } finally {

            endClientExecution(awsRequestMetrics, request, response);
        }
    }
<p>
Use this operation to test a rules pattern that you plan to use to create an audience segment. For more
information about segments, see <a
href="https://docs.aws.amazon.com/cloudwatchevidently/latest/APIReference/API_CreateSegment.html"
>CreateSegment</a>.
</p>

@param testSegmentPatternRequest
@return Result of the TestSegmentPattern operation returned by the service.
@throws ThrottlingException
        The request was denied because of request throttling. Retry the request.
@throws ValidationException
        The value of a parameter in the request caused an error.
@throws AccessDeniedException
        You do not have sufficient permissions to perform this action.
@sample AmazonCloudWatchEvidently.TestSegmentPattern
@see <a href="http://docs.aws.amazon.com/goto/WebAPI/evidently-2021-02-01/TestSegmentPattern" target="_top">AWS
     API Documentation</a>
aws-java-sdk-cloudwatchevidently/src/main/java/com/amazonaws/services/cloudwatchevidently/AmazonCloudWatchEvidentlyClient.java