From 424e025f1c719006fe6a6669e43667e1d39ff076 Mon Sep 17 00:00:00 2001 From: Zach Smith Date: Tue, 20 Mar 2018 14:59:01 -0700 Subject: Curry the PatchRetrievable apply method --- src/test/scala/xyz/driver/core/rest/PatchSupportTest.scala | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/test/scala') diff --git a/src/test/scala/xyz/driver/core/rest/PatchSupportTest.scala b/src/test/scala/xyz/driver/core/rest/PatchSupportTest.scala index 20d667d..5c7faf8 100644 --- a/src/test/scala/xyz/driver/core/rest/PatchSupportTest.scala +++ b/src/test/scala/xyz/driver/core/rest/PatchSupportTest.scala @@ -34,7 +34,7 @@ class PatchSupportTest val ContentTypeHeader = `Content-Type`(ContentType.parse("application/merge-patch+json").right.get) "PatchSupport" should "allow partial updates to an existing object" in { - implicit val fooPatchable = PatchRetrievable[Foo]((id, _) => Future.successful(Some(testFoo.copy(id = id)))) + implicit val fooPatchable = PatchRetrievable[Foo](id => _ => Future.successful(Some(testFoo.copy(id = id)))) Patch("/api/v1/foos/1", jsonEntity("""{"rank": 4}""")).withHeaders(ContentTypeHeader) ~> route ~> check { handled shouldBe true @@ -43,7 +43,7 @@ class PatchSupportTest } it should "merge deeply nested objects" in { - implicit val fooPatchable = PatchRetrievable[Foo]((id, _) => Future.successful(Some(testFoo.copy(id = id)))) + implicit val fooPatchable = PatchRetrievable[Foo](id => _ => Future.successful(Some(testFoo.copy(id = id)))) Patch("/api/v1/foos/1", jsonEntity("""{"rank": 4, "bar": {"name": "My Bar"}}""")) .withHeaders(ContentTypeHeader) ~> route ~> check { @@ -53,7 +53,7 @@ class PatchSupportTest } it should "return a 404 if the object is not found" in { - implicit val fooPatchable = PatchRetrievable[Foo]((id, _) => Future.successful(None)) + implicit val fooPatchable = PatchRetrievable[Foo](_ => _ => Future.successful(None)) Patch("/api/v1/foos/1", jsonEntity("""{"rank": 4}""")).withHeaders(ContentTypeHeader) ~> route ~> check { handled shouldBe true @@ -62,7 +62,7 @@ class PatchSupportTest } it should "handle nulls on optional values correctly" in { - implicit val fooPatchable = PatchRetrievable[Foo]((id, _) => Future.successful(Some(testFoo.copy(id = id)))) + implicit val fooPatchable = PatchRetrievable[Foo](id => _ => Future.successful(Some(testFoo.copy(id = id)))) Patch("/api/v1/foos/1", jsonEntity("""{"bar": null}""")).withHeaders(ContentTypeHeader) ~> route ~> check { handled shouldBe true @@ -71,7 +71,7 @@ class PatchSupportTest } it should "return a 400 for nulls on non-optional values" in { - implicit val fooPatchable = PatchRetrievable[Foo]((id, _) => Future.successful(Some(testFoo.copy(id = id)))) + implicit val fooPatchable = PatchRetrievable[Foo](id => _ => Future.successful(Some(testFoo.copy(id = id)))) Patch("/api/v1/foos/1", jsonEntity("""{"rank": null}""")).withHeaders(ContentTypeHeader) ~> route ~> check { handled shouldBe true @@ -80,7 +80,7 @@ class PatchSupportTest } it should "return a 400 for incorrect Content-Type" in { - implicit val fooPatchable = PatchRetrievable[Foo]((id, _) => Future.successful(Some(testFoo.copy(id = id)))) + implicit val fooPatchable = PatchRetrievable[Foo](id => _ => Future.successful(Some(testFoo.copy(id = id)))) Patch("/api/v1/foos/1", jsonEntity("""{"rank": 4}""")) ~> route ~> check { status shouldBe StatusCodes.BadRequest -- cgit v1.2.3