package uk.co.deliverymind.lightning.gradle.plugin;

import org.gradle.testkit.runner.BuildResult;
import org.gradle.testkit.runner.GradleRunner;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import java.io.File;

import static org.gradle.internal.impldep.org.hamcrest.MatcherAssert.assertThat;
import static org.gradle.internal.impldep.org.hamcrest.core.Is.is;
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS;

public class GradleCompatibilityTest {

    @Test(dataProvider = "getGradleVersions")
    public void checkGradleCompatibility(String gradleVersion) {
        BuildResult result = GradleRunner.create()
                .withGradleVersion(gradleVersion)
                .withProjectDir(new File("src/integrationTest/resources/build/complete"))
                .withArguments(":report")
                .withPluginClasspath()
                .build();

        assertThat(result.task(":report").getOutcome(), is(SUCCESS));
    }

    @DataProvider
    private Object[][] getGradleVersions() {
        return new Object[][] {
                new Object[] { "2.8" },
                new Object[] { "2.9" },
                new Object[] { "2.10" },
                new Object[] { "2.11" },
                new Object[] { "2.12" },
                new Object[] { "2.13" },
                new Object[] { "2.14" },
                new Object[] { "2.14.1" },
                new Object[] { "3.0" },
                new Object[] { "3.1" },
                new Object[] { "3.2" },
                new Object[] { "3.2.1" },
                new Object[] { "3.3" }
        };
    }
}

@@ -1112,499 +1112,92 @@
  %222.
-8%22 %7D,%0A                new Object%5B%5D %7B %222.9%22 %7D,%0A                new Object%5B%5D %7B %222.10%22 %7D,%0A                new Object%5B%5D %7B %222.11%22 %7D,%0A                new Object%5B%5D %7B %222.12%22 %7D,%0A                new Object%5B%5D %7B %222.13%22 %7D,%0A                new Object%5B%5D %7B %222.14%22 %7D,%0A                new Object%5B%5D %7B %222.14.1%22 %7D,%0A                new Object%5B%5D %7B %223.0%22 %7D,%0A                new Object%5B%5D %7B %223.1%22 %7D,%0A                new Object%5B%5D %7B %223.2%22 %7D,%0A                new Object%5B%5D %7B %223.2.1%22 %7D,%0A                new Object%5B%5D %7B %223.3
+14.1%22 %7D,%0A                new Object%5B%5D %7B %223.5%22 %7D,%0A                new Object%5B%5D %7B %224.0
 %22 %7D%0A

Update Gradle compatibility checklist