Skip to content

Commit 931deb9

Browse files
committed
TestBuildInfoPluginFuncTest check the file's contents
1 parent 854df10 commit 931deb9

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

build-tools/src/integTest/groovy/org/elasticsearch/gradle/test/TestBuildInfoPluginFuncTest.groovy

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.elasticsearch.gradle.test
22

3+
import com.fasterxml.jackson.databind.ObjectMapper
34

45
import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
56
import org.gradle.testkit.runner.TaskOutcome
@@ -39,8 +40,24 @@ class TestBuildInfoPluginFuncTest extends AbstractGradleFuncTest{
3940

4041
when:
4142
def result = gradleRunner('generateTestBuildInfo').build()
43+
def task = result.task(":generateTestBuildInfo")
44+
4245

4346
then:
44-
result.task(":generateTestBuildInfo").outcome == TaskOutcome.SUCCESS
47+
task.outcome == TaskOutcome.SUCCESS
48+
49+
def output = file("build/generated-build.info/test-build-info.json")
50+
output.exists() == true
51+
52+
def location = Map.of(
53+
"module", "com.example",
54+
"representativeClass", "com/example/Example.class"
55+
)
56+
def expectedOutput = Map.of(
57+
"component", "example-component",
58+
"locations", List.of(location)
59+
)
60+
expectedOutput == new ObjectMapper().readValue(output, Map.class)
61+
4562
}
4663
}

0 commit comments

Comments
 (0)