aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/xyz/driver/core/CoreTest.scala
diff options
context:
space:
mode:
authorVlad Uspensky <v.uspenskiy@icloud.com>2016-12-22 22:44:59 -0800
committerGitHub <noreply@github.com>2016-12-22 22:44:59 -0800
commit7586f5477c9fd09df68d76e5f03313f0ad438bb3 (patch)
tree056edf8076d61647f7a7fd0dd5a38bec8b96ef11 /src/test/scala/xyz/driver/core/CoreTest.scala
parenta9e83ef7c5452d30bb0b49ae508efb17210c49ef (diff)
parent6674c5b096bd6fce5706632e0d63904afe0c91de (diff)
downloaddriver-core-7586f5477c9fd09df68d76e5f03313f0ad438bb3.tar.gz
driver-core-7586f5477c9fd09df68d76e5f03313f0ad438bb3.tar.bz2
driver-core-7586f5477c9fd09df68d76e5f03313f0ad438bb3.zip
Merge pull request #15 from drivergroup/symmetric-id-mapper
Allow explicit conversion with symmetric id mapper via apply
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 775fb27..08b1df2 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 {