I have a class. It has a companion object A
with a factory method.
class A private[somepackage](x: Int) {
}
object A { def createA(y: Int): A = { new A(y) } }
Now I need to create the mock object of A
in a scalatest file which is in a different package.
When I give
private val a = mock[A] --> I get compilation error.
constructor A
in class A
cannot be accessed in <<somewhere
>>.
Is there a better way to mock the object ??