Replaced mockito stubs for functions for a utility function for stubbing
because Mockito can't stub scala's function variables.