【发布时间】:2015-01-12 16:54:18
【问题描述】:
我正在尝试测试通过扩展对象配置的自定义 Gradle 插件,该扩展对象通常存在于 build.gradle 文件中。
例如,我的 build.gradle 通常看起来像这样:
{
apply plugin: 'foobarConfigurator'
[... stuff ...]
foobarConfig {
bar = 'boop'
baz = 'baap'
bot = 'faab'
}
[... stuff ...]
}
在我的自定义插件类中,我有在 apply 方法中执行此操作的代码:
def config = project.extensions.create('foobarConfig', FooBarConfig)
我不清楚在 JUnit 测试中我应该如何编写测试方法,以便我可以在 ProjectBuilder 类创建的 Project 实例中的 foobarConfiguration 中提供和测试不同的配置值。
任何帮助表示赞赏,谢谢!
【问题讨论】:
标签: gradle