Hi,
I am trying to write a test with mocks using FunSuite and MockFactory as follows:
class A {
def func1(text: String) : String = {
"Text: " + text
}
}
class B (classA : A){
def func2(text: String) : String = {
classA.func1(text) + " - end of text"
}
}
class Tests extends FunSuite with MockFactory
{
test ("test with mocks") {
val classAMock = mock[A]
(classAMock.func1 _).expects("test").returning("test result")
val classB = new B(classAMock)
val results = classB.func2("this is class b")
}
}
When I'm trying to run the test I get the error:
overriding method withFixture in trait Suite of type (test: Tests.this.NoArgTest)org.scalatest.Outcome;
method withFixture in trait MockFactory of type (test: Tests.this.NoArgTest)Unit has incompatible type
class Tests extends FunSuite with MockFactory //with GeneratedMockFactory
^
Any idea how to solve it?
Thanks.