Created
May 1, 2015 22:38
-
-
Save advancedxy/08a76fb618a3f804e108 to your computer and use it in GitHub Desktop.
Stackable Trait simulate
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
trait BeforeAndAfterEach { def beforeEach(): Unit = () } | |
trait ResetSystemProperties extends BeforeAndAfterEach { override def beforeEach(): Unit = println("reset") } | |
class A extends BeforeAndAfterEach with ResetSystemProperties { override def beforeEach() { println("test") } } | |
class B extends BeforeAndAfterEach with ResetSystemProperties { override def beforeEach() { super.beforeEach(); println("test") } } | |
scala> (new A()).beforeEach | |
test | |
scala> (new B()).beforeEach | |
reset | |
test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment