Just like static in Java, object references are hard to redefine for testing purposes, so you usually want to avoid them other than stateless inaction methods such as Math.min, Math.max. As with Java statics, stateful objects make testing especially difficult.
Scala Java, - . , :
object MyRunnable extends Runnable {
def run() { }
}
class Client(r: Runnable) {
}
new Client(MyRunnable)
new Client(mock[Runnable])
Java- . Java ( Scala ).