I have some streams to test. Each one implements a particular "command". In
recent days I have warmed up to using a combination of implicit parameters
and constructor injection for DI.

http://carefulescapades.blogspot.com/2012/05/using-implicit-parameters-for.html

Some of my former singletons are now classes extending traits or abstract
classes.

But I have some remaining standalone functions (in Singletons) with rather
long implicit parameter lists for their dependencies. eg:

def command1(actualArgsForCommand...)(implicit ec: ExecutionContext, mat:
ActorMaterializer, reader: SomeReader, writer: SomeWriter, monitoring:
Monitoring):Future[SomeType]

I can now mock SomeReader and SomeWriter, and use a test probe for the
monitor actor (a dependency of MonitoringImpl). But the method signature is
a bit ugly, even with the dependencies in their own parameter list.

Is there some way to group the dependencies for a particular command in a
case class or something while still having them "export" implicits, or
would I have to redeclare within the method body?
implicit val reader = groupedDeps.reader
etc

Or am I better off making a class per command (or related commands with the
same dependencies), perhaps leaving the ec, and mat in method signatures,
while converting the reader, writer and monitoring to class constructor
arguments?

-- 
>>>>>>>>>>      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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to