From 96accc4f5eb43f482afdc939f9e23ddb45ab725d Mon Sep 17 00:00:00 2001 From: Stewart Stewart Date: Thu, 22 Dec 2016 18:04:47 -0500 Subject: add apply method to Id.Mapper for explicit conversions --- src/test/scala/xyz/driver/core/CoreTest.scala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/test/scala/xyz/driver/core/CoreTest.scala') diff --git a/src/test/scala/xyz/driver/core/CoreTest.scala b/src/test/scala/xyz/driver/core/CoreTest.scala index 520fe8e..ded0c8d 100644 --- a/src/test/scala/xyz/driver/core/CoreTest.scala +++ b/src/test/scala/xyz/driver/core/CoreTest.scala @@ -47,15 +47,20 @@ class CoreTest extends FlatSpec with Matchers with MockitoSugar { implicit val xy = Id.Mapper[X, Y] implicit val yz = Id.Mapper[Y, Z] - // The real test is that the following statements compile: + // Test that implicit conversions work correctly val x = X(Id("0")) val y = Y(x.id) val z = Z(y.id) val y2 = Y(z.id) val x2 = X(y2.id) - (x2 === x) should be(true) (y2 === y) should be(true) + + // Test that type inferrence for explicit conversions work correctly + val yid = y.id + val xid = xy(yid) + val zid = yz(yid) + (xid: Id[X]) should be(zid: Id[Z]) } "Time" should "use TimeZone correctly when converting to Date" in { -- cgit v1.2.3