0

Is this possible to use ScalaMock stub not inside the tests but inside actual code? I want to run http service that require other service witch I want to stub for now. Can't find in documentation how this can be achieved.

sergeda
  • 2,061
  • 3
  • 20
  • 43

1 Answers1

1

There shouldn't be a difference in behavior between runtime and test environment, when it comes to dependency management and bytecode. Only difference would be what dependencies are defined for each of them. I assume that simply removing Test from:

libraryDependencies += "org.scalamock" %% "scalamock-scalatest-support" % "3.5.0" % Test

should do the job. Personally though, I would prefer to write a stub service by hand.

Mateusz Kubuszok
  • 24,995
  • 4
  • 42
  • 64
  • Note that this will also pull in Scalatest into your production code. you could probably just depend on `scalamock-core` if you don't want that. ScalaMock wasn't really designed for this use-case - might be an idea to use Scala.meta directly: http://scalameta.org/ – Philipp May 15 '17 at 09:52