Fix for #226 - Json - support parsing json with unknown bean properties

This commit is contained in:
rbygrave
2014-12-19 00:01:02 +13:00
parent e0159ccb4f
commit a998c0be55
3 changed files with 36 additions and 18 deletions
@@ -50,6 +50,16 @@ public class JsonContextTest {
assertEquals("Jim", ((Customer) bean).getName());
}
@Test
public void test_unknownProperty() {
String jsonWithUnknown = "{\"id\":42,\"unknownProp\":\"foo\",\"name\":\"rob\",\"version\":1}";
Customer customer = Ebean.json().toBean(Customer.class, jsonWithUnknown);
assertEquals(Integer.valueOf(42), customer.getId());
assertEquals("rob", customer.getName());
}
@Test
public void testCreateGenerator() throws Exception {