Java 类org.springframework.jdbc.core.test.Person 实例源码

项目:spring4-understanding    文件:BeanPropertyRowMapperTests.java   
@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testOverridingDifferentClassDefinedForMapping() {
    BeanPropertyRowMapper mapper = new BeanPropertyRowMapper(Person.class);
    thrown.expect(InvalidDataAccessApiUsageException.class);
    mapper.setMappedClass(Long.class);
}
项目:spring4-understanding    文件:BeanPropertyRowMapperTests.java   
@Test
public void testStaticQueryWithRowMapper() throws Exception {
    Mock mock = new Mock();
    List<Person> result = mock.getJdbcTemplate().query(
            "select name, age, birth_date, balance from people",
            new BeanPropertyRowMapper<Person>(Person.class));
    assertEquals(1, result.size());
    verifyPerson(result.get(0));
    mock.verifyClosed();
}
项目:spring4-understanding    文件:BeanPropertyRowMapperTests.java   
@Test
public void testMappingNullValue() throws Exception {
    BeanPropertyRowMapper<Person> mapper = new BeanPropertyRowMapper<Person>(Person.class);
    Mock mock = new Mock(MockType.TWO);
    thrown.expect(TypeMismatchException.class);
    mock.getJdbcTemplate().query(
            "select name, null as age, birth_date, balance from people", mapper);
}
项目:class-guard    文件:BeanPropertyRowMapperTests.java   
@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testOverridingDifferentClassDefinedForMapping() {
    BeanPropertyRowMapper mapper = new BeanPropertyRowMapper(Person.class);
    thrown.expect(InvalidDataAccessApiUsageException.class);
    mapper.setMappedClass(Long.class);
}
项目:class-guard    文件:BeanPropertyRowMapperTests.java   
@Test
public void testStaticQueryWithRowMapper() throws Exception {
    Mock mock = new Mock();
    List<Person> result = mock.getJdbcTemplate().query(
            "select name, age, birth_date, balance from people",
            new BeanPropertyRowMapper<Person>(Person.class));
    assertEquals(1, result.size());
    verifyPerson(result.get(0));
    mock.verifyClosed();
}
项目:class-guard    文件:BeanPropertyRowMapperTests.java   
@Test
public void testMappingNullValue() throws Exception {
    BeanPropertyRowMapper<Person> mapper = new BeanPropertyRowMapper<Person>(Person.class);
    Mock mock = new Mock(MockType.TWO);
    thrown.expect(TypeMismatchException.class);
    mock.getJdbcTemplate().query(
            "select name, null as age, birth_date, balance from people", mapper);
}
项目:class-guard    文件:ParameterizedBeanPropertyRowMapperTests.java   
@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testOverridingDifferentClassDefinedForMapping() {
    ParameterizedBeanPropertyRowMapper mapper = ParameterizedBeanPropertyRowMapper.newInstance(Person.class);
    thrown.expect(InvalidDataAccessApiUsageException.class);
    mapper.setMappedClass(Long.class);
}
项目:class-guard    文件:ParameterizedBeanPropertyRowMapperTests.java   
@Test
public void testStaticQueryWithRowMapper() throws Exception {
    Mock mock = new Mock();
    List<Person> result = mock.getJdbcTemplate().query(
            "select name, age, birth_date, balance from people",
            ParameterizedBeanPropertyRowMapper.newInstance(Person.class));
    assertEquals(1, result.size());
    verifyPerson(result.get(0));
    mock.verifyClosed();
}
项目:spring4-understanding    文件:BeanPropertyRowMapperTests.java   
@Test
public void testOverridingSameClassDefinedForMapping() {
    BeanPropertyRowMapper<Person> mapper = new BeanPropertyRowMapper<Person>(Person.class);
    mapper.setMappedClass(Person.class);
}
项目:spring4-understanding    文件:AbstractRowMapperTests.java   
protected void verifyPerson(Person 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());
}
项目:class-guard    文件:BeanPropertyRowMapperTests.java   
@Test
public void testOverridingSameClassDefinedForMapping() {
    BeanPropertyRowMapper<Person> mapper = new BeanPropertyRowMapper<Person>(Person.class);
    mapper.setMappedClass(Person.class);
}
项目:class-guard    文件:AbstractRowMapperTests.java   
protected void verifyPerson(Person 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());
}
项目:class-guard    文件:ParameterizedBeanPropertyRowMapperTests.java   
@Test
public void testOverridingSameClassDefinedForMapping() {
    ParameterizedBeanPropertyRowMapper<Person> mapper = ParameterizedBeanPropertyRowMapper.newInstance(Person.class);
    mapper.setMappedClass(Person.class);
}