Say I have the following object I want to test
object ObjectToTest {
def apply() = {
val example = List.fill(5)(CaseClassExample("here", "there"))
ChildObject(example.tail) + " " + ChildObject2(example.tail)
}
}
where both child objects look like this
object ChildObject2 {
def apply(param1: Seq[CaseClassExample]) = {
"not mocked"
}
}
object ChildObject {
def apply(param1: Seq[CaseClassExample]) = {
"not mocked"
}
}
Is it possible to write a test that mocks the two child objects being used in the object under test?
Possible? Yes. Advised? No Idea.
We could write the following tests uisng
mockito-scala
andscalatest
to mock both objects