Skip to content

Commit

Permalink
reproduction for FasterXML#542
Browse files Browse the repository at this point in the history
  • Loading branch information
mosesn committed Sep 15, 2021
1 parent 829d5d0 commit 947e7f2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.fasterxml.jackson.module.scala

import org.scalatest.funsuite.AnyFunSuite
import com.fasterxml.jackson.databind.json.JsonMapper

object Wrapper {
object Foo {
class Baz(val num: Int)
}
}
class Qux(val qux: Wrapper.Foo.Baz)

class QuxTest extends AnyFunSuite {
test("Quxin") {
val objectMapper =
(JsonMapper
.builder().addModule(
DefaultScalaModule).build() :: ScalaObjectMapper)
val qux = objectMapper.readValue[Qux]("""{"qux": {"num": "3"}}""")
assert(qux.qux.num == 3)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ object ScalaObjectMapperTest {
val stringLongMap = Map[String, Long]("1" -> 11L, "2" -> 22L)
}

object BarWrapper {
object Bar {
final case class Baz(num: Int)
}
}
}

class ScalaObjectMapperTest extends JacksonTest {
Expand Down Expand Up @@ -301,11 +296,6 @@ class ScalaObjectMapperTest extends JacksonTest {
result shouldEqual 11
}

it should "deserialize BarWrapper.Bar.Baz" in {
val baz = mapper.readValue[BarWrapper.Bar.Baz]("""{"num": "3"}""")
baz.num shouldEqual 3
}

// No tests for the following functions:
// def acceptJsonFormatVisitor[T: Manifest](visitor: JsonFormatVisitorWrapper): Unit

Expand Down

0 comments on commit 947e7f2

Please sign in to comment.