Allow string interpolation in error message
Single-quoted groovy strings are plain java.lang.String and don't
support interpolation. Therefore, the error message looks like this:
ERROR: Detected invalid branch (expected=[$br] != found=[$branch])
In order to get string interpolation, we need to use a double-quoted
string.
The curly braces are not necessary, but having them allows
npm-groovy-lint to detect the very mistake that is being fixed by this
commit. The linter then emits a warning like this:
41 warning The String '(expected=[${br}] != found=[${branch}])' contains a GString-type expression: '${br}] != found=[${branch}' GStringExpressionWithinString
Signed-off-by: Roger Luethi <roger@opennetworking.org>
Change-Id: Ia50d35fb143b0efb2c9722f3de07f0447a10dd54
diff --git a/jjb/pipeline/voltha/bbsim-tests.groovy b/jjb/pipeline/voltha/bbsim-tests.groovy
index 2941e2c..eccb0fc 100644
--- a/jjb/pipeline/voltha/bbsim-tests.groovy
+++ b/jjb/pipeline/voltha/bbsim-tests.groovy
@@ -38,7 +38,7 @@
if (br != branch) {
String err = [
'ERROR: Detected invalid branch',
- '(expected=[$br] != found=[$branch])'
+ "(expected=[${br}] != found=[${branch}])"
].join(' ')
throw new Exception(err) // groovylint-disable-line ThrowException
}