void setRequestPath(ServletRequest req, final String destinationPath) {
        if (req instanceof AwsProxyHttpServletRequest) {
            ((AwsProxyHttpServletRequest) req).getAwsProxyRequest().setPath(dispatchTo);
            return;
        }
        if (req instanceof AwsHttpApiV2ProxyHttpServletRequest) {
            ((AwsHttpApiV2ProxyHttpServletRequest) req).getRequest().setRawPath(destinationPath);
            return;
        }

        log.debug("Request is not an proxy request generated by this library, attempting to extract the proxy event type from the request attributes");
        if (req.getAttribute(API_GATEWAY_EVENT_PROPERTY) != null && req.getAttribute(API_GATEWAY_EVENT_PROPERTY) instanceof AwsProxyRequest) {
            ((AwsProxyRequest)req.getAttribute(API_GATEWAY_EVENT_PROPERTY)).setPath(dispatchTo);
            return;
        }
        if (req.getAttribute(HTTP_API_EVENT_PROPERTY) != null && req.getAttribute(HTTP_API_EVENT_PROPERTY) instanceof HttpApiV2ProxyRequest) {
            ((HttpApiV2ProxyRequest)req.getAttribute(HTTP_API_EVENT_PROPERTY)).setRawPath(destinationPath);
            return;
        }

        throw new IllegalStateException("Could not set new target path for the given ServletRequest object");
    }
@Test
    void setPathForWrappedRequest_forwardByPath_proxyRequestObjectInPropertyReferencesSameProxyRequest() throws InvalidRequestEventException {
        AwsProxyRequest proxyRequest = new AwsProxyRequestBuilder("/hello", "GET").build();
        HttpServletRequest servletRequest = requestReader.readRequest(proxyRequest, null, new MockLambdaContext(), ContainerConfig.defaultConfig());
        SecurityContextHolderAwareRequestWrapper springSecurityRequest = new SecurityContextHolderAwareRequestWrapper(servletRequest, "ADMIN");

        AwsProxyRequestDispatcher dispatcher = new AwsProxyRequestDispatcher(FORWARD_PATH, false, null);
        dispatcher.setRequestPath(springSecurityRequest, FORWARD_PATH);
        assertEquals(FORWARD_PATH, springSecurityRequest.getRequestURI());
    }