This page is no longer maintained — Please continue to the home page at

Testing Option with Scalatest

1 reply
Joined: 2011-09-14,
User offline. Last seen 28 weeks 3 days ago.
Dear all,
have you got any experience on testing the result of a function which might return an optional value through ScalaTest?
I want to do the following
result match {Some(x)=>assert somethingNone=> ERROR}
Thank you very much
Best RegardsEdmondo
Peter 2
Joined: 2011-02-16,
User offline. Last seen 42 years 45 weeks ago.
Re: Testing Option with Scalatest

Hello Edmondo,

result should be (Some(x))

will report an error whenever result is None or result is not equal to


Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland