Function as tuple parameter on Scala

Viewed 80

I tried to signify the problem and I make it worst. Lets give the complex code.

I'm calling a function like:

mySchedule(config, actorSystem.scheduler.schedule) {
    ...
}

the function is defined like:

def mySchedule(config: MyConfig, cb: (FiniteDuration, FiniteDuration) => (=> Unit) => Cancellable)(f : => Unit) = {
    val initialDelay = ...
    val interval = ...
    cb(initialDelay, interval)(f)
}

For doing the test I was willing to do something like

def noop: Unit = {}
val promiseSchedule = Promise[(FiniteDuration, FiniteDuration, => Unit)]()
mySchedule(
   config,
   {... promiseSchedule.success((initialDelay, interval, f))}
)(noop)

promiseSchedule.future.value must be_==(...)

How do I make this work?

2 Answers
Related