@@ -0,0 +1,2837 @@
+package uk.gov.register.functional;%0A%0Aimport io.dropwizard.testing.ConfigOverride;%0Aimport io.dropwizard.testing.ResourceHelpers;%0Aimport io.dropwizard.testing.junit.DropwizardAppRule;%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.junit.runners.Parameterized;%0Aimport uk.gov.register.RegisterApplication;%0Aimport uk.gov.register.RegisterConfiguration;%0A%0Aimport javax.ws.rs.client.Client;%0Aimport javax.ws.rs.core.Response;%0Aimport java.util.Arrays;%0Aimport java.util.Collection;%0A%0Aimport static org.hamcrest.core.IsEqual.equalTo;%0Aimport static org.junit.Assert.assertThat;%0Aimport static uk.gov.register.functional.db.TestDBSupport.postgresConnectionString;%0A%0A@RunWith(Parameterized.class)%0Apublic class DataDownloadResourceFunctionalTest %7B%0A%0A    @Rule%0A    public DropwizardAppRule%3CRegisterConfiguration%3E appRule;%0A%0A    private final String targetUrl;%0A    private final int expectedStatusCode;%0A%0A    public DataDownloadResourceFunctionalTest(Boolean enableDownload, String targetUrl, int expectedStatusCode) %7B%0A        this.appRule = createAppRule(enableDownload);%0A        this.targetUrl = targetUrl;%0A        this.expectedStatusCode = expectedStatusCode;%0A    %7D%0A%0A    @Parameterized.Parameters(name = %22%7Bindex%7D: with download enabled:%7B0%7D -%3E %7B1%7D returns %7B2%7D%22)%0A    public static Collection%3CObject%5B%5D%3E data()%7B%0A        return Arrays.asList(new Object%5B%5D%5B%5D %7B%0A                %7B true, %22/download%22, 200 %7D,%0A                %7B true, %22/download-register%22, 200 %7D,%0A                %7B false, %22/download%22, 200 %7D,%0A                %7B false, %22/download-register%22, 501 %7D%0A        %7D);%0A    %7D%0A%0A    @Test%0A    public void checkDownloadResourceStatusCode() throws Exception %7B%0A        Client client = getTestClient(this.appRule);%0A        Response response = client.target(String.format(%22http://localhost:%25d%25s%22, this.appRule.getLocalPort(), targetUrl))%0A                .request().get();%0A        %0A        assertThat(response.getStatus(), equalTo(expectedStatusCode));%0A    %7D%0A%0A    private Client getTestClient(DropwizardAppRule%3CRegisterConfiguration%3E appRule) %7B%0A        return new io.dropwizard.client.JerseyClientBuilder(appRule.getEnvironment())%0A                .using(appRule.getConfiguration().getJerseyClientConfiguration())%0A                .build(%22test client%22);%0A    %7D%0A%0A    private static DropwizardAppRule%3CRegisterConfiguration%3E createAppRule(Boolean enableResourceDownload)%7B%0A        return new DropwizardAppRule%3C%3E(RegisterApplication.class,%0A                ResourceHelpers.resourceFilePath(%22test-app-config.yaml%22),%0A                ConfigOverride.config(%22database.url%22, postgresConnectionString),%0A                ConfigOverride.config(%22jerseyClient.timeout%22, %223000ms%22),%0A                ConfigOverride.config(%22register%22, %22register%22),%0A                ConfigOverride.config(%22enableDownloadResource%22, enableResourceDownload.toString()));%0A    %7D%0A%7D%0A

Add test to ensure appropriate download pages are returned depending on app configration