class Scheduler(repository : Repository) extends Actor
{
override def receive : Receive =
{
case TriggerDaily => repository.deleteOlderThan1year()
case TriggerHourly => repository.nullifyOlderThan3hrs()
}
}
object Scheduler
{
case object TriggerDaily
case object TriggerHourly
def props(repository : Repository) =
Props(classOf[Scheduler], repository)
}
在此存储库中,方法deleteOlderThan1year和deleteOlderThan1year返回Future [Done]吗?谁能帮我如何为此Scheduler Actor编写单元测试用例?
答案 0 :(得分:0)
查看documentation以测试Akka。本质上,您将扩展TestKit
来为您的actor初始化一个actor系统。由于您的参与者需要使用Repository
进行实例化,因此我还建议您研究模拟Repository
来验证是否调用了适当的方法。