...
| Code Block |
|---|
def numbers = [1,2,3] assert numbers //true, as numbers in not empty numbers = [] assert !numbers //numbers is now false, atas itnumbers is now an empty collection |
Maps
Non-empty maps are coerced to true.
...
| Code Block |
|---|
assert ('Hello World' =~ /World/) //true because matcher has at least one match
|
...
Strings
Non-empty Strings, GStrings and CharSequences are coerced to true.
...