blob: d8e3cc22354c4defa67cb837c001d0d67e97ce05 [file] [log] [blame]
class SafeNavigationTest extends GroovyTestCase {
void testNormalPropertyNavigation() {
x = ['foo':['bar':123, 'x':456], 'z':99]
y = x->foo->bar
println("found y ${x->foo->bar}")
assert y == 123
}
void testNullPropertyNavigation() {
x = null
y = x->foo->bar
assert y == null
java.awt.Color color = null
a = color->alpha
assert a == null
}
void testNormalMethodCall() {
x = 1234
y = x->toString()
assert y == "1234"
}
void testNullMethodCall() {
x = null
y = x->toString()
assert y == null
}
}