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(
|
def location = Map.of(
|
||||||
"module", "com.example",
|
"module", "com.example",
|
||||||
"representative_class", "com/example/Example.class"
|
"representative_class", "com/example/Example.class"
|
||||||
|
@ -58,6 +47,15 @@ class TestBuildInfoPluginFuncTest extends AbstractGradleFuncTest {
|
||||||
"component", "example-component",
|
"component", "example-component",
|
||||||
"locations", List.of(location)
|
"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
|
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")
|
def output = file("build/generated-build-info/plugin-test-build-info.json")
|
||||||
output.exists() == true
|
|
||||||
|
|
||||||
def locationFromModuleInfo = Map.of(
|
def locationFromModuleInfo = Map.of(
|
||||||
"module", "org.objectweb.asm",
|
"module", "org.objectweb.asm",
|
||||||
|
@ -115,7 +104,12 @@ class TestBuildInfoPluginFuncTest extends AbstractGradleFuncTest {
|
||||||
"locations", List.of(locationFromModuleInfo, locationFromManifest, locationFromJarFileName)
|
"locations", List.of(locationFromModuleInfo, locationFromManifest, locationFromJarFileName)
|
||||||
)
|
)
|
||||||
|
|
||||||
def value = new ObjectMapper().readValue(output, Map.class)
|
when:
|
||||||
value == expectedOutput
|
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