vendredi 25 mars 2016

Scala specs2 None is not equal to None

I test that method output is as expected using specs2 and scala. The test is as following:

call() must beEqualTo(expectedCall)

expectedCall is an instance of case class - same as call() returns. When i run tests i get following error

[error]      'CustomScriptParsedOutput(0,Some(List(IntegrationRecordMsg(-500.12,2016-03-10T18:20:00.000+01:00,Some(some note, CZ),Some(CZK),Some(List(WITHDRAWAL))))),None,None): models.CustomScriptParsedOutput'
[error]
[error]       is not equal to
[error]
[error]      'CustomScriptParsedOutput(0,Some(List(IntegrationRecordMsg(-500.12,2016-03-10T18:20:00.000+01:00,Some(some note, CZ),Some(CZK),Some(List(WITHDRAWAL))))),None,None): models.CustomScriptParsedOutput' (CustomTest.scala:53)
[error] Actual:   ...None)
[error] Expected: ...None)

where definition of case class is :

case class CustomScriptParsedOutput(
    code: Int, 
    records: Option[List[RecordMsg]] = None, 
    amount: Option[AmountMsg] = None, 
    error: Option[ErrorMsg] = None
)

How come None is not equal to None?

Aucun commentaire:

Enregistrer un commentaire