FunSuite with MockFactory compilation error

111 переглядів
Перейти до першого непрочитаного повідомлення

Mor Sheffer

не прочитано,
8 квіт. 2014 р., 06:59:3908.04.14
Кому: scalate...@googlegroups.com
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.

Bill Venners

не прочитано,
8 квіт. 2014 р., 07:34:0808.04.14
Кому: scalate...@googlegroups.com
Hi Mor,

I believe you need to use a later version of ScalaMock: 3.1.RC1.

https://oss.sonatype.org/content/groups/public/org/scalamock/scalamock_2.10/3.1.RC1/

Please give that a try and let me know if you still have a problem.

Bill


--
You received this message because you are subscribed to the Google
Groups "scalatest-users" group.
To post to this group, send email to scalate...@googlegroups.com
To unsubscribe from this group, send email to
scalatest-use...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/scalatest-users?hl=en
ScalaTest itself, and documentation, is available here:
http://www.artima.com/scalatest
---
You received this message because you are subscribed to the Google Groups "scalatest-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalatest-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Bill Venners
Artima, Inc.
http://www.artima.com

Mor Sheffer

не прочитано,
8 квіт. 2014 р., 07:51:4408.04.14
Кому: scalate...@googlegroups.com

It works, thanks!


בתאריך יום שלישי, 8 באפריל 2014 14:34:08 UTC+3, מאת Bill Venners:
Відповісти всім
Відповісти автору
Переслати
0 нових повідомлень