Skip to content

Commit

Permalink
Test for #73
Browse files Browse the repository at this point in the history
  • Loading branch information
christophercurrie committed Apr 30, 2013
1 parent 0cf0158 commit 6f21222
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.fasterxml.jackson.module.scala.{DefaultScalaModule, JacksonModule}
import com.fasterxml.jackson.annotation.{JsonTypeInfo, JsonInclude, JsonIgnoreProperties, JsonProperty}
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.PropertyNamingStrategy
import scala.reflect.BeanProperty

case class ConstructorTestCaseClass(intValue: Int, stringValue: String)

Expand Down Expand Up @@ -51,6 +52,11 @@ case class NonNullCaseClass2(foo: String)

case class MixedPropertyNameStyleCaseClass(camelCase: Int, snake_case: Int, alllower: Int, ALLUPPER: Int, anID: Int)

class NonCaseWithBeanProperty {
@BeanProperty var id: Int = _
@BeanProperty var bar: String = _
}

@RunWith(classOf[JUnitRunner])
class CaseClassSerializerTest extends SerializerTest with FlatSpec with ShouldMatchers {

Expand Down Expand Up @@ -151,4 +157,10 @@ class CaseClassSerializerTest extends SerializerTest with FlatSpec with ShouldMa
)
}

it should "serialize a non-case class with @BeanProperty annotations" in {
val bean = new NonCaseWithBeanProperty
bean.id = 1
bean.bar = "foo"
serialize(bean) should (equal ("""{"id":1,"bar":"foo"}"""))
}
}

0 comments on commit 6f21222

Please sign in to comment.