class X def main sep = '---' s = 'a[sep]c[sep]' # assert s.count(sep) == 2 -- this made test pass, but that's not the fix we're looking for assert s.split(sep, 2).length == 2 a, c = s.split(sep, 2) # used to fail due to incorrect method binding by Cobra assert a == 'a' assert c == 'c' + sep