scalamock Questions
2
Solved
abstract trait MyApi {
def getResult()(implicit ec: ExecutionContext): Future[String]
}
The following doesn't work:
val m = mock[MyApi]
(m.getResult _).expects() returning "..."
It fails wi...
Barranquilla asked 26/5, 2015 at 19:50
3
I'd like to stub one of the methods of a scala class with dependencies. Is there a way to achieve this using ScalaMock?
Here is a simplified example of what I have:
class TeamService(val dep1: D1...
Rebuttal asked 26/1, 2016 at 14:50
3
Solved
Is there a way to call a real method on a stubbed object with scalamock?
I would like to be able to do something like this:
class MySpec extends FunSpec with Matchers with MockFactory {
trait My...
1
Solved
I'm trying to test a class Cls with two functions: A and B. A loads a DataFrame and B calls A then does some operations and returns a new DataFrame. For the sake of example:
class Cls {
def A(dum...
1
Solved
New to Scala, have searched far and wide for clarification on some ScalaMock syntax. As per this guide, I keep seeing the following general testing pattern:
(myClass.myMethod _).expects()
W...
Castellated asked 14/5, 2018 at 15:47
1
I would like to know which ExecutionContext I should use (and why) on scalatest % 2.2.6 to run my futures and mock's futures.
class Foo {
def foo: Future[String] = Future.sucessful("B")
}
class ...
3
Solved
I couldn't find any documentation that explains how to mock overloaded methods that take no arguments in scalamock e.g
public boolean isInfoEnabled(Marker marker);
public boolean isInfoEnabled();...
Footboard asked 1/12, 2015 at 22:40
2
Solved
Using ScalaMock, I want to mock/stub a class method so it will return a different value per call (order of calls matters).
I can achieve this with mock and expects, but that will force me to verif...
1
Solved
In the doc of ScalaMock, it is said that:
mocking classes, traits and case classes
is one of the feature supported.
I have the following case class:
case class Thing(private val item: Item)
When...
Ditty asked 14/6, 2015 at 23:39
1
Solved
My first question, question, was answered but it uncovered another issue I am having. Here is the scenario.
Example code (expanded from previous question)
A Model:
case class User (first: String...
Dicks asked 20/11, 2014 at 18:20
1
Solved
I am using a trait definition with various concrete derivatives and implicit to inject dependancies into objects and also to mock out parts of the system when unit testing. The problem is that when...
Rosy asked 20/11, 2014 at 2:56
1
Solved
The following code:
import org.scalamock.scalatest.MockFactory
import org.scalatest.FlatSpec
trait SomeTrait {
def getLongByInt(int: Int): Long
}
class TestScalaMock extends FlatSpec with Mock...
1
© 2022 - 2024 — McMap. All rights reserved.