You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@toree.apache.org by lb...@apache.org on 2016/01/22 23:07:13 UTC

[05/51] [abbrv] incubator-toree git commit: Moved scala files to new locations based on new package

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/KMBuilderSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/KMBuilderSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/KMBuilderSpec.scala
new file mode 100644
index 0000000..cd5116b
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/KMBuilderSpec.scala
@@ -0,0 +1,156 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5
+
+import com.ibm.spark.kernel.protocol.v5.content.{CommOpen, StreamContent}
+import org.scalatest.{Matchers, FunSpec}
+import play.api.libs.json._
+
+class KMBuilderSpec extends FunSpec with Matchers {
+  describe("KMBuilder") {
+    val emptyKM = KernelMessage(
+      ids          = Seq(),
+      signature    = "",
+      header       = HeaderBuilder.empty,
+      parentHeader = HeaderBuilder.empty,
+      metadata     = Metadata(),
+      contentString = ""
+    )
+    val nonEmptyHeader = Header("1", "user", "2", "msg", "version")
+
+    describe("constructor") {
+      it("should hold an empty KernelMessage when constructed by default") {
+        KMBuilder().km should be(emptyKM)
+      }
+
+      it("should throw an IllegalArgumentException if given a null message") {
+        intercept[IllegalArgumentException] {
+          KMBuilder(null)
+        }
+      }
+    }
+
+    describe("#build"){
+      it("should build a KernelMessage") {
+        KMBuilder().build.copy(metadata = Metadata()) should be(emptyKM)
+      }
+
+      class KM2 extends KMBuilder {
+        override def metadataDefaults : Metadata = {
+          Metadata("foo" -> "bar", "baos" -> "bean")
+        }
+      }
+      it("should include default metadata in built message by default") {
+        val builder = new KM2
+        val metadata = builder.build.metadata
+        builder.metadataDefaults.foreach { case (k, v) =>
+            assert (metadata.contains(k) && metadata(k) == v)
+        }
+      }
+
+      it("should not include default metadata in built message if disabled") {
+        val builder = new KM2
+        val metadata = builder.build(includeDefaultMetadata = false).metadata
+        metadata should be(Metadata())
+      }
+    }
+
+    describe("withXYZ"){
+      describe("#withIds"){
+        it("should produce a KMBuilder with a KernelMessage with ids set") {
+          val ids = Seq("baos", "win")
+          val builder = KMBuilder().withIds(ids)
+          builder.km.ids should be (ids)
+        }
+      }
+
+      describe("#withSignature"){
+        it("should produce a KMBuilder with a KernelMessage with signature set") {
+          val sig = "beans"
+          val builder = KMBuilder().withSignature(sig)
+          builder.km.signature should be (sig)
+        }
+      }
+
+      describe("#withHeader"){
+        it("should produce a KMBuilder with a KernelMessage with header set," +
+           "given a Header") {
+          val builder = KMBuilder().withHeader(nonEmptyHeader)
+          builder.km.header should be (nonEmptyHeader)
+        }
+        it("should produce a KMBuilder with a KernelMessage with header set " +
+          "to a header for the given message type") {
+          val msgType = MessageType.Outgoing.ExecuteResult
+          val header = HeaderBuilder.create(msgType.toString).copy(msg_id = "")
+          val builder = KMBuilder().withHeader(msgType)
+          builder.km.header.copy(msg_id = "") should be (header)
+        }
+        it("should produce a KMBuilder with a KernelMessage with header set " +
+          "to a header for the given string message type") {
+          val msgType = CommOpen.toTypeString
+          val header = HeaderBuilder.create(msgType).copy(msg_id = "")
+          val builder = KMBuilder().withHeader(msgType)
+          builder.km.header.copy(msg_id = "") should be (header)
+        }
+      }
+
+      describe("#withParent"){
+        it("should produce a KMBuilder with a KernelMessage with " +
+           "parentHeader set to the header of the given parent message") {
+          val parent = emptyKM.copy(header = nonEmptyHeader)
+          val builder = KMBuilder().withParent(parent)
+          builder.km.parentHeader should be (parent.header)
+        }
+      }
+
+      describe("#withParentHeader"){
+        it("should produce a KMBuilder with a KernelMessage with " +
+           "parentHeader set") {
+          val builder = KMBuilder().withParentHeader(nonEmptyHeader)
+          builder.km.parentHeader should be (nonEmptyHeader)
+        }
+      }
+
+      describe("#withMetadata"){
+        it("should produce a KMBuilder with a KernelMessage whose metadata " +
+           "contains the given metadata") {
+          val metadata = Metadata("foo" -> "bar", "baos" -> "bean")
+          val builder = KMBuilder().withMetadata(metadata)
+          builder.km.metadata should be (metadata)
+          val builtKM = builder.build
+          metadata.foreach { case (k, v) =>
+            assert (builtKM.metadata.contains(k) && builtKM.metadata(k) == v)
+          }
+        }
+      }
+
+      describe("#withContentString"){
+        it("should produce a KMBuilder with a KernelMessage with content set") {
+          val content = "foo bar"
+          val builder = KMBuilder().withContentString(content)
+          builder.km.contentString should be (content)
+        }
+        it("should produce a KMBuilder with a KernelMessage with content" +
+           "containing a JSON string of the given object") {
+          val sc = StreamContent("foo", "bar")
+          val builder = KMBuilder().withContentString(sc)
+          builder.km.contentString should be (Json.toJson(sc).toString)
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala
new file mode 100644
index 0000000..3811314
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ClearOutputSpec.scala
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class ClearOutputSpec extends FunSpec with Matchers {
+  val clearOutputJson: JsValue = Json.parse("""
+  {
+    "wait": true
+  }
+""")
+
+  val clearOutput = ClearOutput(
+    true
+  )
+
+  describe("ClearOutput") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        ClearOutput.toTypeString should be ("clear_output")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a ClearOutput instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        clearOutputJson.as[ClearOutput] should be (clearOutput)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = clearOutputJson.asOpt[ClearOutput]
+
+        newCompleteRequest.get should be (clearOutput)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = clearOutputJson.validate[ClearOutput]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ClearOutput) => valid
+        ) should be (clearOutput)
+      }
+
+      it("should implicitly convert from a ClearOutput instance to valid json") {
+        Json.toJson(clearOutput) should be (clearOutputJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala
new file mode 100644
index 0000000..15ba4ed
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommCloseSpec.scala
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5._
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class CommCloseSpec extends FunSpec with Matchers {
+  val commCloseJson: JsValue = Json.parse("""
+  {
+    "comm_id": "<UUID>",
+    "data": {}
+  }
+  """)
+
+  val commClose = CommClose(
+    "<UUID>", MsgData.Empty
+  )
+
+  describe("CommClose") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        CommClose.toTypeString should be ("comm_close")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a CommClose instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        commCloseJson.as[CommClose] should be (commClose)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = commCloseJson.asOpt[CommClose]
+
+        newCompleteRequest.get should be (commClose)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = commCloseJson.validate[CommClose]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: CommClose) => valid
+        ) should be (commClose)
+      }
+
+      it("should implicitly convert from a CommClose instance to valid json") {
+        Json.toJson(commClose) should be (commCloseJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala
new file mode 100644
index 0000000..74b99fe
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommMsgSpec.scala
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+import com.ibm.spark.kernel.protocol.v5._
+
+class CommMsgSpec extends FunSpec with Matchers {
+  val commMsgJson: JsValue = Json.parse("""
+  {
+    "comm_id": "<UUID>",
+    "data": {}
+  }
+  """)
+
+  val commMsgJsonWithData: JsValue = Json.parse(
+    """
+    {
+      "comm_id": "<UUID>",
+      "data": {
+        "key" : {
+          "foo" : "bar",
+          "baz" : {
+            "qux" : 3
+          }
+        }
+      }
+    }
+    """.stripMargin)
+
+  val commMsg = CommMsg(
+    "<UUID>", MsgData.Empty
+  )
+
+  val commMsgWithData = CommMsg(
+    "<UUID>", MsgData("key" -> Json.obj(
+      "foo" -> "bar",
+      "baz" -> Map("qux" -> 3)
+    ))
+  )
+
+  describe("CommMsg") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        CommMsg.toTypeString should be ("comm_msg")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a CommMsg instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        commMsgJson.as[CommMsg] should be (commMsg)
+      }
+
+      it("should implicitly convert json with a non-empty json data field " +
+         "to a CommMsg instance") {
+        commMsgJsonWithData.as[CommMsg] should be (commMsgWithData)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = commMsgJson.asOpt[CommMsg]
+
+        newCompleteRequest.get should be (commMsg)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = commMsgJson.validate[CommMsg]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: CommMsg) => valid
+        ) should be (commMsg)
+      }
+
+      it("should implicitly convert from a CommMsg instance to valid json") {
+        Json.toJson(commMsg) should be (commMsgJson)
+      }
+
+      it("should implicitly convert a CommMsg instance with non-empty json " +
+         "data to valid json") {
+        Json.toJson(commMsgWithData) should be (commMsgJsonWithData)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala
new file mode 100644
index 0000000..3f216e9
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CommOpenSpec.scala
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+import com.ibm.spark.kernel.protocol.v5.MsgData
+
+class CommOpenSpec extends FunSpec with Matchers {
+  val commOpenJson: JsValue = Json.parse("""
+  {
+    "comm_id": "<UUID>",
+    "target_name": "<STRING>",
+    "data": {}
+  }
+  """)
+
+  val commOpen = CommOpen(
+    "<UUID>", "<STRING>", MsgData.Empty
+  )
+
+  describe("CommOpen") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        CommOpen.toTypeString should be ("comm_open")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a CommOpen instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        commOpenJson.as[CommOpen] should be (commOpen)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = commOpenJson.asOpt[CommOpen]
+
+        newCompleteRequest.get should be (commOpen)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = commOpenJson.validate[CommOpen]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: CommOpen) => valid
+        ) should be (commOpen)
+      }
+
+      it("should implicitly convert from a CommOpen instance to valid json") {
+        Json.toJson(commOpen) should be (commOpenJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala
new file mode 100644
index 0000000..ab41581
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyErrorSpec.scala
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class CompleteReplyErrorSpec extends FunSpec with Matchers {
+  val completeReplyErrorJson: JsValue = Json.parse("""
+  {
+    "matches": [],
+    "cursor_start": 1,
+    "cursor_end": 5,
+    "metadata": {},
+    "status": "error",
+    "ename":"<STRING>",
+    "evalue": "<STRING>",
+    "traceback": []
+  }
+  """)
+  
+  
+  val completeReplyError: CompleteReplyError = CompleteReplyError(
+    List(), 1, 5, Map(), Some("<STRING>"), Some("<STRING>"), Some(List())
+  )
+
+  describe("CompleteReplyError") {
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a CompleteReplyError instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        completeReplyErrorJson.as[CompleteReplyError] should be (completeReplyError)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteReplyOk = completeReplyErrorJson.asOpt[CompleteReplyError]
+
+        newCompleteReplyOk.get should be (completeReplyError)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteReplyOkResults = completeReplyErrorJson.validate[CompleteReplyError]
+
+        CompleteReplyOkResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: CompleteReplyError) => valid
+        ) should be (completeReplyError)
+      }
+
+      it("should implicitly convert from a CompleteReplyError instance to valid json") {
+        Json.toJson(completeReplyError) should be (completeReplyErrorJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala
new file mode 100644
index 0000000..a3edeec
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplyOkSpec.scala
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class CompleteReplyOkSpec extends FunSpec with Matchers {
+  val completeReplyOkJson: JsValue = Json.parse("""
+  {
+    "matches": [],
+    "cursor_start": 1,
+    "cursor_end": 5,
+    "metadata": {},
+    "status": "ok"
+  }
+  """)
+  
+  
+  val completeReplyOk: CompleteReplyOk = CompleteReplyOk(
+    List(), 1, 5, Map()
+  )
+
+  describe("CompleteReplyOk") {
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a CompleteReplyOk instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        completeReplyOkJson.as[CompleteReplyOk] should be (completeReplyOk)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteReplyOk = completeReplyOkJson.asOpt[CompleteReplyOk]
+
+        newCompleteReplyOk.get should be (completeReplyOk)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteReplyOkResults = completeReplyOkJson.validate[CompleteReplyOk]
+
+        CompleteReplyOkResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: CompleteReplyOk) => valid
+        ) should be (completeReplyOk)
+      }
+
+      it("should implicitly convert from a CompleteReplyOk instance to valid json") {
+        Json.toJson(completeReplyOk) should be (completeReplyOkJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala
new file mode 100644
index 0000000..a0e6a27
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteReplySpec.scala
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{Matchers, FunSpec}
+import play.api.data.validation.ValidationError
+import play.api.libs.json.{JsPath, JsValue, Json}
+
+/**
+ * Created by Senkwich on 7/24/14.
+ */
+class CompleteReplySpec extends FunSpec with Matchers {
+
+
+  val completeReplyJson: JsValue = Json.parse("""
+  {
+    "matches": [],
+    "cursor_start": 1,
+    "cursor_end": 5,
+    "metadata": {},
+    "status": "<STRING>"
+  }
+  """)
+
+  val completeReply: CompleteReply = CompleteReply(
+    List(), 1, 5, Map(), "<STRING>", None, None, None
+  )
+
+  describe("CompleteReply") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        CompleteReply.toTypeString should be ("complete_reply")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a CompleteReply instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        completeReplyJson.as[CompleteReply] should be (completeReply)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteReply = completeReplyJson.asOpt[CompleteReply]
+
+        newCompleteReply.get should be (completeReply)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteReplyResults = completeReplyJson.validate[CompleteReply]
+
+        CompleteReplyResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: CompleteReply) => valid
+        ) should be (completeReply)
+      }
+
+      it("should implicitly convert from a CompleteReply instance to valid json") {
+        Json.toJson(completeReply) should be (completeReplyJson)
+      }
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala
new file mode 100644
index 0000000..3738354
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/CompleteRequestSpec.scala
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class CompleteRequestSpec extends FunSpec with Matchers {
+  val completeRequestJson: JsValue = Json.parse("""
+  {
+    "code": "<STRING>",
+    "cursor_pos": 999
+  }
+  """)
+
+  val completeRequest: CompleteRequest = CompleteRequest(
+    "<STRING>", 999
+  )
+
+  describe("CompleteRequest") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        CompleteRequest.toTypeString should be ("complete_request")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a CompleteRequest instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        completeRequestJson.as[CompleteRequest] should be (completeRequest)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = completeRequestJson.asOpt[CompleteRequest]
+
+        newCompleteRequest.get should be (completeRequest)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = completeRequestJson.validate[CompleteRequest]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: CompleteRequest) => valid
+        ) should be (completeRequest)
+      }
+
+      it("should implicitly convert from a CompleteRequest instance to valid json") {
+        Json.toJson(completeRequest) should be (completeRequestJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala
new file mode 100644
index 0000000..7ebfb07
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectReplySpec.scala
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json.{JsPath, JsValue, Json}
+
+/**
+ * Created by Senkwich on 7/24/14.
+ */
+class ConnectReplySpec extends FunSpec with Matchers {
+
+
+  val connectReplyJson: JsValue = Json.parse("""
+  {
+    "shell_port": 11111,
+    "iopub_port": 22222,
+    "stdin_port": 33333,
+    "hb_port": 44444
+  }
+  """)
+
+  val connectReply: ConnectReply = ConnectReply(11111,22222,33333,44444)
+
+  describe("ConnectReply") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        ConnectReply.toTypeString should be ("connect_reply")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a ConnectReply instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        connectReplyJson.as[ConnectReply] should be (connectReply)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newConnectReply = connectReplyJson.asOpt[ConnectReply]
+
+        newConnectReply.get should be (connectReply)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val ConnectReplyResults = connectReplyJson.validate[ConnectReply]
+
+        ConnectReplyResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ConnectReply) => valid
+        ) should be (connectReply)
+      }
+
+      it("should implicitly convert from a ConnectReply instance to valid json") {
+        Json.toJson(connectReply) should be (connectReplyJson)
+      }
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala
new file mode 100644
index 0000000..af64d75
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ConnectRequestSpec.scala
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class ConnectRequestSpec extends FunSpec with Matchers {
+  val connectRequestJson: JsValue = Json.parse("""
+  {}
+  """)
+
+  val connectRequest: ConnectRequest = ConnectRequest()
+
+  describe("ConnectRequest") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        ConnectRequest.toTypeString should be ("connect_request")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a ConnectRequest instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        connectRequestJson.as[ConnectRequest] should be (connectRequest)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newConnectRequest = connectRequestJson.asOpt[ConnectRequest]
+
+        newConnectRequest.get should be (connectRequest)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val ConnectRequestResults = connectRequestJson.validate[ConnectRequest]
+
+        ConnectRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ConnectRequest) => valid
+        ) should be (connectRequest)
+      }
+
+      it("should implicitly convert from a ConnectRequest instance to valid json") {
+        Json.toJson(connectRequest) should be (connectRequestJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala
new file mode 100644
index 0000000..26b03e7
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/DisplayDataSpec.scala
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.FunSuite
+
+import org.scalatest.{Matchers, FunSpec}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+import com.ibm.spark.kernel.protocol.v5._
+
+class DisplayDataSpec extends FunSpec with Matchers {
+  val displayDataJson: JsValue = Json.parse("""
+  {
+    "source": "<STRING>",
+    "data": {},
+    "metadata": {}
+  }
+  """)
+
+  val displayData: DisplayData = DisplayData(
+    "<STRING>", Map(), Map()
+  )
+
+  describe("DisplayData") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        DisplayData.toTypeString should be ("display_data")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a displayData instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        displayDataJson.as[DisplayData] should be (displayData)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newDisplayData = displayDataJson.asOpt[DisplayData]
+
+        newDisplayData.get should be (displayData)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val displayDataResults = displayDataJson.validate[DisplayData]
+
+        displayDataResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: DisplayData) => valid
+        ) should be (displayData)
+      }
+
+      it("should implicitly convert from a displayData instance to valid json") {
+        Json.toJson(displayData) should be (displayDataJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala
new file mode 100644
index 0000000..3321d1e
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ErrorContentSpec.scala
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{Matchers, FunSpec}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class ErrorContentSpec extends FunSpec with Matchers {
+  val errorJson: JsValue = Json.parse("""
+  {
+    "ename": "<STRING>",
+    "evalue": "<STRING>",
+    "traceback": ["<STRING>"]
+  }
+  """)
+
+  val error = ErrorContent("<STRING>", "<STRING>", List("<STRING>"))
+  
+  describe("ErrorContent") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        ErrorContent.toTypeString should be ("error")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a ErrorContent instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        errorJson.as[ErrorContent] should be (error)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = errorJson.asOpt[ErrorContent]
+
+        newCompleteRequest.get should be (error)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = errorJson.validate[ErrorContent]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ErrorContent) => valid
+        ) should be (error)
+      }
+
+      it("should implicitly convert from a ErrorContent instance to valid json") {
+        Json.toJson(error) should be (errorJson)
+      }
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala
new file mode 100644
index 0000000..7327785
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteInputSpec.scala
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class ExecuteInputSpec extends FunSpec with Matchers {
+  val executeInputJson: JsValue = Json.parse("""
+  {
+    "code": "<STRING>",
+    "execution_count": 42
+  }
+  """)
+
+  val executeInput: ExecuteInput = ExecuteInput(
+    "<STRING>", 42
+  )
+
+  describe("ExecuteInput") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        ExecuteInput.toTypeString should be ("execute_input")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a executeInput instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        executeInputJson.as[ExecuteInput] should be (executeInput)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newExecuteInput = executeInputJson.asOpt[ExecuteInput]
+
+        newExecuteInput.get should be (executeInput)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val executeInputResults = executeInputJson.validate[ExecuteInput]
+
+        executeInputResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ExecuteInput) => valid
+        ) should be (executeInput)
+      }
+
+      it("should implicitly convert from a executeInput instance to valid json") {
+        Json.toJson(executeInput) should be (executeInputJson)
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala
new file mode 100644
index 0000000..5241650
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyAbortSpec.scala
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5._
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class ExecuteReplyAbortSpec extends FunSpec with Matchers {
+  val executeReplyAbortJson: JsValue = Json.parse("""
+  {
+    "status": "abort",
+    "execution_count": 999
+  }
+  """)
+
+  val executeReplyAbort: ExecuteReplyAbort = ExecuteReplyAbort(
+    999
+  )
+
+  describe("ExecuteReplyAbort") {
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a ExecuteReplyAbort instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        executeReplyAbortJson.as[ExecuteReplyAbort] should be (executeReplyAbort)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newExecuteReplyAbort = executeReplyAbortJson.asOpt[ExecuteReplyAbort]
+
+        newExecuteReplyAbort.get should be (executeReplyAbort)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val ExecuteReplyAbortResults = executeReplyAbortJson.validate[ExecuteReplyAbort]
+
+        ExecuteReplyAbortResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ExecuteReplyAbort) => valid
+        ) should be (executeReplyAbort)
+      }
+
+      it("should implicitly convert from a ExecuteReplyAbort instance to valid json") {
+        Json.toJson(executeReplyAbort) should be (executeReplyAbortJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala
new file mode 100644
index 0000000..9859d5e
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyErrorSpec.scala
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+import com.ibm.spark.kernel.protocol.v5._
+
+class ExecuteReplyErrorSpec extends FunSpec with Matchers {
+  val executeReplyErrorJson: JsValue = Json.parse("""
+  {
+    "status": "error",
+    "execution_count": 999,
+    "ename": "<STRING>",
+    "evalue": "<STRING>",
+    "traceback": []
+  }
+  """)
+
+  val executeReplyError: ExecuteReplyError = ExecuteReplyError(
+    999, Some("<STRING>"), Some("<STRING>"), Some(List())
+  )
+
+  describe("ExecuteReplyError") {
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a ExecuteReplyError instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        executeReplyErrorJson.as[ExecuteReplyError] should be (executeReplyError)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newExecuteReplyError = executeReplyErrorJson.asOpt[ExecuteReplyError]
+
+        newExecuteReplyError.get should be (executeReplyError)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val ExecuteReplyErrorResults = executeReplyErrorJson.validate[ExecuteReplyError]
+
+        ExecuteReplyErrorResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ExecuteReplyError) => valid
+        ) should be (executeReplyError)
+      }
+
+      it("should implicitly convert from a ExecuteReplyError instance to valid json") {
+        Json.toJson(executeReplyError) should be (executeReplyErrorJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala
new file mode 100644
index 0000000..be73811
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplyOkSpec.scala
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+import com.ibm.spark.kernel.protocol.v5._
+
+class ExecuteReplyOkSpec extends FunSpec with Matchers {
+  val executeReplyOkJson: JsValue = Json.parse("""
+  {
+    "status": "ok",
+    "execution_count": 999,
+    "payload": [],
+    "user_expressions": {}
+  }
+  """)
+
+  val executeReplyOk: ExecuteReplyOk = ExecuteReplyOk(
+    999, Some(Payloads()), Some(UserExpressions())
+  )
+
+  describe("ExecuteReplyOk") {
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a executeReplyOk instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        executeReplyOkJson.as[ExecuteReplyOk] should be (executeReplyOk)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newExecuteReplyOk = executeReplyOkJson.asOpt[ExecuteReplyOk]
+
+        newExecuteReplyOk.get should be (executeReplyOk)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val executeReplyOkResults = executeReplyOkJson.validate[ExecuteReplyOk]
+
+        executeReplyOkResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ExecuteReplyOk) => valid
+        ) should be (executeReplyOk)
+      }
+
+      it("should implicitly convert from a executeReplyOk instance to valid json") {
+        Json.toJson(executeReplyOk) should be (executeReplyOkJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala
new file mode 100644
index 0000000..24af1f2
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteReplySpec.scala
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5._
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class ExecuteReplySpec extends FunSpec with Matchers {
+  val executeReplyJson: JsValue = Json.parse("""
+  {
+    "status": "<STRING>",
+    "execution_count": 999
+  }
+  """)
+
+  val executeReply: ExecuteReply = ExecuteReply(
+    "<STRING>", 999, None, None, None, None, None
+  )
+
+  describe("ExecuteReply") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        ExecuteReply.toTypeString should be ("execute_reply")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a executeReply instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        executeReplyJson.as[ExecuteReply] should be (executeReply)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newExecuteReply = executeReplyJson.asOpt[ExecuteReply]
+
+        newExecuteReply.get should be (executeReply)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val executeReplyResults = executeReplyJson.validate[ExecuteReply]
+
+        executeReplyResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ExecuteReply) => valid
+        ) should be (executeReply)
+      }
+
+      it("should implicitly convert from a executeReply instance to valid json") {
+        Json.toJson(executeReply) should be (executeReplyJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala
new file mode 100644
index 0000000..bb8cd71
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteRequestSpec.scala
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{Matchers, FunSpec}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+import com.ibm.spark.kernel.protocol.v5._
+
+class ExecuteRequestSpec extends FunSpec with Matchers {
+  val executeRequestJson: JsValue = Json.parse("""
+  {
+    "code": "<STRING>",
+    "silent": false,
+    "store_history": false,
+    "user_expressions": {},
+    "allow_stdin": false
+  }
+  """)
+
+  val executeRequest: ExecuteRequest = ExecuteRequest(
+    "<STRING>", false, false, UserExpressions(), false
+  )
+
+  describe("ExecuteRequest") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        ExecuteRequest.toTypeString should be ("execute_request")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a executeRequest instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        executeRequestJson.as[ExecuteRequest] should be (executeRequest)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newExecuteRequest = executeRequestJson.asOpt[ExecuteRequest]
+
+        newExecuteRequest.get should be (executeRequest)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val executeRequestResults = executeRequestJson.validate[ExecuteRequest]
+
+        executeRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ExecuteRequest) => valid
+        ) should be (executeRequest)
+      }
+
+      it("should implicitly convert from a executeRequest instance to valid json") {
+        Json.toJson(executeRequest) should be (executeRequestJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala
new file mode 100644
index 0000000..fdbe3ca
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/ExecuteResultSpec.scala
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+import com.ibm.spark.kernel.protocol.v5._
+
+class ExecuteResultSpec extends FunSpec with Matchers {
+  val executeResultJson: JsValue = Json.parse("""
+  {
+    "execution_count": 999,
+    "data": {"text/plain": "resulty result"},
+    "metadata": {}
+  }
+  """)
+
+  val executeResult = ExecuteResult(
+    999, Data("text/plain" -> "resulty result"), Metadata()
+  )
+
+  describe("ExecuteResult") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        ExecuteResult.toTypeString should be ("execute_result")
+      }
+    }
+
+    describe("#hasContent") {
+      it("should be true when data has a non-empty text/plain field") {
+        executeResult.hasContent should be (true)
+      }
+
+      it("should be false if data is null") {
+        val executeResultNoData = ExecuteResult(
+          999, null, Metadata()
+        )
+        executeResultNoData.hasContent should be (false)
+      }
+
+      it("should be false when data does not have a text/plain field") {
+        val executeResultEmptyData = ExecuteResult(
+          999, Data(), Metadata()
+        )
+        executeResultEmptyData.hasContent should be (false)
+
+      }
+
+      it("should be false if text/plain field maps to an empty string") {
+        val executeResultEmptyString = ExecuteResult(
+          999, Data("text/plain" -> ""), Metadata()
+        )
+        executeResultEmptyString.hasContent should be (false)
+      }
+
+      it("should be false if text/plain maps to null") {
+        val executeResultTextPlainNull = ExecuteResult(
+          999, Data("text/plain" -> null), Metadata()
+        )
+        executeResultTextPlainNull.hasContent should be (false)
+      }
+    }
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a ExecuteResult instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        executeResultJson.as[ExecuteResult] should be (executeResult)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = executeResultJson.asOpt[ExecuteResult]
+
+        newCompleteRequest.get should be (executeResult)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = executeResultJson.validate[ExecuteResult]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: ExecuteResult) => valid
+        ) should be (executeResult)
+      }
+
+      it("should implicitly convert from a ExecuteResult instance to valid json") {
+        Json.toJson(executeResult) should be (executeResultJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala
new file mode 100644
index 0000000..4e69066
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryReplySpec.scala
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+import com.ibm.spark.kernel.protocol.v5._
+
+class HistoryReplySpec extends FunSpec with Matchers {
+  val historyReplyJson: JsValue = Json.parse("""
+  {
+    "history": ["<STRING>", "<STRING2>", "<STRING3>"]
+  }
+  """)
+
+  val historyReply = HistoryReply(
+    List("<STRING>", "<STRING2>", "<STRING3>")
+  )
+
+  describe("HistoryReply") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        HistoryReply.toTypeString should be ("history_reply")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a HistoryReply instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        historyReplyJson.as[HistoryReply] should be (historyReply)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = historyReplyJson.asOpt[HistoryReply]
+
+        newCompleteRequest.get should be (historyReply)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = historyReplyJson.validate[HistoryReply]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: HistoryReply) => valid
+        ) should be (historyReply)
+      }
+
+      it("should implicitly convert from a HistoryReply instance to valid json") {
+        Json.toJson(historyReply) should be (historyReplyJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala
new file mode 100644
index 0000000..dc775fa
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/HistoryRequestSpec.scala
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class HistoryRequestSpec extends FunSpec with Matchers {
+  val historyRequestJson: JsValue = Json.parse("""
+  {
+    "output": true,
+    "ras": true,
+    "hist_access_type": "<STRING>",
+    "session": 1,
+    "start": 0,
+    "stop": 5,
+    "n": 1,
+    "pattern": "<STRING>",
+    "unique": true
+  }
+  """)
+
+  val historyRequest = HistoryRequest(
+    true, true, "<STRING>", 1, 0, 5, 1, "<STRING>", true
+  )
+
+  describe("HistoryRequest") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        HistoryRequest.toTypeString should be ("history_request")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a HistoryRequest instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        historyRequestJson.as[HistoryRequest] should be (historyRequest)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = historyRequestJson.asOpt[HistoryRequest]
+
+        newCompleteRequest.get should be (historyRequest)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = historyRequestJson.validate[HistoryRequest]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: HistoryRequest) => valid
+        ) should be (historyRequest)
+      }
+
+      it("should implicitly convert from a HistoryRequest instance to valid json") {
+        Json.toJson(historyRequest) should be (historyRequestJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala
new file mode 100644
index 0000000..a5d14b1
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputReplySpec.scala
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class InputReplySpec extends FunSpec with Matchers {
+  val inputReplyJson: JsValue = Json.parse("""
+  {
+    "value": "<STRING>"
+  }
+  """)
+
+  val inputReply = InputReply(
+    "<STRING>"
+  )
+
+  describe("InputReply") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        InputReply.toTypeString should be ("input_reply")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a InputReply instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        inputReplyJson.as[InputReply] should be (inputReply)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteReply = inputReplyJson.asOpt[InputReply]
+
+        newCompleteReply.get should be (inputReply)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteReplyResults = inputReplyJson.validate[InputReply]
+
+        CompleteReplyResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: InputReply) => valid
+        ) should be (inputReply)
+      }
+
+      it("should implicitly convert from a InputReply instance to valid json") {
+        Json.toJson(inputReply) should be (inputReplyJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala
new file mode 100644
index 0000000..7b5b3db
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InputRequestSpec.scala
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2015 IBM Corp.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class InputRequestSpec extends FunSpec with Matchers {
+  val inputRequestJson: JsValue = Json.parse("""
+  {
+    "prompt": "<STRING>",
+    "password": true
+  }
+  """)
+
+  val inputRequest = InputRequest(
+    "<STRING>", true
+  )
+
+  describe("InputRequest") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        InputRequest.toTypeString should be ("input_request")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a InputRequest instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        inputRequestJson.as[InputRequest] should be (inputRequest)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newCompleteRequest = inputRequestJson.asOpt[InputRequest]
+
+        newCompleteRequest.get should be (inputRequest)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val CompleteRequestResults = inputRequestJson.validate[InputRequest]
+
+        CompleteRequestResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: InputRequest) => valid
+        ) should be (inputRequest)
+      }
+
+      it("should implicitly convert from a InputRequest instance to valid json") {
+        Json.toJson(inputRequest) should be (inputRequestJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala
new file mode 100644
index 0000000..b88a39a
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyErrorSpec.scala
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import com.ibm.spark.kernel.protocol.v5._
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class InspectReplyErrorSpec extends FunSpec with Matchers {
+  val inspectReplyErrorJson: JsValue = Json.parse("""
+  {
+    "status": "error",
+    "data": {},
+    "metadata": {},
+    "ename": "<STRING>",
+    "evalue": "<STRING>",
+    "traceback": []
+  }
+  """)
+
+  val inspectReplyError: InspectReplyError = InspectReplyError(
+    Data(), Metadata(), Some("<STRING>"), Some("<STRING>"), Some(List())
+  )
+
+  describe("InspectReplyError") {
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a InspectReplyError instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        inspectReplyErrorJson.as[InspectReplyError] should be (inspectReplyError)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newInspectReplyError = inspectReplyErrorJson.asOpt[InspectReplyError]
+
+        newInspectReplyError.get should be (inspectReplyError)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val InspectReplyErrorResults = inspectReplyErrorJson.validate[InspectReplyError]
+
+        InspectReplyErrorResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: InspectReplyError) => valid
+        ) should be (inspectReplyError)
+      }
+
+      it("should implicitly convert from a InspectReplyError instance to valid json") {
+        Json.toJson(inspectReplyError) should be (inspectReplyErrorJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala
new file mode 100644
index 0000000..fcea013
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplyOkSpec.scala
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+import com.ibm.spark.kernel.protocol.v5._
+
+class InspectReplyOkSpec extends FunSpec with Matchers {
+  val inspectReplyOkJson: JsValue = Json.parse("""
+  {
+    "status": "ok",
+    "data": {},
+    "metadata": {}
+  }
+  """)
+
+  val inspectReplyOk: InspectReplyOk = InspectReplyOk(
+    Data(), Metadata()
+  )
+
+  describe("InspectReplyOk") {
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a InspectReplyOk instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        inspectReplyOkJson.as[InspectReplyOk] should be (inspectReplyOk)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newInspectReplyOk = inspectReplyOkJson.asOpt[InspectReplyOk]
+
+        newInspectReplyOk.get should be (inspectReplyOk)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val InspectReplyOkResults = inspectReplyOkJson.validate[InspectReplyOk]
+
+        InspectReplyOkResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: InspectReplyOk) => valid
+        ) should be (inspectReplyOk)
+      }
+
+      it("should implicitly convert from a InspectReplyOk instance to valid json") {
+        Json.toJson(inspectReplyOk) should be (inspectReplyOkJson)
+      }
+    }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/68f7ddd6/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala
----------------------------------------------------------------------
diff --git a/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala
new file mode 100644
index 0000000..0ad56e9
--- /dev/null
+++ b/protocol/src/test/scala/org/apache/toree/kernel/protocol/v5/content/InspectReplySpec.scala
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ibm.spark.kernel.protocol.v5.content
+
+import org.scalatest.{FunSpec, Matchers}
+import play.api.data.validation.ValidationError
+import play.api.libs.json._
+
+class InspectReplySpec extends FunSpec with Matchers {
+  val inspectReplyJson: JsValue = Json.parse("""
+  {
+    "status": "<STRING>",
+    "data": {},
+    "metadata": {}
+  }
+  """)
+
+  val inspectReply: InspectReply = InspectReply(
+    "<STRING>", Map(), Map(), None, None, None
+  )
+
+  describe("InspectReply") {
+    describe("#toTypeString") {
+      it("should return correct type") {
+        InspectReply.toTypeString should be ("inspect_reply")
+      }
+    }
+
+    describe("implicit conversions") {
+      it("should implicitly convert from valid json to a InspectReply instance") {
+        // This is the least safe way to convert as an error is thrown if it fails
+        inspectReplyJson.as[InspectReply] should be (inspectReply)
+      }
+
+      it("should also work with asOpt") {
+        // This is safer, but we lose the error information as it returns
+        // None if the conversion fails
+        val newInspectReply = inspectReplyJson.asOpt[InspectReply]
+
+        newInspectReply.get should be (inspectReply)
+      }
+
+      it("should also work with validate") {
+        // This is the safest as it collects all error information (not just first error) and reports it
+        val InspectReplyResults = inspectReplyJson.validate[InspectReply]
+
+        InspectReplyResults.fold(
+          (invalid: Seq[(JsPath, Seq[ValidationError])]) => println("Failed!"),
+          (valid: InspectReply) => valid
+        ) should be (inspectReply)
+      }
+
+      it("should implicitly convert from a InspectReply instance to valid json") {
+        Json.toJson(inspectReply) should be (inspectReplyJson)
+      }
+    }
+  }
+}
+