Last active
June 19, 2017 12:20
-
-
Save frangarcia/c0ead9d1ba01081c7a386b107cf43ce4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grapes([ | |
@Grab(group='io.vertx', module='vertx-core', version='3.4.1'), | |
@Grab(group='io.vertx', module='vertx-lang-groovy', version='3.4.1') | |
]) | |
import io.vertx.core.* | |
import io.vertx.core.json.* | |
JsonObject jo1 = new JsonObject() | |
assert "jo1 is a ${jo1?.class?.name}" == "jo1 is a io.vertx.core.json.JsonObject" | |
assert (jo1 as Map) instanceof Map | |
JsonObject jo2 = new JsonObject([:]) | |
assert "jo2 is a ${jo2?.class?.name}" == "jo2 is a io.vertx.core.json.JsonObject" | |
assert (jo2 as Map) instanceof Map | |
JsonObject jo3 = new JsonObject([a:1]) | |
assert "jo3 is a ${jo2?.class?.name}" == "jo3 is a io.vertx.core.json.JsonObject" | |
try { | |
println (jo3 as Map) | |
} catch (Exception e) { | |
assert true:"An exception has been thrown" | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment