ScalaTest:时间戳的近似比较方法

时间:2018-10-16 16:24:21

标签: scala scalatest

是否存在类似于以下方法的时间戳的近似比较方法? org.scalactic.TolerantNumerics

例如:

case class Event(type: String, date: java.sql.Timestamp)

test("some test case") {

   val e1 = Event("save", new java.sql.Timestamp(12345))
   val e2 = Event("save", new java.sql.Timestamp(12350))

   // we can setup approximate value for comparison of the timestamps

   e1 shouldEqual e2  // has to produce `true`
}

0 个答案:

没有答案