These are chat archives for etorreborre/specs2

Dec 2018
Edmondo Porcu
Dec 19 2018 11:57
Thanks @etorreborre
we have another interesting question: how do you chain expectations in kind of monadic way? We have a java api that returns a list, we want to take the first list of the element and use it as an input to a second method call
if the list has empty size, it will fail, so we need to perform an eventually
Edmondo Porcu
Dec 19 2018 12:03
  def hasProcessFinishedAndGoThroughActivity(historicQuery:HistoricProcessInstanceQuery, expectedActivity:String) = {
    val r1 = historicQuery.finished().list().size must beEqualTo(1).eventually
    val activitiesQuery = processEngine.getHistoryService.createHistoricActivityInstanceQuery().processInstanceId(historicQuery.finished().singleResult().getId)
    val r2 = activitiesQuery.list() must contain[HistoricActivityInstance]{
      (x:HistoricActivityInstance) => x.getActivityName must beEqualTo(expectedActivity)
    r1 and r2
I need to write this horrible code