These are chat archives for etorreborre/specs2

13th
Jul 2016
Edmondo Porcu
@edmondo1984
Jul 13 2016 18:38
Hello again, is there a way to get better error messages when using beEqualTo on case classes? I have nested structure and the output is not very helpful. I ended up re-writing matchers for n-1 level of my case class to understand what fails like so
  def haveTheSameCompanyData(c:CompanyData):Matcher[QuickReport] = {
    (x:QuickReport) => {
      val r1 = x.companyData.flatMap(_.assesmentSummary) must beEqualTo(c.assesmentSummary)
      val r2 = x.companyData.flatMap(_.characteristicData) must beEqualTo(c.characteristicData)
      val r3 = x.companyData.flatMap(_.companySector) must beEqualTo(c.companySector)
      val r4 = x.companyData.flatMap(_.identifyingData) must beEqualTo(c.identifyingData)
      r1 and r2
    }
Eric Torreborre
@etorreborre
Jul 13 2016 20:14
Did you try the case class matchers?
Edmondo Porcu
@edmondo1984
Jul 13 2016 22:20
mmm
no but would be glad to see a better solution