void setDeprecationHeaders(Request request, Response response, DeprecatedAPI controller) {
        String deprecatedRelease = controller.deprecatedIn();
        String removalRelease = controller.removalIn();
        String entityName = controller.entityName();
        ApiVersion deprecatedApiVersion = controller.deprecatedApiVersion();
        ApiVersion successorApiVersion = controller.successorApiVersion();

        String changelogUrl = format("https://api.gocd.org/%s/#api-changelog", deprecatedRelease);
        String link = format("<%s>; Accept=\"%s\"; rel=\"successor-version\"", request.url(), successorApiVersion.mimeType());
        String warning = format("299 GoCD/v%s \"The %s API version %s has been deprecated in GoCD Release v%s. This version will be removed in GoCD Release v%s. Version %s of the API is available, and users are encouraged to use it\"", deprecatedRelease, entityName, deprecatedApiVersion, deprecatedRelease, removalRelease, successorApiVersion);

        response.header("X-GoCD-API-Deprecated-In", format("v%s", deprecatedRelease));
        response.header("X-GoCD-API-Removal-In", format("v%s", removalRelease));
        response.header("X-GoCD-API-Deprecation-Info", changelogUrl);
        response.header("Link", link);
        response.header("Warning", warning);
    }
@Test
    void shouldAddDeprecationHeaders() {
        DoNothingApiV1 doNothingApiV1 = new DoNothingApiV1();

        RoutesHelper helper = new RoutesHelper(doNothingApiV1);

        Request request = mock(Request.class);
        Response response = mock(Response.class);
        when(request.url()).thenReturn("http://test.host:80/go");

        helper.setDeprecationHeaders(request, response, doNothingApiV1.getClass().getAnnotation(DeprecatedAPI.class));

        verify(response).header("X-GoCD-API-Deprecated-In", "v20.2.0");
        verify(response).header("X-GoCD-API-Removal-In", "v20.5.0");
        verify(response).header("X-GoCD-API-Deprecation-Info", "https://api.gocd.org/20.2.0/#api-changelog");
        verify(response).header("Link", "<http://test.host:80/go>; Accept=\"application/vnd.go.cd.v2+json\"; rel=\"successor-version\"");
        verify(response).header("Warning", "299 GoCD/v20.2.0 \"The Do Nothing API version v1 has been deprecated in GoCD Release v20.2.0. This version will be removed in GoCD Release v20.5.0. Version v2 of the API is available, and users are encouraged to use it\"");
    }