How to fake (i.e. not even mock) an actor system ?

117 views
Skip to first unread message

Maatary Okouya

unread,
Jun 20, 2015, 8:08:51 PM6/20/15
to akka...@googlegroups.com
I have a Service class that takes an actor system at construction time. Some of the method of the service use spray client, that's the reason. 

For testing other method of the class i need to provide for a dump actor system simply for the initialization of the class. Is there a way to get a dump actor system, i don't even need to mock it. 


One solution that i see is to wrap my actor system in an option and have some logic in the code that would deal with. Then that would allow me to test the method of of my service that do not need it. I would instantiate my class with None for the purpose of the test.  

But that is just too trick for so little. 

Roland Kuhn

unread,
Jun 21, 2015, 3:36:08 AM6/21/15
to akka-user
If the ActorSystem is not needed for the initialization of the service then why do you pass it in the constructor? You could just pass it into those methods that need it instead. Or split up the service into two parts along this line.

Regards,

Roland

--
>>>>>>>>>> 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+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



Dr. Roland Kuhn
Akka Tech Lead
Typesafe – Reactive apps on the JVM.
twitter: @rolandkuhn


Maatary Okouya

unread,
Jun 21, 2015, 12:31:26 PM6/21/15
to akka-user
All the method of the services uses it expect for one :)

You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/xWe-Srb6BIM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages