Skip to content

Commit f858de5

Browse files
committed
Create ObjectSerializerTest.scala
(cherry picked from commit af11cf4)
1 parent 0c78caa commit f858de5

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.fasterxml.jackson.module.scala.ser
2+
3+
import com.fasterxml.jackson.module.scala.DefaultScalaModule
4+
import org.junit.runner.RunWith
5+
import org.scalatestplus.junit.JUnitRunner
6+
7+
object ObjectSerializerTest {
8+
trait TraitWithoutJsonProperty {
9+
val name = "name1"
10+
}
11+
object ObjectWithoutJsonProperty extends TraitWithoutJsonProperty {
12+
val value = "value1"
13+
}
14+
}
15+
16+
@RunWith(classOf[JUnitRunner])
17+
class ObjectSerializerTest extends SerializerTest {
18+
19+
import ObjectSerializerTest._
20+
def module = DefaultScalaModule
21+
22+
"An ObjectMapper with the DefaultScalaModule" should "serialize an object as a bean" in {
23+
serialize(ObjectWithoutJsonProperty) should (
24+
equal ("""{"name":"name1","value":"value1"}""") or
25+
equal ("""{"value":"value1","name":"name1"}""")
26+
)
27+
}
28+
}

0 commit comments

Comments
 (0)