@@ -15,15 +15,18 @@ class PropertySerializationTest extends FlatSpec with Matchers {
1515
1616 it should " serialize a BooleanProperty" in {
1717 val p = new BooleanProperty ()
18- m.writeValueAsString(p) should be (""" {"type":"boolean"}""" )
18+ ._default(true )
19+
20+ m.writeValueAsString(p) should be (""" {"type":"boolean","default":true}""" )
1921 }
2022
2123 it should " deserialize a BooleanProperty" in {
22- val json = """ {"type":"boolean"}"""
24+ val json = """ {"type":"boolean","default":false }"""
2325 val p = m.readValue(json, classOf [Property ])
2426 p.getType should be (" boolean" )
2527 p.getFormat should be (null )
2628 p.getClass should be (classOf [BooleanProperty ])
29+ p.asInstanceOf [BooleanProperty ].getDefault should equal (false )
2730 m.writeValueAsString(p) should equal (json)
2831 }
2932
@@ -57,7 +60,8 @@ class PropertySerializationTest extends FlatSpec with Matchers {
5760
5861 it should " serialize a DoubleProperty" in {
5962 val p = new DoubleProperty ()
60- m.writeValueAsString(p) should be (""" {"type":"number","format":"double"}""" )
63+ ._default(3.14159 )
64+ m.writeValueAsString(p) should be (""" {"type":"number","format":"double","default":3.14159}""" )
6165 }
6266
6367 it should " deserialize a DoubleProperty" in {
@@ -71,7 +75,8 @@ class PropertySerializationTest extends FlatSpec with Matchers {
7175
7276 it should " serialize a FloatProperty" in {
7377 val p = new FloatProperty ()
74- m.writeValueAsString(p) should be (""" {"type":"number","format":"float"}""" )
78+ ._default(1.2f )
79+ m.writeValueAsString(p) should be (""" {"type":"number","format":"float","default":1.2}""" )
7580 }
7681
7782 it should " deserialize a FloatProperty" in {
@@ -85,7 +90,8 @@ class PropertySerializationTest extends FlatSpec with Matchers {
8590
8691 it should " serialize an IntegerProperty" in {
8792 val p = new IntegerProperty ()
88- m.writeValueAsString(p) should be (""" {"type":"integer","format":"int32"}""" )
93+ ._default(32 )
94+ m.writeValueAsString(p) should be (""" {"type":"integer","format":"int32","default":32}""" )
8995 }
9096
9197 it should " deserialize a IntegerProperty" in {
@@ -99,7 +105,8 @@ class PropertySerializationTest extends FlatSpec with Matchers {
99105
100106 it should " serialize a LongProperty" in {
101107 val p = new LongProperty ()
102- m.writeValueAsString(p) should be (""" {"type":"integer","format":"int64"}""" )
108+ ._default(8675309L )
109+ m.writeValueAsString(p) should be (""" {"type":"integer","format":"int64","default":8675309}""" )
103110 }
104111
105112 it should " deserialize a LongProperty" in {
@@ -164,7 +171,8 @@ class PropertySerializationTest extends FlatSpec with Matchers {
164171
165172 it should " serialize a StringProperty" in {
166173 val p = new StringProperty ()
167- m.writeValueAsString(p) should be (""" {"type":"string"}""" )
174+ ._default(" Bob" )
175+ m.writeValueAsString(p) should be (""" {"type":"string","default":"Bob"}""" )
168176 }
169177
170178 it should " deserialize a StringProperty" in {
0 commit comments