I know how to mock a class that has no constructor parameters
e.g.,
myMock = mock[MockClass]
However, what do you do if the class has constructor parameters?
More specifically I'm trying to mock the finatra class: ResponseBuilder
I know how to mock a class that has no constructor parameters
e.g.,
myMock = mock[MockClass]
However, what do you do if the class has constructor parameters?
More specifically I'm trying to mock the finatra class: ResponseBuilder
I couldn't find the test class on github however the answer to this depends on what you want to achieve. You wouldn't mock a class however using specs2 and mockito you can spy on it to determine if something has happened this is an example of what you might be trying to achieve.
One would normally mock traits as dependencies and then inject them into the test class once you defined their behaviour