Created
July 11, 2014 22:57
-
-
Save ivmaykov/a94c81566f77d66fa82b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import org.scalatest.{Matchers, FlatSpec} | |
case class Foo(bar: Option[String]) | |
object Foo { | |
// Unexpectedly, Foo.Default.bar is null at runtime. Swapping the order of Default and Unknown, or making | |
// either of them a lazy val, fixes the issue. | |
val Default = Foo(Unknown) | |
val Unknown = None | |
} | |
class FooTest extends FlatSpec with Matchers { | |
"Foo.Default.bar" should "be None" in { | |
Foo.Default.bar should equal (None) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment