From d143a4c6066de3eacc3cde13dbe16eec3ff2c0b1 Mon Sep 17 00:00:00 2001 From: kolotaev Date: Sun, 18 Feb 2018 18:28:50 +0300 Subject: [PATCH] Add object equality tests --- src/test/scala/com/github/kolotaev/ride/IdSpec.scala | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/scala/com/github/kolotaev/ride/IdSpec.scala b/src/test/scala/com/github/kolotaev/ride/IdSpec.scala index dd761d4..48a593a 100644 --- a/src/test/scala/com/github/kolotaev/ride/IdSpec.scala +++ b/src/test/scala/com/github/kolotaev/ride/IdSpec.scala @@ -112,6 +112,17 @@ class IdSpec extends FlatSpec with Matchers { b should equal (a) } + "IDs" should "not be equal as objects if they represent different values" in { + val a = Id() + val b = Id() + b shouldNot equal(a) + } + + "ID" should "not be equal as objects with the string representation of itself" in { + val a = Id() + a shouldNot equal(a.toString) + } + "IDs" should "be converted to itself back and forth and be equal as strings" in { val a = Id() val b = new Id(a.toString)