Skip to content

Commit

Permalink
test(battery): Added gradle wrapper test.
Browse files Browse the repository at this point in the history
  • Loading branch information
taikuukaits committed Oct 15, 2019
1 parent 1da692b commit dee3afd
Showing 1 changed file with 24 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,39 @@
import org.junit.jupiter.api.Test;

import com.synopsys.integration.detect.battery.BatteryTest;
import com.synopsys.integration.detect.battery.ResourceCopyingExecutableCreator;
import com.synopsys.integration.detect.configuration.DetectProperty;

@Tag("battery")
public class GradleBattery {
private static final String RESOURCE_FOLDER = "GRADLE-0";

@Test
void property() {
final BatteryTest test = sharedInspectorTest("gradle-property");
addGradleArguments(test.executableThatCopiesFiles(DetectProperty.DETECT_GRADLE_PATH, RESOURCE_FOLDER));
test.run();
}

@Test
void inspector() {
//Note about this test: The paths have been removed from the inspector meta data.
final BatteryTest test = new BatteryTest("gradle-inspector");
void wrapper() {
final BatteryTest test = sharedInspectorTest("gradle-wrapper");
addGradleArguments(test.executableSourceFileThatCopiesFiles("gradlew.bat", "gradlew", RESOURCE_FOLDER));
test.run();
}

//Note about this test: The paths have been removed from the inspector meta data.
BatteryTest sharedInspectorTest(final String name) {
final BatteryTest test = new BatteryTest(name, "gradle-inspector");
test.sourceDirectoryNamed("linux-gradle");
test.sourceFileNamed("build.gradle");
test.executableThatCopiesFiles(DetectProperty.DETECT_GRADLE_PATH, "GRADLE-0")
.onWindows(5, "")
.onLinux(3, "-DGRADLEEXTRACTIONDIR=");
test.git("https://github.com/BlackDuckCoPilot/example-gradle-travis", "HEAD");
test.expectBdioResources();
test.run();
return test;
}

void addGradleArguments(final ResourceCopyingExecutableCreator resourceCopyingExecutableCreator) {
resourceCopyingExecutableCreator.onWindows(5, "").onLinux(3, "-DGRADLEEXTRACTIONDIR=");
}
}

0 comments on commit dee3afd

Please sign in to comment.