Skip to content

Commit

Permalink
move test
Browse files Browse the repository at this point in the history
  • Loading branch information
pjfanning committed Jul 23, 2024
1 parent 88b4bd7 commit 3285775
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
package tools.jackson.module.scala.deser

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

// see EnumerationDeserializerTest for tests that also pass in Scala3
class EnumerationScala2DeserializerTest extends DeserializerTest {
import tools.jackson.module.scala.deser.EnumerationDeserializerTest._

lazy val module: DefaultScalaModule.type = DefaultScalaModule

it should "locate the annotation on BeanProperty fields" in {
val weekdayMapJson = """{"weekdayMap":{"Mon":"Boo","Fri":"Hooray!"}}"""
val result = deserialize(weekdayMapJson, classOf[HolderImpl])
result.weekdayMap should contain key Weekday.Mon
}

//TODO fix test (works in v2.18.0)
it should "deserialize a set of weekdays" ignore {
val container = new EnumSetContainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ object EnumerationDeserializerTest {

// see EnumerationScala2DeserializerTest for tests that only work in Scala2
class EnumerationDeserializerTest extends DeserializerTest {

import EnumerationDeserializerTest._
lazy val module: DefaultScalaModule.type = DefaultScalaModule

"An ObjectMapper with EnumDeserializerModule" should "deserialize a value into a scala Enumeration as a bean property" in {
Expand Down Expand Up @@ -69,6 +69,12 @@ class EnumerationDeserializerTest extends DeserializerTest {
result.weekday shouldBe Some(Weekday.Fri)
}

it should "locate the annotation on BeanProperty fields" in {
val weekdayMapJson = """{"weekdayMap":{"Mon":"Boo","Fri":"Hooray!"}}"""
val result = deserialize(weekdayMapJson, classOf[HolderImpl])
result.weekdayMap should contain key Weekday.Mon
}

val fridayEnumJson = """{"day": {"enumClass":"tools.jackson.module.scala.Weekday","value":"Fri"}}"""

val fridayInnerEnumJson = """{"day": {"enumClass":"tools.jackson.module.scala.OuterWeekday$InnerWeekday","value":"Fri"}}"""
Expand Down

0 comments on commit 3285775

Please sign in to comment.