<expression> expected, got '=' for variable assignment in Groovy

in is a reserved word used for loops. Rename it to something else (line 5) and its will work

Here is an example:

​class Testing {
    static void getJsonAsString(String endPointUrl) { 
         BufferedReader reader= null; 
         println"hello: $endPointUrl"
    } 
}

def t = new Testing()
t.getJsonAsString(​"http://google.com")​​​​​​​​​

// and this is how "in" can be used
for( i in [1,2,3,4]) {
   println i
}​

This is a working code that prints:

hello: http://google.com
1
2
3
4