class Example {
static Integer errorCount
static Integer updateGlobalInteger(Integer errorC){
errorCount=errorC
return errorCount
}
static void main(String[] args) {
List<String> log = ["ABCD","WARNING"]
println(log)
def error = log.toString().replace("]","").replace("[","")
println(error)
def contain = error.find("ERROR") //if it is null, then error occur
println(contain)
Integer errorC = contain.size()
println(errorC)
updateGlobalInteger(errorC)
}
}
There is a error msg,
Caught: groovy.lang.MissingMethodException: No signature of method: static
Example.updateGlobalInteger() is applicable for argument types: (java.lang.Integer) values: [10]
Possible solutions: updateGlobalInteger(java.lang.Integer)
groovy.lang.MissingMethodException: No signature of method: static Example.updateGlobalInteger() is
applicable for argument types: (java.lang.Integer) values: [10]
Possible solutions: updateGlobalInteger(java.lang.Integer)
at Example.main(main.groovy:14)
I tested it on https://www.tutorialspoint.com/execute_groovy_online.php
Thanks all, when I tried to execute the code, faced below error.
Condition not satisfied:
updateGlobalInteger(errorC)
| |
0 0
And
java.lang.NullPointerException: Cannot invoke method size() on null object
at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:91)