mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 09:28:55 -04:00
Refactor TestBuildInfoPluginFuncTest for clarity (#128469)
* Refactor TestBuildInfoPluginFuncTest for clarity * Further simplify TestBuildInfoPluginFuncTest
This commit is contained in:
parent
0404c077de
commit
a78f1f04b7
1 changed files with 16 additions and 22 deletions
|
@ -39,17 +39,6 @@ class TestBuildInfoPluginFuncTest extends AbstractGradleFuncTest {
|
|||
}
|
||||
"""
|
||||
|
||||
when:
|
||||
def result = gradleRunner('generateTestBuildInfo').build()
|
||||
def task = result.task(":generateTestBuildInfo")
|
||||
|
||||
|
||||
then:
|
||||
task.outcome == TaskOutcome.SUCCESS
|
||||
|
||||
def output = file("build/generated-build-info/plugin-test-build-info.json")
|
||||
output.exists() == true
|
||||
|
||||
def location = Map.of(
|
||||
"module", "com.example",
|
||||
"representative_class", "com/example/Example.class"
|
||||
|
@ -58,6 +47,15 @@ class TestBuildInfoPluginFuncTest extends AbstractGradleFuncTest {
|
|||
"component", "example-component",
|
||||
"locations", List.of(location)
|
||||
)
|
||||
|
||||
def output = file("build/generated-build-info/plugin-test-build-info.json")
|
||||
|
||||
when:
|
||||
def result = gradleRunner('generateTestBuildInfo').build()
|
||||
|
||||
then:
|
||||
result.task(":generateTestBuildInfo").outcome == TaskOutcome.SUCCESS
|
||||
output.exists() == true
|
||||
new ObjectMapper().readValue(output, Map.class) == expectedOutput
|
||||
}
|
||||
|
||||
|
@ -87,16 +85,7 @@ class TestBuildInfoPluginFuncTest extends AbstractGradleFuncTest {
|
|||
}
|
||||
"""
|
||||
|
||||
when:
|
||||
def result = gradleRunner('generateTestBuildInfo').build()
|
||||
def task = result.task(":generateTestBuildInfo")
|
||||
|
||||
|
||||
then:
|
||||
task.outcome == TaskOutcome.SUCCESS
|
||||
|
||||
def output = file("build/generated-build-info/plugin-test-build-info.json")
|
||||
output.exists() == true
|
||||
|
||||
def locationFromModuleInfo = Map.of(
|
||||
"module", "org.objectweb.asm",
|
||||
|
@ -115,7 +104,12 @@ class TestBuildInfoPluginFuncTest extends AbstractGradleFuncTest {
|
|||
"locations", List.of(locationFromModuleInfo, locationFromManifest, locationFromJarFileName)
|
||||
)
|
||||
|
||||
def value = new ObjectMapper().readValue(output, Map.class)
|
||||
value == expectedOutput
|
||||
when:
|
||||
def result = gradleRunner('generateTestBuildInfo').build()
|
||||
|
||||
then:
|
||||
result.task(":generateTestBuildInfo").outcome == TaskOutcome.SUCCESS
|
||||
output.exists() == true
|
||||
new ObjectMapper().readValue(output, Map.class) == expectedOutput
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue