Created
July 14, 2015 07:50
-
-
Save eicnix/44b073726bea9eda50ce to your computer and use it in GitHub Desktop.
Simple response mocking for dispatch using scalamock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example for lukaseichler.de/how-to-test-dispatch-request/ | |
import dispatch.{HttpExecutor, _} | |
import dispatch.Defaults._ | |
val httpMock = mock[HttpExecutor] | |
(httpMock.apply(_: (Request, AsyncHandler[String]))(_: ExecutionContext)) | |
.expects(*, *) | |
.returning(Future[String] { | |
"Hello World" | |
}) | |
class Foo(http: HttpExecutor = Http) // Allow to override default HttpExecutor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment