com.lesfurets.jenkins.unit.MockPipelineScript.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jenkins-pipeline-unit Show documentation
Show all versions of jenkins-pipeline-unit Show documentation
Jenkins Pipeline Unit testing framework
package com.lesfurets.jenkins.unit
abstract class MockPipelineScript extends Script {
def methodMissing(String name, args) {
if (this._TEST_HELPER.isMethodAllowed(name, args)) {
def result = null
if (args != null) {
for (argument in args) {
result = callIfClosure(argument, result)
if (argument instanceof Map) {
argument.each { k, v ->
result = callIfClosure(k, result)
result = callIfClosure(v, result)
}
}
}
}
return result
} else {
throw new MissingMethodException(name, this.class, args)
}
}
def callIfClosure(Object closure, Object currentResult) {
if (closure instanceof Closure) {
currentResult = closure.call()
}
return currentResult
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy