@Test public void testMappingWithInheritance() throws Exception { Mock mock = new Mock(); List<ConcretePerson> result = mock.getJdbcTemplate().query( "select name, age, birth_date, balance from people", new BeanPropertyRowMapper<ConcretePerson>(ConcretePerson.class)); assertEquals(1, result.size()); verifyConcretePerson(result.get(0)); mock.verifyClosed(); }
@Test public void testMappingWithNoUnpopulatedFieldsFound() throws Exception { Mock mock = new Mock(); List<ConcretePerson> result = mock.getJdbcTemplate().query( "select name, age, birth_date, balance from people", new BeanPropertyRowMapper<ConcretePerson>(ConcretePerson.class, true)); assertEquals(1, result.size()); verifyConcretePerson(result.get(0)); mock.verifyClosed(); }
@Test public void testMappingWithInheritance() throws Exception { Mock mock = new Mock(); List<ConcretePerson> result = mock.getJdbcTemplate().query( "select name, age, birth_date, balance from people", ParameterizedBeanPropertyRowMapper.newInstance(ConcretePerson.class)); assertEquals(1, result.size()); verifyConcretePerson(result.get(0)); mock.verifyClosed(); }
protected void verifyConcretePerson(ConcretePerson bean) throws Exception { assertEquals("Bubba", bean.getName()); assertEquals(22L, bean.getAge()); assertEquals(new java.util.Date(1221222L), bean.getBirth_date()); assertEquals(new BigDecimal("1234.56"), bean.getBalance()); }