The issue of testing business functionality that may be implemented in the 
class extending Actor has been raised quite a few times and I haven't found 
any good suggestions yet. Most Actor testing examples are focused around 
message receipt, type, timing etc. Akka team's response to this 
post https://groups.google.com/forum/#!topic/akka-user/tWAvAMMcOYs seems to 
be very dismissive. Why? This is legitimate issue! If there is no good way 
to test functionality provided by classes extending Actors then perhaps it 
should be stated please delegate such functionality to services etc.

What is wrong with example 1, and if nothing, how it is different from 
example 2 where I want to stub methodB()?

Example 1 from https://code.google.com/p/specs/wiki/UsingMockito
  object spec extends Specification with Mockito {
    
    val m = mock[java.util.List[String]] // a concrete class would be 
mocked with: mock(new java.util.LinkedList[String])
    
    // stub a method call with a return value
    m.get(0) returns "one"
    
    ...
}

Example 2

class ActorUnderTest extends Actor {
     def receive = {
          case TestMessage => methodA()
     }

    def methodA() = {
         methodB()
         //doSomtehing
    }

    def methodB() = {
        ....
    }

}

Andre Piwoni

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to