Skip to content

Commit

Permalink
add test case to demonstrate #218
Browse files Browse the repository at this point in the history
  • Loading branch information
PJ Fanning committed Jan 29, 2020
1 parent 552fc37 commit c77bf43
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.fasterxml.jackson.module.scala.ser

import java.util.UUID

import com.fasterxml.jackson.module.scala.DefaultScalaModule
import org.junit.runner.RunWith
import org.scalatestplus.junit.JUnitRunner

@RunWith(classOf[JUnitRunner])
class OverrideValSerializerTest extends SerializerTest {
lazy val module = DefaultScalaModule

trait MyTrait {
val id: UUID
val `type`: String
}

class Base(val id: UUID) extends MyTrait {
override val `type`: String = "baseclass"
}

case class Sub(override val id: UUID, something: String) extends Base(id)

"DefaultScalaModule" should "handle overrides in vals" in {
val id = UUID.randomUUID()
//TODO https://github.com/FasterXML/jackson-module-scala/issues/218
//the json should also include "id":"<idAsString>"
serialize(Sub(id, "something")) shouldBe """{"type":"baseclass","something":"something"}"""
}
}

0 comments on commit c77bf43

Please sign in to comment.