IntelliJ IDEA ожидает объект внутри закрытия мира. Таким образом, вы можете определить следующий блок в файле определений КАЖДОГО шага:
World {
new MockedTestWorld()
}
MockedTestWorld.groovy:
class MockedTestWorld implements TestWorld {
@Lazy
@Delegate
@SuppressWarnings("GroovyAssignabilityCheck")
private TestWorld delegate = {
throw new UnsupportedOperationException("" +
"Test world mock is used ONLY for syntax highlighting in IDE" +
" and must be overridden by concrete 'InitSteps.groovy' implementation.")
}()
}
Чтобы очистить дублированные определения мира, мы используем инициализаторы last-glue и немного копипасты:
реальный/InitSteps.groovy
def world
[email protected]()
GroovyBackend.instance.registerWorld {
return world ?: (world = new RealTestWorld1()) // Actual initialization is much longer
}
устаревший/InitSteps.groovy
def world
[email protected]()
GroovyBackend.instance.registerWorld {
return world ?: (world = new LegacyTestWorld1())
}
Наконец, конфигурации запуска будут такими (с разными клеями):
// Real setup
glue = { "classpath:test/steps", "classpath:test/real", },
// Legacy setup
glue = { "classpath:test/steps", "classpath:test/legacy", },
person
ursa
schedule
27.09.2018