What’s a good way to write unit tests for gradle custom plugin’s extension to ensure DSL in build.gradle results in appropriate behavior? I can invoke my plugin and check my extension’s type but am unsure how to push configurations into it using a string.
@BeforeClass
public static void setupOnce() {
project = ProjectBuilder.builder().build()
project.apply plugin: 'bambooPlanPlugin'
}
@Test
public void checkExtensionAccess() {
assertTrue(project.extensions.getByName('bamboobuild') instanceof BambooBuildExtension)
}
@Test
public void parseExtensionConfig() {
def = "bamboobuild { projects { foo { var = 'bar' } } }"
... Now I'm usure of this part
assertEquals( check extension value against expected foo and bar