I have a Scala object and it contains a few utility functions. These functions are called by other functions present in the same object or from other classes/objects. Is it possible to mock this object or the functions so that I can unit test the classes where they are being called.
Example:
object Util {
def methodA() = {
//other code
methodB()
//other code
}
def methodB() = {
//other code
methodC()
//other code
}
def methodC() = { ... }
}
And here I'm calling the object function from another class
class Data {
//other code
def call() = {
//other code
Util.methodA()
//other code
}
}
How can I go about unit testing the function call() of class Data ? In Java I can create a mocked object for Util and set expectations for a call to methodA(), but this is not possible in Scala since no mocking library supports mocking of a Scala object.