aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/xyz/driver/core/CoreTest.scala
diff options
context:
space:
mode:
authorStewart Stewart <stewinsalot@gmail.com>2016-12-22 18:04:47 -0500
committerStewart Stewart <stewinsalot@gmail.com>2016-12-22 18:12:08 -0500
commit96accc4f5eb43f482afdc939f9e23ddb45ab725d (patch)
treefd75cb95db9bbd15c11f18598f8666345983c010 /src/test/scala/xyz/driver/core/CoreTest.scala
parent3c22528e7f99e4b16327d6308c67b4be49d89efe (diff)
downloaddriver-core-96accc4f5eb43f482afdc939f9e23ddb45ab725d.tar.gz
driver-core-96accc4f5eb43f482afdc939f9e23ddb45ab725d.tar.bz2
driver-core-96accc4f5eb43f482afdc939f9e23ddb45ab725d.zip
add apply method to Id.Mapper for explicit conversions
Diffstat (limited to 'src/test/scala/xyz/driver/core/CoreTest.scala')
-rw-r--r--src/test/scala/xyz/driver/core/CoreTest.scala9
1 files changed, 7 insertions, 2 deletions
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 {