How to use mocks in Scala to mock a singleton object
<p>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.</p>

<p>I have a DAL object with the following signature: </p>

<p><code>def callStoredProcedure(procName: String, params: Array[String]): Boolean</code></p>

<p>I'd like to write a test that calls a function of the top level class, and checks out what <code>procName</code> was passed to the function.</p>

<p>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?</p>

<p>We're currently using Mockito, but I'm open to anything.</p>