@POST
    @Path("/generate_regex")
    @Timed
    @ApiOperation(value = "Generates a regex that can be used as a value for a whitelist entry.")
    @NoAuditEvent("Utility function only.")
    @Consumes(MediaType.APPLICATION_JSON)
    public WhitelistRegexGenerationResponse generateRegex(@ApiParam(name = "JSON body", required = true)
                                                          @Valid @NotNull final WhitelistRegexGenerationRequest generationRequest) {
        final String regex;
        if (generationRequest.placeholder() == null) {
            regex = regexHelper.createRegexForUrl(generationRequest.urlTemplate());
        } else {
            regex = regexHelper.createRegexForUrlTemplate(generationRequest.urlTemplate(),
                    generationRequest.placeholder());
        }
        return WhitelistRegexGenerationResponse.create(regex);
    }
@Test
    public void generateRegexForTemplate() {
        final WhitelistRegexGenerationRequest request =
                WhitelistRegexGenerationRequest.create("https://example.com/api/lookup?key=${key}", "${key}");
        final WhitelistRegexGenerationResponse response = urlWhitelistResource.generateRegex(request);
        assertThat(response.regex()).isNotBlank();
    }