Created
February 16, 2018 12:28
-
-
Save dakatsuka/01fcb4f1f07889f9b2999b73bd79663b 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
trait Foo { | |
def execute(): Unit | |
} | |
object Foo extends Foo { | |
def execute(): Unit = println("foo") | |
} | |
trait Bar { | |
val foo: Foo = Foo | |
} | |
object Main extends App { | |
object FooMock extends Foo { | |
def execute(): Unit = println("mock dayo") | |
} | |
val bar = new Bar { | |
override val foo: Foo = FooMock // Mockに差し替え | |
} | |
bar.foo.execute() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment