Skip to content

Commit

Permalink
add map serializer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pjfanning committed Jan 29, 2024
1 parent cc3c95a commit 7d6dff2
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package tools.jackson.module.scala.ser

import tools.jackson.module.scala.{DefaultScalaModule, JacksonModule}

import scala.collection.immutable.TreeSeqMap
import scala.collection.mutable

class Map2SerializerTest extends SerializerTest {

lazy val module: JacksonModule = DefaultScalaModule

"MapSerializerModule" should "serialize a TreeSeqMap" in {
val result = serialize(TreeSeqMap("a" -> 1, "b" -> "two", "c" -> false))
result shouldEqual """{"a":1,"b":"two","c":false}"""
}

it should "serialize a CollisionProofHashMap" in {
val result = serialize(mutable.CollisionProofHashMap("a" -> 1, "b" -> "two", "c" -> false))
result shouldEqual """{"a":1,"b":"two","c":false}"""
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package tools.jackson.module.scala.ser

import tools.jackson.module.scala.{DefaultScalaModule, JacksonModule}

import scala.collection.immutable.TreeSeqMap
import scala.collection.mutable

class Map2SerializerTest extends SerializerTest {

lazy val module: JacksonModule = DefaultScalaModule

"MapSerializerModule" should "serialize a TreeSeqMap" in {
val result = serialize(TreeSeqMap("a" -> 1, "b" -> "two", "c" -> false))
result shouldEqual """{"a":1,"b":"two","c":false}"""
}

it should "serialize a CollisionProofHashMap" in {
val result = serialize(mutable.CollisionProofHashMap("a" -> 1, "b" -> "two", "c" -> false))
result shouldEqual """{"a":1,"b":"two","c":false}"""
}
}

0 comments on commit 7d6dff2

Please sign in to comment.