Hey all, so I'm encountering some very odd behavior...So I have a session attribute "foo" which is paired with an Integer, 1:
session.set("foo", 1)session("foo").as[String] returns '1' (but it's an Integer)
session("foo").as[String].getClass returns 'class java.lang.Integer'
session("foo").as[String].toString throws an exception, saying java.lang.Integer cannot be cast to java.lang.String
session("foo").as[Int].toString returns the expected integer as a string.
--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ok, so at least it's expected. I guess I was just surprised I hadn't encountered it before now! I'm also surprised that Integer.asInstanceOf[String] doesn't automatically call .toString.
And I feel like that behavior is definitely useful in an Option, where you have two layers of indirection: The Option type and then the generic value type. In any case, it's a simple fix for now. I haven't set up my project to use Validations in any more useful way then Options yet, so it's a to-do.
Thanks again for the useful explanations Stéphane and Pierre!