Java Code Examples for org.springframework.jdbc.core.test.ConcretePerson

The following examples show how to use org.springframework.jdbc.core.test.ConcretePerson. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: spring-analysis-note   Source File: BeanPropertyRowMapperTests.java    License: MIT License 5 votes vote down vote up
@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.class));
	assertEquals(1, result.size());
	verifyPerson(result.get(0));
	mock.verifyClosed();
}
 
Example 2
Source Project: spring-analysis-note   Source File: BeanPropertyRowMapperTests.java    License: MIT License 5 votes vote down vote up
@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.class, true));
	assertEquals(1, result.size());
	verifyPerson(result.get(0));
	mock.verifyClosed();
}
 
Example 3
Source Project: java-technology-stack   Source File: BeanPropertyRowMapperTests.java    License: MIT License 5 votes vote down vote up
@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.class));
	assertEquals(1, result.size());
	verifyPerson(result.get(0));
	mock.verifyClosed();
}
 
Example 4
Source Project: java-technology-stack   Source File: BeanPropertyRowMapperTests.java    License: MIT License 5 votes vote down vote up
@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.class, true));
	assertEquals(1, result.size());
	verifyPerson(result.get(0));
	mock.verifyClosed();
}
 
Example 5
@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();
}
 
Example 6
@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();
}
 
Example 7
Source Project: effectivejava   Source File: BeanPropertyRowMapperTests.java    License: Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 8
Source Project: effectivejava   Source File: BeanPropertyRowMapperTests.java    License: Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 9
@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();
}
 
Example 10
Source Project: spring-analysis-note   Source File: AbstractRowMapperTests.java    License: MIT License 4 votes vote down vote up
protected void verifyPerson(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());
}
 
Example 11
Source Project: java-technology-stack   Source File: AbstractRowMapperTests.java    License: MIT License 4 votes vote down vote up
protected void verifyPerson(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());
}
 
Example 12
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());
}
 
Example 13
Source Project: effectivejava   Source File: AbstractRowMapperTests.java    License: Apache License 2.0 4 votes vote down vote up
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());
}