I recently started programming in Scala. I have a project with a hierarchy of classes that call each other. Eventually, they last one calls a singleton DAL (Data Access Layer) object that calls a stored procedure in MySQL.
I have a DAL object with the following signature:
def callStoredProcedure(procNAme: String, params: Array[String]): Boolean
I'd like to write a test that calls a function of the top level class, and checks out what's the stored procedure was passed to the function.
How do I go about creating a mock for the DAL object? How can I inject it into the process pipeline, or is there a better/recommended way to replace the singleton with a mock that just returns the procedure name rather than calling it?
We're currently using Mockito, but I'm open to anything.
Aucun commentaire:
Enregistrer un commentaire